Mount.h 883 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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/Forward.h>
  9. namespace Kernel {
  10. class Mount {
  11. public:
  12. Mount(FileSystem&, Custody* host_custody, int flags);
  13. Mount(Inode& source, Custody& host_custody, int flags);
  14. Inode const* host() const;
  15. Inode* host();
  16. Inode const& guest() const { return *m_guest; }
  17. Inode& guest() { return *m_guest; }
  18. FileSystem const& guest_fs() const { return *m_guest_fs; }
  19. FileSystem& guest_fs() { return *m_guest_fs; }
  20. String absolute_path() const;
  21. int flags() const { return m_flags; }
  22. void set_flags(int flags) { m_flags = flags; }
  23. private:
  24. NonnullRefPtr<Inode> m_guest;
  25. NonnullRefPtr<FileSystem> m_guest_fs;
  26. RefPtr<Custody> m_host_custody;
  27. int m_flags;
  28. };
  29. }