/* * Copyright (c) 2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Kernel { class MountFile final : public File { public: static ErrorOr> create(FileSystemInitializer const&, int flags); virtual ~MountFile() override; virtual bool can_read(OpenFileDescription const&, u64) const override { return true; } virtual bool can_write(OpenFileDescription const&, u64) const override { return true; } virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; } virtual ErrorOr write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override { return ENOTSUP; } virtual ErrorOr ioctl(OpenFileDescription&, unsigned request, Userspace arg) override; virtual ErrorOr> pseudo_path(OpenFileDescription const&) const override; virtual StringView class_name() const override { return "MountFile"sv; } int mount_flags() const { return m_flags; } MutexProtected>& mount_file_system_specific_data() { return m_mount_specific_data; } FileSystemInitializer const& file_system_initializer() const { return m_file_system_initializer; } private: virtual bool is_mount_file() const override { return true; } MountFile(FileSystemInitializer const&, int flags, NonnullOwnPtr); int const m_flags; FileSystemInitializer const& m_file_system_initializer; MutexProtected> m_mount_specific_data; }; }