mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
Kernel: Make VirtualFileSystem::Mount a top-level class
And move it to its own compilation unit.
This commit is contained in:
51
Kernel/FileSystem/Mount.cpp
Normal file
51
Kernel/FileSystem/Mount.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/FileSystem/Mount.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
Mount::Mount(FileSystem& guest_fs, Custody* host_custody, int flags)
|
||||
: m_guest(guest_fs.root_inode())
|
||||
, m_guest_fs(guest_fs)
|
||||
, m_host_custody(host_custody)
|
||||
, m_flags(flags)
|
||||
{
|
||||
}
|
||||
|
||||
Mount::Mount(Inode& source, Custody& host_custody, int flags)
|
||||
: m_guest(source)
|
||||
, m_guest_fs(source.fs())
|
||||
, m_host_custody(host_custody)
|
||||
, m_flags(flags)
|
||||
{
|
||||
}
|
||||
|
||||
String Mount::absolute_path() const
|
||||
{
|
||||
if (!m_host_custody)
|
||||
return "/";
|
||||
return m_host_custody->absolute_path();
|
||||
}
|
||||
|
||||
Inode* Mount::host()
|
||||
{
|
||||
if (!m_host_custody)
|
||||
return nullptr;
|
||||
return &m_host_custody->inode();
|
||||
}
|
||||
|
||||
Inode const* Mount::host() const
|
||||
{
|
||||
if (!m_host_custody)
|
||||
return nullptr;
|
||||
return &m_host_custody->inode();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user