1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00
serenity/Kernel/FileSystem/Mount.h
Andreas Kling 673592dea8 Kernel: Stop using *LockRefPtr for FileSystem pointers
There was only one permanent storage location for these: as a member
in the Mount class.

That member is never modified after Mount initialization, so we don't
need to worry about races there.
2023-04-04 10:33:42 +02:00

49 lines
1.2 KiB
C++

/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefPtr.h>
#include <Kernel/FileSystem/Custody.h>
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Forward.h>
#include <Kernel/Library/NonnullLockRefPtr.h>
namespace Kernel {
class VirtualFileSystem;
class Mount {
friend class VirtualFileSystem;
public:
Mount(NonnullRefPtr<FileSystem>, Custody* host_custody, int flags);
Mount(Inode& source, Custody& host_custody, int flags);
RefPtr<Inode const> host() const;
RefPtr<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; }
ErrorOr<NonnullOwnPtr<KString>> 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;
SpinlockProtected<RefPtr<Custody>, LockRank::None> m_host_custody;
int m_flags;
IntrusiveListNode<Mount> m_vfs_list_node;
};
}