Mount.h 922 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/NonnullRefPtr.h>
  8. #include <Kernel/FileSystem/Custody.h>
  9. #include <Kernel/Forward.h>
  10. namespace Kernel {
  11. class Mount {
  12. public:
  13. Mount(FileSystem&, Custody* host_custody, int flags);
  14. Mount(Inode& source, Custody& host_custody, int flags);
  15. Inode const* host() const;
  16. Inode* host();
  17. Inode const& guest() const { return *m_guest; }
  18. Inode& guest() { return *m_guest; }
  19. FileSystem const& guest_fs() const { return *m_guest_fs; }
  20. FileSystem& guest_fs() { return *m_guest_fs; }
  21. String absolute_path() const;
  22. int flags() const { return m_flags; }
  23. void set_flags(int flags) { m_flags = flags; }
  24. private:
  25. NonnullRefPtr<Inode> m_guest;
  26. NonnullRefPtr<FileSystem> m_guest_fs;
  27. RefPtr<Custody> m_host_custody;
  28. int m_flags;
  29. };
  30. }