Files
ladybird/Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h
Liav A b02ee664e7 Kernel: Get rid of *LockRefPtr in the SysFS filesystem code
To do this we also need to get rid of LockRefPtrs in the USB code as
well.
Most of the SysFS nodes are statically generated during boot and are not
mutated afterwards.

The same goes for general device code - once we generate the appropriate
SysFS nodes, we almost never mutate the node pointers afterwards, making
locking unnecessary.
2023-04-14 19:24:54 +02:00

37 lines
1.0 KiB
C++

/*
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/RefPtr.h>
#include <AK/Try.h>
#include <AK/Types.h>
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/OpenFileDescription.h>
#include <Kernel/FileSystem/SysFS/Component.h>
#include <Kernel/KBufferBuilder.h>
#include <Kernel/Locking/Mutex.h>
#include <Kernel/UserOrKernelBuffer.h>
namespace Kernel {
class SysFSGlobalInformation : public SysFSComponent {
public:
virtual ErrorOr<size_t> read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription* description) const override;
protected:
explicit SysFSGlobalInformation(SysFSDirectory const& parent_directory);
virtual ErrorOr<void> refresh_data(OpenFileDescription&) const override;
virtual ErrorOr<void> try_generate(KBufferBuilder&) = 0;
virtual bool is_readable_by_jailed_processes() const { return false; }
mutable Mutex m_refresh_lock;
};
}