1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

Kernel: Make self-contained locking smart pointers their own classes

Until now, our kernel has reimplemented a number of AK classes to
provide automatic internal locking:

- RefPtr
- NonnullRefPtr
- WeakPtr
- Weakable

This patch renames the Kernel classes so that they can coexist with
the original AK classes:

- RefPtr => LockRefPtr
- NonnullRefPtr => NonnullLockRefPtr
- WeakPtr => LockWeakPtr
- Weakable => LockWeakable

The goal here is to eventually get rid of the Lock* classes in favor of
using external locking.
This commit is contained in:
Andreas Kling 2022-08-19 20:53:40 +02:00
parent e475263113
commit 11eee67b85
360 changed files with 1703 additions and 1672 deletions

View file

@ -20,7 +20,7 @@ class DevPtsFS final : public FileSystem {
public:
virtual ~DevPtsFS() override;
static ErrorOr<NonnullRefPtr<FileSystem>> try_create();
static ErrorOr<NonnullLockRefPtr<FileSystem>> try_create();
virtual ErrorOr<void> initialize() override;
virtual StringView class_name() const override { return "DevPtsFS"sv; }
@ -29,9 +29,9 @@ public:
private:
DevPtsFS();
ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const;
ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const;
RefPtr<DevPtsFSInode> m_root_inode;
LockRefPtr<DevPtsFSInode> m_root_inode;
};
class DevPtsFSInode final : public Inode {
@ -50,16 +50,16 @@ private:
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const& buffer, OpenFileDescription*) override;
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> chmod(mode_t) override;
virtual ErrorOr<void> chown(UserID, GroupID) override;
WeakPtr<SlavePTY> m_pty;
LockWeakPtr<SlavePTY> m_pty;
InodeMetadata m_metadata;
};