/* * Copyright (c) 2018-2023, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include namespace Kernel { Mount::Mount(NonnullRefPtr guest_fs, RefPtr host_custody, int flags) : m_guest_fs(move(guest_fs)) , m_guest(m_guest_fs->root_inode()) , m_host_custody(move(host_custody)) , m_flags(flags) { } Mount::Mount(NonnullRefPtr source, NonnullRefPtr host_custody, int flags) : m_guest_fs(source->fs()) , m_guest(move(source)) , m_host_custody(move(host_custody)) , m_flags(flags) { } ErrorOr> Mount::absolute_path() const { if (!m_host_custody) return KString::try_create("/"sv); return m_host_custody->try_serialize_absolute_path(); } RefPtr Mount::host() { if (!m_host_custody) return nullptr; return m_host_custody->inode(); } RefPtr Mount::host() const { if (!m_host_custody) return nullptr; return m_host_custody->inode(); } }