mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:28:11 +00:00
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.
This commit is contained in:
parent
dd7633c5f4
commit
b02ee664e7
114 changed files with 230 additions and 218 deletions
|
@ -9,13 +9,13 @@
|
|||
#include <AK/AtomicRefCounted.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/OpenFileDescription.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/Library/LockRefPtr.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
virtual StringView name() const = 0;
|
||||
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const { return Error::from_errno(ENOTIMPL); }
|
||||
virtual ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); }
|
||||
virtual LockRefPtr<SysFSComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
|
||||
virtual RefPtr<SysFSComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
|
||||
virtual mode_t permissions() const;
|
||||
virtual ErrorOr<void> truncate(u64) { return EPERM; }
|
||||
virtual size_t size() const { return 0; }
|
||||
|
@ -51,9 +51,9 @@ protected:
|
|||
explicit SysFSComponent(SysFSDirectory const& parent_directory);
|
||||
SysFSComponent();
|
||||
|
||||
LockRefPtr<SysFSDirectory> m_parent_directory;
|
||||
RefPtr<SysFSDirectory> const m_parent_directory;
|
||||
|
||||
IntrusiveListNode<SysFSComponent, NonnullLockRefPtr<SysFSComponent>> m_list_node;
|
||||
IntrusiveListNode<SysFSComponent, NonnullRefPtr<SysFSComponent>> m_list_node;
|
||||
|
||||
private:
|
||||
InodeIndex m_component_index {};
|
||||
|
@ -70,13 +70,13 @@ protected:
|
|||
|
||||
explicit SysFSSymbolicLink(SysFSDirectory const& parent_directory, SysFSComponent const& pointed_component);
|
||||
|
||||
LockRefPtr<SysFSComponent> m_pointed_component;
|
||||
NonnullRefPtr<SysFSComponent> const m_pointed_component;
|
||||
};
|
||||
|
||||
class SysFSDirectory : public SysFSComponent {
|
||||
public:
|
||||
virtual ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override final;
|
||||
virtual LockRefPtr<SysFSComponent> lookup(StringView name) override final;
|
||||
virtual RefPtr<SysFSComponent> lookup(StringView name) override final;
|
||||
|
||||
virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue