1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 16:15:10 +00:00

Kernel: Simplify VFS::Mount handling

No need to pass around RefPtr<>s and NonnullRefPtr<>s and no need to
heap-allocate them.

Also remove VFS::mount(NonnullRefPtr<FS>&&, StringView path) - it has been
unused for a long time.
This commit is contained in:
Sergey Bugaev 2020-01-11 18:05:24 +03:00 committed by Andreas Kling
parent 4d77cdf9a8
commit 1e6ab0ed22
2 changed files with 15 additions and 27 deletions

View file

@ -41,7 +41,7 @@ class VFS {
public:
class Mount {
public:
Mount(RefPtr<Custody>&&, NonnullRefPtr<FS>&&);
Mount(FS&, Custody* host_custody);
InodeIdentifier host() const;
InodeIdentifier guest() const { return m_guest; }
@ -62,9 +62,8 @@ public:
VFS();
~VFS();
bool mount_root(NonnullRefPtr<FS>&&);
KResult mount(NonnullRefPtr<FS>&&, StringView path);
KResult mount(NonnullRefPtr<FS>&&, Custody& mount_point);
bool mount_root(FS&);
KResult mount(FS&, Custody& mount_point);
KResult unmount(InodeIdentifier guest_inode_id);
KResultOr<NonnullRefPtr<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base, Optional<UidAndGid> = {});
@ -110,7 +109,7 @@ private:
Lock m_lock { "VFSLock" };
RefPtr<Inode> m_root_inode;
NonnullOwnPtrVector<Mount> m_mounts;
Vector<Mount> m_mounts;
RefPtr<Custody> m_root_custody;
};