/* * Copyright (c) 2018-2021, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Kernel { class VirtualFileSystem; class Mount { friend class VirtualFileSystem; public: Mount(FileSystem&, Custody* host_custody, int flags); Mount(Inode& source, Custody& host_custody, int flags); LockRefPtr host() const; LockRefPtr host(); Inode const& guest() const { return *m_guest; } Inode& guest() { return *m_guest; } FileSystem const& guest_fs() const { return *m_guest_fs; } FileSystem& guest_fs() { return *m_guest_fs; } ErrorOr> absolute_path() const; int flags() const { return m_flags; } void set_flags(int flags) { m_flags = flags; } private: NonnullLockRefPtr m_guest; NonnullLockRefPtr m_guest_fs; SpinlockProtected, LockRank::None> m_host_custody; int m_flags; IntrusiveListNode m_vfs_list_node; }; }