mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
Kernel: Deemphasize inode identifiers
These APIs were clearly modeled after Ext2FS internals, and make perfect sense
in Ext2FS context. The new APIs are more generic, and map better to the
semantics exported to the userspace, where inode identifiers only appear in
stat() and readdir() output, but never in any input.
This will also hopefully reduce the potential for races (see commit c44b4d61f3
).
Lastly, this makes it way more viable to implement a filesystem that only
synthesizes its inodes lazily when queried, and destroys them when they are no
longer in use. With inode identifiers being used to reference inodes, the only
choice for such a filesystem is to persist any inode it has given out the
identifier for, because it might be queried at any later time. With direct
references to inodes, the filesystem will know when the last reference is
dropped and the inode can be safely destroyed.
This commit is contained in:
parent
c689be0dbc
commit
df66c28479
12 changed files with 133 additions and 160 deletions
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
virtual bool initialize() = 0;
|
||||
virtual const char* class_name() const = 0;
|
||||
virtual InodeIdentifier root_inode() const = 0;
|
||||
virtual NonnullRefPtr<Inode> root_inode() const = 0;
|
||||
virtual bool supports_watchers() const { return false; }
|
||||
|
||||
bool is_readonly() const { return m_readonly; }
|
||||
|
@ -78,9 +78,6 @@ public:
|
|||
u8 file_type { 0 };
|
||||
};
|
||||
|
||||
virtual KResultOr<NonnullRefPtr<Inode>> create_inode(InodeIdentifier parent_id, const String& name, mode_t, off_t size, dev_t, uid_t, gid_t) = 0;
|
||||
virtual KResult create_directory(InodeIdentifier parent_inode, const String& name, mode_t, uid_t, gid_t) = 0;
|
||||
|
||||
virtual RefPtr<Inode> get_inode(InodeIdentifier) const = 0;
|
||||
|
||||
virtual void flush_writes() { }
|
||||
|
@ -112,11 +109,6 @@ inline const FS* InodeIdentifier::fs() const
|
|||
return FS::from_fsid(m_fsid);
|
||||
}
|
||||
|
||||
inline bool InodeIdentifier::is_root_inode() const
|
||||
{
|
||||
return (*this) == fs()->root_inode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue