1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

FileSystem: Get rid of VFS::absolute_path() and teach Mount about custodies.

This commit is contained in:
Andreas Kling 2019-05-30 21:29:26 +02:00
parent 8e83aac8a3
commit 874bffc729
6 changed files with 40 additions and 97 deletions

View file

@ -41,17 +41,20 @@ class VFS {
public:
class Mount {
public:
Mount(InodeIdentifier host, RetainPtr<FS>&&);
Mount(RetainPtr<Custody>&&, Retained<FS>&&);
InodeIdentifier host() const { return m_host; }
InodeIdentifier host() const;
InodeIdentifier guest() const { return m_guest; }
const FS& guest_fs() const { return *m_guest_fs; }
String absolute_path() const;
private:
InodeIdentifier m_host;
InodeIdentifier m_guest;
RetainPtr<FS> m_guest_fs;
Retained<FS> m_guest_fs;
RetainPtr<Custody> m_host_custody;
};
[[gnu::pure]] static VFS& the();
@ -59,8 +62,8 @@ public:
VFS();
~VFS();
bool mount_root(RetainPtr<FS>&&);
bool mount(RetainPtr<FS>&&, StringView path);
bool mount_root(Retained<FS>&&);
bool mount(Retained<FS>&&, StringView path);
KResultOr<Retained<FileDescriptor>> open(RetainPtr<Device>&&, int options);
KResultOr<Retained<FileDescriptor>> open(StringView path, int options, mode_t mode, Custody& base);
@ -86,9 +89,6 @@ public:
size_t mount_count() const { return m_mounts.size(); }
void for_each_mount(Function<void(const Mount&)>) const;
KResultOr<String> absolute_path(Inode&);
KResultOr<String> absolute_path(InodeIdentifier);
InodeIdentifier root_inode_id() const;
Inode* root_inode() { return m_root_inode.ptr(); }
const Inode* root_inode() const { return m_root_inode.ptr(); }