mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +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:
		
							parent
							
								
									067d0689c5
								
							
						
					
					
						commit
						e6fc7b3ff7
					
				
					 50 changed files with 143 additions and 144 deletions
				
			
		|  | @ -37,7 +37,7 @@ private: | |||
| 
 | ||||
|     RefPtr<Custody> m_parent; | ||||
|     NonnullOwnPtr<KString> m_name; | ||||
|     NonnullLockRefPtr<Inode> m_inode; | ||||
|     NonnullRefPtr<Inode> m_inode; | ||||
|     int m_mount_flags { 0 }; | ||||
| 
 | ||||
|     mutable IntrusiveListNode<Custody> m_all_custodies_list_node; | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ DevPtsFS::~DevPtsFS() = default; | |||
| 
 | ||||
| ErrorOr<void> DevPtsFS::initialize() | ||||
| { | ||||
|     m_root_inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) DevPtsFSInode(*this, 1, nullptr))); | ||||
|     m_root_inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) DevPtsFSInode(*this, 1, nullptr))); | ||||
|     m_root_inode->m_metadata.inode = { fsid(), 1 }; | ||||
|     m_root_inode->m_metadata.mode = 0040555; | ||||
|     m_root_inode->m_metadata.uid = 0; | ||||
|  | @ -44,7 +44,7 @@ Inode& DevPtsFS::root_inode() | |||
|     return *m_root_inode; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id) const | ||||
| { | ||||
|     if (inode_id.index() == 1) | ||||
|         return *m_root_inode; | ||||
|  | @ -53,7 +53,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id) | |||
|     auto* device = DeviceManagement::the().get_device(201, pty_index); | ||||
|     VERIFY(device); | ||||
| 
 | ||||
|     auto inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index(), static_cast<SlavePTY*>(device)))); | ||||
|     auto inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index(), static_cast<SlavePTY*>(device)))); | ||||
|     inode->m_metadata.inode = inode_id; | ||||
|     inode->m_metadata.size = 0; | ||||
|     inode->m_metadata.uid = device->uid(); | ||||
|  |  | |||
|  | @ -29,9 +29,9 @@ public: | |||
| 
 | ||||
| private: | ||||
|     DevPtsFS(); | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const; | ||||
| 
 | ||||
|     LockRefPtr<DevPtsFSInode> m_root_inode; | ||||
|     RefPtr<DevPtsFSInode> m_root_inode; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -63,7 +63,7 @@ ErrorOr<void> DevPtsFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSy | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFSInode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> DevPtsFSInode::lookup(StringView name) | ||||
| { | ||||
|     VERIFY(identifier().index() == 1); | ||||
| 
 | ||||
|  | @ -74,7 +74,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFSInode::lookup(StringView name) | |||
|     if (!pty_index.has_value()) | ||||
|         return ENOENT; | ||||
| 
 | ||||
|     return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<NonnullLockRefPtr<Inode>> { | ||||
|     return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<NonnullRefPtr<Inode>> { | ||||
|         for (SlavePTY& slave_pty : list) { | ||||
|             if (slave_pty.index() != pty_index.value()) | ||||
|                 continue; | ||||
|  | @ -94,7 +94,7 @@ ErrorOr<void> DevPtsFSInode::add_child(Inode&, StringView, mode_t) | |||
|     return EROFS; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| ErrorOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| { | ||||
|     return EROFS; | ||||
| } | ||||
|  |  | |||
|  | @ -29,10 +29,10 @@ private: | |||
|     virtual ErrorOr<size_t> read_bytes_locked(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<NonnullLockRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<void> flush_metadata() override; | ||||
|     virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& buffer, OpenFileDescription*) override; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) 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; | ||||
|  |  | |||
|  | @ -437,7 +437,7 @@ ErrorOr<void> Ext2FS::set_block_allocation_state(BlockIndex block_index, bool ne | |||
|     return update_bitmap_block(bgd.bg_block_bitmap, bit_index, new_state, m_super_block.s_free_blocks_count, bgd.bg_free_blocks_count); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_directory(Ext2FSInode& parent_inode, StringView name, mode_t mode, UserID uid, GroupID gid) | ||||
| ErrorOr<NonnullRefPtr<Inode>> Ext2FS::create_directory(Ext2FSInode& parent_inode, StringView name, mode_t mode, UserID uid, GroupID gid) | ||||
| { | ||||
|     MutexLocker locker(m_lock); | ||||
|     VERIFY(is_directory(mode)); | ||||
|  | @ -462,7 +462,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_directory(Ext2FSInode& parent_i | |||
|     return inode; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid) | ||||
| ErrorOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid) | ||||
| { | ||||
|     if (name.length() > EXT2_NAME_LEN) | ||||
|         return ENAMETOOLONG; | ||||
|  | @ -626,7 +626,7 @@ void Ext2FS::flush_writes() | |||
|         //        The problem is that they are quite heavy objects, and use a lot of heap memory
 | ||||
|         //        for their (child name lookup) and (block list) caches.
 | ||||
| 
 | ||||
|         m_inode_cache.remove_all_matching([](InodeIndex, LockRefPtr<Ext2FSInode> const& cached_inode) { | ||||
|         m_inode_cache.remove_all_matching([](InodeIndex, RefPtr<Ext2FSInode> const& cached_inode) { | ||||
|             // NOTE: If we're asked to look up an inode by number (via get_inode) and it turns out
 | ||||
|             //       to not exist, we remember the fact that it doesn't exist by caching a nullptr.
 | ||||
|             //       This seems like a reasonable time to uncache ideas about unknown inodes, so do that.
 | ||||
|  | @ -640,7 +640,7 @@ void Ext2FS::flush_writes() | |||
|     BlockBasedFileSystem::flush_writes(); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Ext2FSInode>> Ext2FS::build_root_inode() const | ||||
| ErrorOr<NonnullRefPtr<Ext2FSInode>> Ext2FS::build_root_inode() const | ||||
| { | ||||
|     MutexLocker locker(m_lock); | ||||
|     BlockIndex block_index; | ||||
|  | @ -648,14 +648,14 @@ ErrorOr<NonnullLockRefPtr<Ext2FSInode>> Ext2FS::build_root_inode() const | |||
|     if (!find_block_containing_inode(EXT2_ROOT_INO, block_index, offset)) | ||||
|         return EINVAL; | ||||
| 
 | ||||
|     auto inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), EXT2_ROOT_INO))); | ||||
|     auto inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), EXT2_ROOT_INO))); | ||||
| 
 | ||||
|     auto buffer = UserOrKernelBuffer::for_kernel_buffer(reinterpret_cast<u8*>(&inode->m_raw_inode)); | ||||
|     TRY(read_block(block_index, &buffer, sizeof(ext2_inode), offset)); | ||||
|     return inode; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const | ||||
| { | ||||
|     MutexLocker locker(m_lock); | ||||
|     VERIFY(inode.fsid() == fsid()); | ||||
|  | @ -669,7 +669,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const | |||
|         if (it != m_inode_cache.end()) { | ||||
|             if (!it->value) | ||||
|                 return ENOENT; | ||||
|             return NonnullLockRefPtr<Inode> { *it->value }; | ||||
|             return NonnullRefPtr<Inode> { *it->value }; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -685,7 +685,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const | |||
|     if (!find_block_containing_inode(inode.index(), block_index, offset)) | ||||
|         return EINVAL; | ||||
| 
 | ||||
|     auto new_inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index()))); | ||||
|     auto new_inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index()))); | ||||
| 
 | ||||
|     auto buffer = UserOrKernelBuffer::for_kernel_buffer(reinterpret_cast<u8*>(&new_inode->m_raw_inode)); | ||||
|     TRY(read_block(block_index, &buffer, sizeof(ext2_inode), offset)); | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ private: | |||
|     u64 blocks_per_group() const; | ||||
|     u64 inode_size() const; | ||||
| 
 | ||||
|     ErrorOr<NonnullLockRefPtr<Ext2FSInode>> build_root_inode() const; | ||||
|     ErrorOr<NonnullRefPtr<Ext2FSInode>> build_root_inode() const; | ||||
| 
 | ||||
|     ErrorOr<void> write_ext2_inode(InodeIndex, ext2_inode const&); | ||||
|     bool find_block_containing_inode(InodeIndex, BlockIndex& block_index, unsigned& offset) const; | ||||
|  | @ -71,9 +71,9 @@ private: | |||
|     virtual bool is_initialized_while_locked() override; | ||||
| 
 | ||||
|     virtual ErrorOr<void> prepare_to_clear_last_mount() override; | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const; | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> create_inode(Ext2FSInode& parent_inode, StringView name, mode_t, dev_t, UserID, GroupID); | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> create_directory(Ext2FSInode& parent_inode, StringView name, mode_t, UserID, GroupID); | ||||
|     ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> create_inode(Ext2FSInode& parent_inode, StringView name, mode_t, dev_t, UserID, GroupID); | ||||
|     ErrorOr<NonnullRefPtr<Inode>> create_directory(Ext2FSInode& parent_inode, StringView name, mode_t, UserID, GroupID); | ||||
|     virtual void flush_writes() override; | ||||
| 
 | ||||
|     BlockIndex first_block_index() const; | ||||
|  | @ -104,7 +104,7 @@ private: | |||
|     mutable ext2_super_block m_super_block {}; | ||||
|     mutable OwnPtr<KBuffer> m_cached_group_descriptor_table; | ||||
| 
 | ||||
|     mutable HashMap<InodeIndex, LockRefPtr<Ext2FSInode>> m_inode_cache; | ||||
|     mutable HashMap<InodeIndex, RefPtr<Ext2FSInode>> m_inode_cache; | ||||
| 
 | ||||
|     bool m_super_block_dirty { false }; | ||||
|     bool m_block_group_descriptors_dirty { false }; | ||||
|  | @ -125,7 +125,7 @@ private: | |||
|     ErrorOr<void> update_bitmap_block(BlockIndex bitmap_block, size_t bit_index, bool new_state, u32& super_block_counter, u16& group_descriptor_counter); | ||||
| 
 | ||||
|     Vector<OwnPtr<CachedBitmap>> m_cached_bitmaps; | ||||
|     LockRefPtr<Ext2FSInode> m_root_inode; | ||||
|     RefPtr<Ext2FSInode> m_root_inode; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -815,7 +815,7 @@ ErrorOr<void> Ext2FSInode::write_directory(Vector<Ext2FSDirectoryEntry>& entries | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid) | ||||
| ErrorOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid) | ||||
| { | ||||
|     if (Kernel::is_directory(mode)) | ||||
|         return fs().create_directory(*this, name, mode, uid, gid); | ||||
|  | @ -965,7 +965,7 @@ ErrorOr<void> Ext2FSInode::populate_lookup_cache() | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Ext2FSInode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> Ext2FSInode::lookup(StringView name) | ||||
| { | ||||
|     VERIFY(is_directory()); | ||||
|     dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]:lookup(): Looking up '{}'", identifier(), name); | ||||
|  |  | |||
|  | @ -30,10 +30,10 @@ private: | |||
|     virtual ErrorOr<size_t> read_bytes_locked(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<NonnullLockRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<void> flush_metadata() override; | ||||
|     virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& data, OpenFileDescription*) override; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; | ||||
|     virtual ErrorOr<void> add_child(Inode& child, StringView name, mode_t) override; | ||||
|     virtual ErrorOr<void> remove_child(StringView name) override; | ||||
|     virtual ErrorOr<void> replace_child(StringView name, Inode& child) override; | ||||
|  |  | |||
|  | @ -46,7 +46,7 @@ private: | |||
|     BlockBasedFileSystem::BlockIndex first_block_of_cluster(u32 cluster) const; | ||||
| 
 | ||||
|     OwnPtr<KBuffer> m_boot_record {}; | ||||
|     LockRefPtr<FATInode> m_root_inode {}; | ||||
|     RefPtr<FATInode> m_root_inode; | ||||
|     u32 m_first_data_sector { 0 }; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,10 +11,10 @@ | |||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<FATInode>> FATInode::create(FATFS& fs, FATEntry entry, Vector<FATLongFileNameEntry> const& lfn_entries) | ||||
| ErrorOr<NonnullRefPtr<FATInode>> FATInode::create(FATFS& fs, FATEntry entry, Vector<FATLongFileNameEntry> const& lfn_entries) | ||||
| { | ||||
|     auto filename = TRY(compute_filename(entry, lfn_entries)); | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) FATInode(fs, entry, move(filename))); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) FATInode(fs, entry, move(filename))); | ||||
| } | ||||
| 
 | ||||
| FATInode::FATInode(FATFS& fs, FATEntry entry, NonnullOwnPtr<KString> filename) | ||||
|  | @ -108,7 +108,7 @@ ErrorOr<void> FATInode::replace_child(StringView, Inode&) | |||
|     return Error::from_errno(EROFS); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<LockRefPtr<FATInode>> FATInode::traverse(Function<ErrorOr<bool>(LockRefPtr<FATInode>)> callback) | ||||
| ErrorOr<RefPtr<FATInode>> FATInode::traverse(Function<ErrorOr<bool>(RefPtr<FATInode>)> callback) | ||||
| { | ||||
|     VERIFY(has_flag(m_entry.attributes, FATAttributes::Directory)); | ||||
| 
 | ||||
|  | @ -233,7 +233,7 @@ ErrorOr<void> FATInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem: | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> FATInode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> FATInode::lookup(StringView name) | ||||
| { | ||||
|     MutexLocker locker(m_inode_lock); | ||||
| 
 | ||||
|  | @ -245,8 +245,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> FATInode::lookup(StringView name) | |||
| 
 | ||||
|     if (inode.is_null()) | ||||
|         return ENOENT; | ||||
|     else | ||||
|         return inode.release_nonnull(); | ||||
|     return inode.release_nonnull(); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<size_t> FATInode::write_bytes_locked(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) | ||||
|  | @ -254,7 +253,7 @@ ErrorOr<size_t> FATInode::write_bytes_locked(off_t, size_t, UserOrKernelBuffer c | |||
|     return EROFS; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> FATInode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| ErrorOr<NonnullRefPtr<Inode>> FATInode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| { | ||||
|     return EROFS; | ||||
| } | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ class FATInode final : public Inode { | |||
| public: | ||||
|     virtual ~FATInode() override = default; | ||||
| 
 | ||||
|     static ErrorOr<NonnullLockRefPtr<FATInode>> create(FATFS&, FATEntry, Vector<FATLongFileNameEntry> const& = {}); | ||||
|     static ErrorOr<NonnullRefPtr<FATInode>> create(FATFS&, FATEntry, Vector<FATLongFileNameEntry> const& = {}); | ||||
| 
 | ||||
|     FATFS& fs() { return static_cast<FATFS&>(Inode::fs()); } | ||||
|     FATFS const& fs() const { return static_cast<FATFS const&>(Inode::fs()); } | ||||
|  | @ -47,7 +47,7 @@ private: | |||
| 
 | ||||
|     ErrorOr<Vector<BlockBasedFileSystem::BlockIndex>> compute_block_list(); | ||||
|     ErrorOr<NonnullOwnPtr<KBuffer>> read_block_list(); | ||||
|     ErrorOr<LockRefPtr<FATInode>> traverse(Function<ErrorOr<bool>(LockRefPtr<FATInode>)> callback); | ||||
|     ErrorOr<RefPtr<FATInode>> traverse(Function<ErrorOr<bool>(RefPtr<FATInode>)> callback); | ||||
|     u32 first_cluster() const; | ||||
| 
 | ||||
|     // ^Inode
 | ||||
|  | @ -56,8 +56,8 @@ private: | |||
| 
 | ||||
|     virtual InodeMetadata metadata() const 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; | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ private: | |||
|     ErrorOr<void> visit_directory_record(ISO::DirectoryRecordHeader const& record, Function<ErrorOr<RecursionDecision>(ISO::DirectoryRecordHeader const*)> const& visitor) const; | ||||
| 
 | ||||
|     OwnPtr<ISO::PrimaryVolumeDescriptor> m_primary_volume; | ||||
|     LockRefPtr<ISO9660Inode> m_root_inode; | ||||
|     RefPtr<ISO9660Inode> m_root_inode; | ||||
| 
 | ||||
|     mutable u32 m_cached_inode_count { 0 }; | ||||
|     HashMap<u32, NonnullLockRefPtr<ISO9660FSDirectoryEntry>> m_directory_entry_cache; | ||||
|  |  | |||
|  | @ -75,9 +75,9 @@ ErrorOr<void> ISO9660Inode::replace_child(StringView, Inode&) | |||
|     return EROFS; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> ISO9660Inode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> ISO9660Inode::lookup(StringView name) | ||||
| { | ||||
|     LockRefPtr<Inode> inode; | ||||
|     RefPtr<Inode> inode; | ||||
|     Array<u8, max_file_identifier_length> file_identifier_buffer; | ||||
| 
 | ||||
|     TRY(fs().visit_directory_record(m_record, [&](ISO::DirectoryRecordHeader const* record) { | ||||
|  | @ -115,7 +115,7 @@ ErrorOr<size_t> ISO9660Inode::write_bytes_locked(off_t, size_t, UserOrKernelBuff | |||
|     return EROFS; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| ErrorOr<NonnullRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| { | ||||
|     return EROFS; | ||||
| } | ||||
|  | @ -160,9 +160,9 @@ ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& reco | |||
| 
 | ||||
| ISO9660Inode::~ISO9660Inode() = default; | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) | ||||
| ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name)); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name)); | ||||
| } | ||||
| 
 | ||||
| void ISO9660Inode::create_metadata() | ||||
|  |  | |||
|  | @ -23,9 +23,9 @@ public: | |||
|     // ^Inode
 | ||||
|     virtual InodeMetadata metadata() const 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<NonnullRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<void> flush_metadata() override; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) 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; | ||||
|  | @ -45,7 +45,7 @@ private: | |||
|     virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& buffer, OpenFileDescription*) override; | ||||
| 
 | ||||
|     ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); | ||||
|     static ErrorOr<NonnullLockRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); | ||||
|     static ErrorOr<NonnullRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); | ||||
| 
 | ||||
|     static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name); | ||||
|     static StringView get_normalized_filename(ISO::DirectoryRecordHeader const& record, Bytes buffer); | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ SpinlockProtected<Inode::AllInstancesList, LockRank::None>& Inode::all_instances | |||
| 
 | ||||
| void Inode::sync_all() | ||||
| { | ||||
|     Vector<NonnullLockRefPtr<Inode>, 32> inodes; | ||||
|     Vector<NonnullRefPtr<Inode>, 32> inodes; | ||||
|     Inode::all_instances().with([&](auto& all_inodes) { | ||||
|         for (auto& inode : all_inodes) { | ||||
|             if (inode.is_metadata_dirty()) | ||||
|  |  | |||
|  | @ -62,8 +62,8 @@ public: | |||
|     virtual void detach(OpenFileDescription&) { } | ||||
|     virtual void did_seek(OpenFileDescription&, off_t) { } | ||||
|     virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const = 0; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) = 0; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0; | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) = 0; | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0; | ||||
|     virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) = 0; | ||||
|     virtual ErrorOr<void> remove_child(StringView name) = 0; | ||||
|     /// Replace child atomically, incrementing the link count of the replacement
 | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| InodeFile::InodeFile(NonnullLockRefPtr<Inode>&& inode) | ||||
| InodeFile::InodeFile(NonnullRefPtr<Inode> inode) | ||||
|     : m_inode(move(inode)) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class Inode; | |||
| 
 | ||||
| class InodeFile final : public File { | ||||
| public: | ||||
|     static ErrorOr<NonnullLockRefPtr<InodeFile>> create(NonnullLockRefPtr<Inode>&& inode) | ||||
|     static ErrorOr<NonnullLockRefPtr<InodeFile>> create(NonnullRefPtr<Inode> inode) | ||||
|     { | ||||
|         auto file = adopt_lock_ref_if_nonnull(new (nothrow) InodeFile(move(inode))); | ||||
|         if (!file) | ||||
|  | @ -51,8 +51,8 @@ public: | |||
| private: | ||||
|     virtual bool is_regular_file() const override; | ||||
| 
 | ||||
|     explicit InodeFile(NonnullLockRefPtr<Inode>&&); | ||||
|     NonnullLockRefPtr<Inode> m_inode; | ||||
|     explicit InodeFile(NonnullRefPtr<Inode>); | ||||
|     NonnullRefPtr<Inode> m_inode; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -36,18 +36,18 @@ ErrorOr<NonnullOwnPtr<KString>> Mount::absolute_path() const | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| LockRefPtr<Inode> Mount::host() | ||||
| RefPtr<Inode> Mount::host() | ||||
| { | ||||
|     return m_host_custody.with([](auto& host_custody) -> LockRefPtr<Inode> { | ||||
|     return m_host_custody.with([](auto& host_custody) -> RefPtr<Inode> { | ||||
|         if (!host_custody) | ||||
|             return nullptr; | ||||
|         return &host_custody->inode(); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| LockRefPtr<Inode const> Mount::host() const | ||||
| RefPtr<Inode const> Mount::host() const | ||||
| { | ||||
|     return m_host_custody.with([](auto& host_custody) -> LockRefPtr<Inode const> { | ||||
|     return m_host_custody.with([](auto& host_custody) -> RefPtr<Inode const> { | ||||
|         if (!host_custody) | ||||
|             return nullptr; | ||||
|         return &host_custody->inode(); | ||||
|  |  | |||
|  | @ -23,8 +23,8 @@ public: | |||
|     Mount(FileSystem&, Custody* host_custody, int flags); | ||||
|     Mount(Inode& source, Custody& host_custody, int flags); | ||||
| 
 | ||||
|     LockRefPtr<Inode const> host() const; | ||||
|     LockRefPtr<Inode> host(); | ||||
|     RefPtr<Inode const> host() const; | ||||
|     RefPtr<Inode> host(); | ||||
| 
 | ||||
|     Inode const& guest() const { return *m_guest; } | ||||
|     Inode& guest() { return *m_guest; } | ||||
|  | @ -38,7 +38,7 @@ public: | |||
|     void set_flags(int flags) { m_flags = flags; } | ||||
| 
 | ||||
| private: | ||||
|     NonnullLockRefPtr<Inode> m_guest; | ||||
|     NonnullRefPtr<Inode> m_guest; | ||||
|     NonnullLockRefPtr<FileSystem> m_guest_fs; | ||||
|     SpinlockProtected<RefPtr<Custody>, LockRank::None> m_host_custody; | ||||
|     int m_flags; | ||||
|  |  | |||
|  | @ -114,7 +114,7 @@ public: | |||
| 
 | ||||
|     OwnPtr<OpenFileDescriptionData>& data(); | ||||
| 
 | ||||
|     void set_original_inode(Badge<VirtualFileSystem>, NonnullLockRefPtr<Inode>&& inode) { m_inode = move(inode); } | ||||
|     void set_original_inode(Badge<VirtualFileSystem>, NonnullRefPtr<Inode> inode) { m_inode = move(inode); } | ||||
|     void set_original_custody(Badge<VirtualFileSystem>, Custody& custody); | ||||
| 
 | ||||
|     ErrorOr<void> truncate(u64); | ||||
|  | @ -140,7 +140,7 @@ private: | |||
|         blocker_set().unblock_all_blockers_whose_conditions_are_met(); | ||||
|     } | ||||
| 
 | ||||
|     LockRefPtr<Inode> m_inode; | ||||
|     RefPtr<Inode> m_inode; | ||||
|     NonnullLockRefPtr<File> m_file; | ||||
| 
 | ||||
|     struct State { | ||||
|  |  | |||
|  | @ -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 }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -19,16 +19,16 @@ ErrorOr<NonnullLockRefPtr<FileSystem>> ProcFS::try_create() | |||
| ProcFS::ProcFS() = default; | ||||
| ProcFS::~ProcFS() = default; | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> ProcFS::get_inode(InodeIdentifier inode_id) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> ProcFS::get_inode(InodeIdentifier inode_id) const | ||||
| { | ||||
|     if (inode_id.index() == 1) | ||||
|         return *m_root_inode; | ||||
|     return TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), inode_id.index()))); | ||||
|     return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), inode_id.index()))); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<void> ProcFS::initialize() | ||||
| { | ||||
|     m_root_inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), 1))); | ||||
|     m_root_inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), 1))); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -30,9 +30,9 @@ public: | |||
| private: | ||||
|     ProcFS(); | ||||
| 
 | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const; | ||||
| 
 | ||||
|     LockRefPtr<ProcFSInode> m_root_inode; | ||||
|     RefPtr<ProcFSInode> m_root_inode; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -155,7 +155,7 @@ ErrorOr<void> ProcFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSyst | |||
|     return process->traverse_as_directory(procfs().fsid(), move(callback)); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> ProcFSInode::lookup_as_root_directory(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> ProcFSInode::lookup_as_root_directory(StringView name) | ||||
| { | ||||
|     if (name == "self"sv) | ||||
|         return procfs().get_inode({ fsid(), 2 }); | ||||
|  | @ -172,7 +172,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> ProcFSInode::lookup_as_root_directory(StringVi | |||
|     return ENOENT; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> ProcFSInode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> ProcFSInode::lookup(StringView name) | ||||
| { | ||||
|     MutexLocker locker(procfs().m_lock); | ||||
|     if (m_type == Type::ProcessSubdirectory) { | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ private: | |||
|     ProcFS const& procfs() const { return static_cast<ProcFS const&>(Inode::fs()); } | ||||
| 
 | ||||
|     // ^Inode (EROFS handling)
 | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView, mode_t, dev_t, UserID, GroupID) override { return EROFS; } | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView, mode_t, dev_t, UserID, GroupID) override { return EROFS; } | ||||
|     virtual ErrorOr<void> add_child(Inode&, StringView, mode_t) override { return EROFS; } | ||||
|     virtual ErrorOr<void> remove_child(StringView) override { return EROFS; } | ||||
|     virtual ErrorOr<void> replace_child(StringView, Inode&) override { return EROFS; } | ||||
|  | @ -65,8 +65,8 @@ private: | |||
|     virtual InodeMetadata metadata() const override; | ||||
|     virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override; | ||||
| 
 | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> lookup_as_root_directory(StringView name); | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override final; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> lookup_as_root_directory(StringView name); | ||||
|     virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override final; | ||||
| 
 | ||||
|     ErrorOr<void> refresh_process_property_data(OpenFileDescription& description); | ||||
|     ErrorOr<void> try_fetch_process_property_data(NonnullLockRefPtr<Process>, KBufferBuilder& builder) const; | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ ErrorOr<void> Process::traverse_as_directory(FileSystemID fsid, Function<ErrorOr | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_as_directory(ProcFS& procfs, StringView name) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> Process::lookup_as_directory(ProcFS& procfs, StringView name) const | ||||
| { | ||||
|     for (auto& entry : main_process_directory_entries) { | ||||
|         if (entry.name == name) | ||||
|  | @ -78,14 +78,14 @@ ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<Err | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS& procfs, StringView name) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS& procfs, StringView name) const | ||||
| { | ||||
|     auto maybe_needle = name.to_uint(); | ||||
|     if (!maybe_needle.has_value()) | ||||
|         return ENOENT; | ||||
|     auto needle = maybe_needle.release_value(); | ||||
| 
 | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> thread_stack_inode { ENOENT }; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> thread_stack_inode { ENOENT }; | ||||
|     for_each_thread([&](Thread const& thread) { | ||||
|         int tid = thread.tid().value(); | ||||
|         VERIFY(!(tid < 0)); | ||||
|  | @ -119,7 +119,7 @@ ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<E | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_children_directory(ProcFS& procfs, StringView name) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> Process::lookup_children_directory(ProcFS& procfs, StringView name) const | ||||
| { | ||||
|     auto maybe_pid = name.to_uint(); | ||||
|     if (!maybe_pid.has_value()) | ||||
|  | @ -172,7 +172,7 @@ ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, F | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_file_descriptions_directory(ProcFS& procfs, StringView name) const | ||||
| ErrorOr<NonnullRefPtr<Inode>> Process::lookup_file_descriptions_directory(ProcFS& procfs, StringView name) const | ||||
| { | ||||
|     auto maybe_index = name.to_uint(); | ||||
|     if (!maybe_index.has_value()) | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ public: | |||
| private: | ||||
|     RAMFS(); | ||||
| 
 | ||||
|     LockRefPtr<RAMFSInode> m_root_inode; | ||||
|     RefPtr<RAMFSInode> m_root_inode; | ||||
| 
 | ||||
|     // NOTE: We start by assigning InodeIndex of 2, because 0 is invalid and 1
 | ||||
|     // is reserved for the root directory inode.
 | ||||
|  |  | |||
|  | @ -32,14 +32,14 @@ RAMFSInode::RAMFSInode(RAMFS& fs) | |||
| 
 | ||||
| RAMFSInode::~RAMFSInode() = default; | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<RAMFSInode>> RAMFSInode::try_create(RAMFS& fs, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent) | ||||
| ErrorOr<NonnullRefPtr<RAMFSInode>> RAMFSInode::try_create(RAMFS& fs, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) RAMFSInode(fs, metadata, move(parent))); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) RAMFSInode(fs, metadata, move(parent))); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<RAMFSInode>> RAMFSInode::try_create_root(RAMFS& fs) | ||||
| ErrorOr<NonnullRefPtr<RAMFSInode>> RAMFSInode::try_create_root(RAMFS& fs) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) RAMFSInode(fs)); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) RAMFSInode(fs)); | ||||
| } | ||||
| 
 | ||||
| InodeMetadata RAMFSInode::metadata() const | ||||
|  | @ -234,7 +234,7 @@ ErrorOr<void> RAMFSInode::truncate_to_block_index(size_t block_index) | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> RAMFSInode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> RAMFSInode::lookup(StringView name) | ||||
| { | ||||
|     MutexLocker locker(m_inode_lock, Mutex::Mode::Shared); | ||||
|     VERIFY(is_directory()); | ||||
|  | @ -243,7 +243,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> RAMFSInode::lookup(StringView name) | |||
|         return *this; | ||||
|     if (name == "..") { | ||||
|         if (auto parent = m_parent.strong_ref()) | ||||
|             return parent.release_nonnull(); | ||||
|             return *parent; | ||||
|         return ENOENT; | ||||
|     } | ||||
| 
 | ||||
|  | @ -292,7 +292,7 @@ ErrorOr<void> RAMFSInode::chown(UserID uid, GroupID gid) | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> RAMFSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid) | ||||
| ErrorOr<NonnullRefPtr<Inode>> RAMFSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid) | ||||
| { | ||||
|     MutexLocker locker(m_inode_lock); | ||||
|     auto now = kgettimeofday(); | ||||
|  |  | |||
|  | @ -26,9 +26,9 @@ public: | |||
|     // ^Inode
 | ||||
|     virtual InodeMetadata metadata() const 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<NonnullRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<void> flush_metadata() override; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) 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; | ||||
|  | @ -40,8 +40,8 @@ public: | |||
| private: | ||||
|     RAMFSInode(RAMFS& fs, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent); | ||||
|     explicit RAMFSInode(RAMFS& fs); | ||||
|     static ErrorOr<NonnullLockRefPtr<RAMFSInode>> try_create(RAMFS&, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent); | ||||
|     static ErrorOr<NonnullLockRefPtr<RAMFSInode>> try_create_root(RAMFS&); | ||||
|     static ErrorOr<NonnullRefPtr<RAMFSInode>> try_create(RAMFS&, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent); | ||||
|     static ErrorOr<NonnullRefPtr<RAMFSInode>> try_create_root(RAMFS&); | ||||
| 
 | ||||
|     // ^Inode
 | ||||
|     virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override; | ||||
|  | @ -51,7 +51,7 @@ private: | |||
| 
 | ||||
|     struct Child { | ||||
|         NonnullOwnPtr<KString> name; | ||||
|         NonnullLockRefPtr<RAMFSInode> inode; | ||||
|         NonnullRefPtr<RAMFSInode> inode; | ||||
|         IntrusiveListNode<Child> list_node {}; | ||||
|         using List = IntrusiveList<&Child::list_node>; | ||||
|     }; | ||||
|  |  | |||
|  | @ -143,17 +143,17 @@ SysFSDirectory::SysFSDirectory(SysFSDirectory const& parent_directory) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSDirectory::to_inode(SysFS const& sysfs_instance) const | ||||
| ErrorOr<NonnullRefPtr<SysFSInode>> SysFSDirectory::to_inode(SysFS const& sysfs_instance) const | ||||
| { | ||||
|     return TRY(SysFSDirectoryInode::try_create(sysfs_instance, *this)); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSSymbolicLink::to_inode(SysFS const& sysfs_instance) const | ||||
| ErrorOr<NonnullRefPtr<SysFSInode>> SysFSSymbolicLink::to_inode(SysFS const& sysfs_instance) const | ||||
| { | ||||
|     return TRY(SysFSLinkInode::try_create(sysfs_instance, *this)); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSComponent::to_inode(SysFS const& sysfs_instance) const | ||||
| ErrorOr<NonnullRefPtr<SysFSInode>> SysFSComponent::to_inode(SysFS const& sysfs_instance) const | ||||
| { | ||||
|     return SysFSInode::try_create(sysfs_instance, *this); | ||||
| } | ||||
|  |  | |||
|  | @ -38,7 +38,7 @@ public: | |||
|     virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) { return EROFS; } | ||||
|     virtual ErrorOr<void> refresh_data(OpenFileDescription&) const { return {}; } | ||||
| 
 | ||||
|     virtual ErrorOr<NonnullLockRefPtr<SysFSInode>> to_inode(SysFS const&) const; | ||||
|     virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const&) const; | ||||
| 
 | ||||
|     InodeIndex component_index() const { return m_component_index; }; | ||||
| 
 | ||||
|  | @ -62,7 +62,7 @@ private: | |||
| class SysFSSymbolicLink : public SysFSComponent { | ||||
| public: | ||||
|     virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override final; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final; | ||||
|     virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final; | ||||
| 
 | ||||
| protected: | ||||
|     ErrorOr<NonnullOwnPtr<KString>> try_generate_return_path_to_mount_point() const; | ||||
|  | @ -78,7 +78,7 @@ 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 ErrorOr<NonnullLockRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final; | ||||
|     virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final; | ||||
| 
 | ||||
|     using ChildList = SpinlockProtected<IntrusiveList<&SysFSComponent::m_list_node>, LockRank::None>; | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,9 +11,9 @@ | |||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<SysFSDirectoryInode>> SysFSDirectoryInode::try_create(SysFS const& sysfs, SysFSComponent const& component) | ||||
| ErrorOr<NonnullRefPtr<SysFSDirectoryInode>> SysFSDirectoryInode::try_create(SysFS const& sysfs, SysFSComponent const& component) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SysFSDirectoryInode(sysfs, component)); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSDirectoryInode(sysfs, component)); | ||||
| } | ||||
| 
 | ||||
| SysFSDirectoryInode::SysFSDirectoryInode(SysFS const& fs, SysFSComponent const& component) | ||||
|  | @ -42,7 +42,7 @@ ErrorOr<void> SysFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>( | |||
|     return m_associated_component->traverse_as_directory(fs().fsid(), move(callback)); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> SysFSDirectoryInode::lookup(StringView name) | ||||
| ErrorOr<NonnullRefPtr<Inode>> SysFSDirectoryInode::lookup(StringView name) | ||||
| { | ||||
|     MutexLocker locker(fs().m_lock); | ||||
|     auto component = m_associated_component->lookup(name); | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class SysFSDirectoryInode : public SysFSInode { | |||
|     friend class SysFS; | ||||
| 
 | ||||
| public: | ||||
|     static ErrorOr<NonnullLockRefPtr<SysFSDirectoryInode>> try_create(SysFS const&, SysFSComponent const&); | ||||
|     static ErrorOr<NonnullRefPtr<SysFSDirectoryInode>> try_create(SysFS const&, SysFSComponent const&); | ||||
|     virtual ~SysFSDirectoryInode() override; | ||||
| 
 | ||||
|     SysFS& fs() { return static_cast<SysFS&>(Inode::fs()); } | ||||
|  | @ -25,7 +25,7 @@ protected: | |||
|     // ^Inode
 | ||||
|     virtual InodeMetadata metadata() const 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<NonnullRefPtr<Inode>> lookup(StringView name) override; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ public: | |||
| private: | ||||
|     SysFS(); | ||||
| 
 | ||||
|     LockRefPtr<SysFSInode> m_root_inode; | ||||
|     RefPtr<SysFSInode> m_root_inode; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -10,9 +10,9 @@ | |||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSInode::try_create(SysFS const& fs, SysFSComponent const& component) | ||||
| ErrorOr<NonnullRefPtr<SysFSInode>> SysFSInode::try_create(SysFS const& fs, SysFSComponent const& component) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SysFSInode(fs, component)); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSInode(fs, component)); | ||||
| } | ||||
| 
 | ||||
| SysFSInode::SysFSInode(SysFS const& fs, SysFSComponent const& component) | ||||
|  | @ -47,7 +47,7 @@ ErrorOr<void> SysFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSyste | |||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> SysFSInode::lookup(StringView) | ||||
| ErrorOr<NonnullRefPtr<Inode>> SysFSInode::lookup(StringView) | ||||
| { | ||||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
|  | @ -75,7 +75,7 @@ ErrorOr<size_t> SysFSInode::write_bytes_locked(off_t offset, size_t count, UserO | |||
|     return m_associated_component->write_bytes(offset, count, buffer, fd); | ||||
| } | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| ErrorOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID) | ||||
| { | ||||
|     return EROFS; | ||||
| } | ||||
|  |  | |||
|  | @ -17,18 +17,18 @@ class SysFSInode : public Inode { | |||
|     friend class SysFSDirectoryInode; | ||||
| 
 | ||||
| public: | ||||
|     static ErrorOr<NonnullLockRefPtr<SysFSInode>> try_create(SysFS const&, SysFSComponent const&); | ||||
|     static ErrorOr<NonnullRefPtr<SysFSInode>> try_create(SysFS const&, SysFSComponent const&); | ||||
|     StringView name() const { return m_associated_component->name(); } | ||||
| 
 | ||||
| protected: | ||||
|     SysFSInode(SysFS const&, SysFSComponent const&); | ||||
|     virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const 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<NonnullRefPtr<Inode>> lookup(StringView name) override; | ||||
|     virtual ErrorOr<void> flush_metadata() override; | ||||
|     virtual InodeMetadata metadata() const override; | ||||
|     virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override; | ||||
|     virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) 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; | ||||
|  |  | |||
|  | @ -9,9 +9,9 @@ | |||
| 
 | ||||
| namespace Kernel { | ||||
| 
 | ||||
| ErrorOr<NonnullLockRefPtr<SysFSLinkInode>> SysFSLinkInode::try_create(SysFS const& sysfs, SysFSComponent const& component) | ||||
| ErrorOr<NonnullRefPtr<SysFSLinkInode>> SysFSLinkInode::try_create(SysFS const& sysfs, SysFSComponent const& component) | ||||
| { | ||||
|     return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SysFSLinkInode(sysfs, component)); | ||||
|     return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSLinkInode(sysfs, component)); | ||||
| } | ||||
| 
 | ||||
| SysFSLinkInode::SysFSLinkInode(SysFS const& fs, SysFSComponent const& component) | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class SysFSLinkInode : public SysFSInode { | |||
|     friend class SysFS; | ||||
| 
 | ||||
| public: | ||||
|     static ErrorOr<NonnullLockRefPtr<SysFSLinkInode>> try_create(SysFS const&, SysFSComponent const&); | ||||
|     static ErrorOr<NonnullRefPtr<SysFSLinkInode>> try_create(SysFS const&, SysFSComponent const&); | ||||
|     virtual ~SysFSLinkInode() override; | ||||
| 
 | ||||
| protected: | ||||
|  |  | |||
|  | @ -115,7 +115,7 @@ private: | |||
|     Mount* find_mount_for_host(InodeIdentifier); | ||||
|     Mount* find_mount_for_guest(InodeIdentifier); | ||||
| 
 | ||||
|     LockRefPtr<Inode> m_root_inode; | ||||
|     RefPtr<Inode> m_root_inode; | ||||
| 
 | ||||
|     SpinlockProtected<RefPtr<Custody>, LockRank::None> m_root_custody {}; | ||||
| 
 | ||||
|  |  | |||
|  | @ -143,7 +143,7 @@ public: | |||
|         // use unsafe_ptr(), but as the name suggests, it is not safe...
 | ||||
|         LockRefPtr<T> ref; | ||||
|         // Using do_while_locked protects against a race with clear()!
 | ||||
|         m_link.do_while_locked([&](WeakLink* link) { | ||||
|         m_link.do_while_locked([&](LockWeakLink* link) { | ||||
|             if (link) | ||||
|                 ref = link->template strong_ref<T>(); | ||||
|         }); | ||||
|  | @ -153,7 +153,7 @@ public: | |||
|     [[nodiscard]] T* unsafe_ptr() const | ||||
|     { | ||||
|         T* ptr = nullptr; | ||||
|         m_link.do_while_locked([&](WeakLink* link) { | ||||
|         m_link.do_while_locked([&](LockWeakLink* link) { | ||||
|             if (link) | ||||
|                 ptr = link->unsafe_ptr<T>(); | ||||
|         }); | ||||
|  | @ -165,15 +165,15 @@ public: | |||
|     [[nodiscard]] bool is_null() const { return !m_link || m_link->is_null(); } | ||||
|     void clear() { m_link = nullptr; } | ||||
| 
 | ||||
|     [[nodiscard]] LockRefPtr<WeakLink> take_link() { return move(m_link); } | ||||
|     [[nodiscard]] LockRefPtr<LockWeakLink> take_link() { return move(m_link); } | ||||
| 
 | ||||
| private: | ||||
|     LockWeakPtr(LockRefPtr<WeakLink> const& link) | ||||
|     LockWeakPtr(LockRefPtr<LockWeakLink> const& link) | ||||
|         : m_link(link) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     LockRefPtr<WeakLink> m_link; | ||||
|     LockRefPtr<LockWeakLink> m_link; | ||||
| }; | ||||
| 
 | ||||
| template<typename T> | ||||
|  | @ -196,10 +196,10 @@ inline ErrorOr<LockWeakPtr<U>> LockWeakable<T>::try_make_weak_ptr() const | |||
|             return LockWeakPtr<U> {}; | ||||
|     } | ||||
|     if (!m_link) { | ||||
|         // There is a small chance that we create a new WeakLink and throw
 | ||||
|         // There is a small chance that we create a new LockWeakLink and throw
 | ||||
|         // it away because another thread beat us to it. But the window is
 | ||||
|         // pretty small and the overhead isn't terrible.
 | ||||
|         m_link.assign_if_null(TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) WeakLink(const_cast<T&>(static_cast<T const&>(*this)))))); | ||||
|         m_link.assign_if_null(TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) LockWeakLink(const_cast<T&>(static_cast<T const&>(*this)))))); | ||||
|     } | ||||
| 
 | ||||
|     LockWeakPtr<U> weak_ptr(m_link); | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ class LockWeakable; | |||
| template<typename T> | ||||
| class LockWeakPtr; | ||||
| 
 | ||||
| class WeakLink final : public AtomicRefCounted<WeakLink> { | ||||
| class LockWeakLink final : public AtomicRefCounted<LockWeakLink> { | ||||
|     template<typename T> | ||||
|     friend class LockWeakable; | ||||
|     template<typename T> | ||||
|  | @ -82,7 +82,7 @@ public: | |||
| 
 | ||||
| private: | ||||
|     template<typename T> | ||||
|     explicit WeakLink(T& weakable) | ||||
|     explicit LockWeakLink(T& weakable) | ||||
|         : m_ptr(&weakable) | ||||
|     { | ||||
|     } | ||||
|  | @ -115,7 +115,7 @@ protected: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     mutable LockRefPtr<WeakLink> m_link; | ||||
|     mutable LockRefPtr<LockWeakLink> m_link; | ||||
|     Atomic<bool> m_being_destroyed { false }; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ protected: | |||
| 
 | ||||
|     virtual bool is_inode() const final { return true; } | ||||
| 
 | ||||
|     NonnullLockRefPtr<Inode> m_inode; | ||||
|     NonnullRefPtr<Inode> m_inode; | ||||
|     Bitmap m_dirty_pages; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -74,7 +74,7 @@ private: | |||
|     ErrorOr<void> try_set_path(StringView); | ||||
| 
 | ||||
|     // The inode this socket is bound to.
 | ||||
|     LockRefPtr<Inode> m_inode; | ||||
|     RefPtr<Inode> m_inode; | ||||
| 
 | ||||
|     UserID m_prebind_uid { 0 }; | ||||
|     GroupID m_prebind_gid { 0 }; | ||||
|  |  | |||
|  | @ -635,7 +635,7 @@ private: | |||
| 
 | ||||
| public: | ||||
|     ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const; | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> lookup_as_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> lookup_as_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<void> procfs_get_fds_stats(KBufferBuilder& builder) const; | ||||
|     ErrorOr<void> procfs_get_perf_events(KBufferBuilder& builder) const; | ||||
|     ErrorOr<void> procfs_get_unveil_stats(KBufferBuilder& builder) const; | ||||
|  | @ -647,11 +647,11 @@ public: | |||
|     mode_t binary_link_required_mode() const; | ||||
|     ErrorOr<void> procfs_get_thread_stack(ThreadID thread_id, KBufferBuilder& builder) const; | ||||
|     ErrorOr<void> traverse_stacks_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const; | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> lookup_stacks_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> lookup_stacks_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<size_t> procfs_get_file_description_link(unsigned fd, KBufferBuilder& builder) const; | ||||
|     ErrorOr<void> traverse_file_descriptions_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const; | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> lookup_file_descriptions_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<NonnullLockRefPtr<Inode>> lookup_children_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> lookup_file_descriptions_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<NonnullRefPtr<Inode>> lookup_children_directory(ProcFS&, StringView name) const; | ||||
|     ErrorOr<void> traverse_children_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const; | ||||
|     ErrorOr<size_t> procfs_get_child_process_link(ProcessID child_pid, KBufferBuilder& builder) const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -700,7 +700,7 @@ public: | |||
| 
 | ||||
|     class FlockBlocker final : public Blocker { | ||||
|     public: | ||||
|         FlockBlocker(NonnullLockRefPtr<Inode>, flock const&); | ||||
|         FlockBlocker(NonnullRefPtr<Inode>, flock const&); | ||||
|         virtual StringView state_string() const override { return "Locking File"sv; } | ||||
|         virtual Type blocker_type() const override { return Type::Flock; } | ||||
|         virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override; | ||||
|  | @ -708,7 +708,7 @@ public: | |||
|         bool try_unblock(bool from_add_blocker); | ||||
| 
 | ||||
|     private: | ||||
|         NonnullLockRefPtr<Inode> m_inode; | ||||
|         NonnullRefPtr<Inode> m_inode; | ||||
|         flock const& m_flock; | ||||
|         bool m_did_unblock { false }; | ||||
|     }; | ||||
|  |  | |||
|  | @ -822,7 +822,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| Thread::FlockBlocker::FlockBlocker(NonnullLockRefPtr<Inode> inode, flock const& flock) | ||||
| Thread::FlockBlocker::FlockBlocker(NonnullRefPtr<Inode> inode, flock const& flock) | ||||
|     : m_inode(move(inode)) | ||||
|     , m_flock(flock) | ||||
| { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling