ladybird/Kernel/FileSystem/Mount.h
Andreas Kling 58c6d30f6a Kernel/Ext2FS: Cache the root inode in a member variable
We often get queried for the root inode, and it will always be cached
in memory anyway, so let's make Ext2FS::root_inode() fast by keeping
the root inode in a dedicated member variable.
2021-07-18 01:53:04 +02:00

41 lines
883 B
C++

/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <Kernel/Forward.h>
namespace Kernel {
class Mount {
public:
Mount(FileSystem&, Custody* host_custody, int flags);
Mount(Inode& source, Custody& host_custody, int flags);
Inode const* host() const;
Inode* 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; }
String absolute_path() const;
int flags() const { return m_flags; }
void set_flags(int flags) { m_flags = flags; }
private:
NonnullRefPtr<Inode> m_guest;
NonnullRefPtr<FileSystem> m_guest_fs;
RefPtr<Custody> m_host_custody;
int m_flags;
};
}