1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

Kernel: Switch LockRefPtr<Inode> to RefPtr<Inode>

The main place where this is a little iffy is in RAMFS where inodes
have a LockWeakPtr to their parent inode. I've left that as a
LockWeakPtr for now.
This commit is contained in:
Andreas Kling 2023-03-07 12:25:00 +01:00
parent 067d0689c5
commit e6fc7b3ff7
50 changed files with 143 additions and 144 deletions

View file

@ -125,7 +125,7 @@ private:
void thread_main();
void ensure_thread();
LockRefPtr<Plan9FSInode> m_root_inode;
RefPtr<Plan9FSInode> m_root_inode;
Atomic<u16> m_next_tag { (u16)-1 };
Atomic<u32> m_next_fid { 1 };

View file

@ -14,9 +14,9 @@ Plan9FSInode::Plan9FSInode(Plan9FS& fs, u32 fid)
{
}
ErrorOr<NonnullLockRefPtr<Plan9FSInode>> Plan9FSInode::try_create(Plan9FS& fs, u32 fid)
ErrorOr<NonnullRefPtr<Plan9FSInode>> Plan9FSInode::try_create(Plan9FS& fs, u32 fid)
{
return adopt_nonnull_lock_ref_or_enomem(new (nothrow) Plan9FSInode(fs, fid));
return adopt_nonnull_ref_or_enomem(new (nothrow) Plan9FSInode(fs, fid));
}
Plan9FSInode::~Plan9FSInode()
@ -245,7 +245,7 @@ ErrorOr<void> Plan9FSInode::traverse_as_directory(Function<ErrorOr<void>(FileSys
return ENOTIMPL;
}
ErrorOr<NonnullLockRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
ErrorOr<NonnullRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
{
u32 newfid = fs().allocate_fid();
Plan9FSMessage message { fs(), Plan9FSMessage::Type::Twalk };
@ -254,7 +254,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
return TRY(Plan9FSInode::try_create(fs(), newfid));
}
ErrorOr<NonnullLockRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
ErrorOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
// TODO
return ENOTIMPL;

View file

@ -26,8 +26,8 @@ public:
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<NonnullRefPtr<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> replace_child(StringView name, Inode& child) override;
@ -41,7 +41,7 @@ private:
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& data, OpenFileDescription*) override;
Plan9FSInode(Plan9FS&, u32 fid);
static ErrorOr<NonnullLockRefPtr<Plan9FSInode>> try_create(Plan9FS&, u32 fid);
static ErrorOr<NonnullRefPtr<Plan9FSInode>> try_create(Plan9FS&, u32 fid);
enum class GetAttrMask : u64 {
Mode = 0x1,