diff options
author | Liav A <liavalb@gmail.com> | 2023-02-18 18:52:44 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-19 13:47:11 +0100 |
commit | 61f4914d6e8c07352c9f1223709fe82a8432d66e (patch) | |
tree | 777bdfe2c052ba2bd1438c8d8cf40c15a56d11b3 /Kernel | |
parent | 52f156be010a9289511b7481c84367c543a06f9d (diff) | |
download | serenity-61f4914d6e8c07352c9f1223709fe82a8432d66e.zip |
Kernel+Userland: Add constants subdirectory at /sys/kernel directory
This subdirectory is meant to hold all constant data related to the
kernel. This means that this data is never meant to updated and is
relevant from system boot to system shutdown.
Move the inodes of "load_base", "cmdline" and "system_mode" to that
directory. All nodes under this new subdirectory are generated during
boot, and therefore don't require calling kmalloc each time we need to
read them. Locking is also not necessary, because these nodes and their
data are completely static once being generated.
Diffstat (limited to 'Kernel')
12 files changed, 188 insertions, 194 deletions
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 5a0c8d896a..3fc97ac722 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -170,7 +170,6 @@ set(KERNEL_SOURCES FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.cpp FileSystem/SysFS/Subsystems/Firmware/Directory.cpp - FileSystem/SysFS/Subsystems/Kernel/CommandLine.cpp FileSystem/SysFS/Subsystems/Kernel/Interrupts.cpp FileSystem/SysFS/Subsystems/Kernel/Processes.cpp FileSystem/SysFS/Subsystems/Kernel/CPUInfo.cpp @@ -178,8 +177,6 @@ set(KERNEL_SOURCES FileSystem/SysFS/Subsystems/Kernel/Keymap.cpp FileSystem/SysFS/Subsystems/Kernel/Profile.cpp FileSystem/SysFS/Subsystems/Kernel/Directory.cpp - FileSystem/SysFS/Subsystems/Kernel/LoadBase.cpp - FileSystem/SysFS/Subsystems/Kernel/SystemMode.cpp FileSystem/SysFS/Subsystems/Kernel/DiskUsage.cpp FileSystem/SysFS/Subsystems/Kernel/Log.cpp FileSystem/SysFS/Subsystems/Kernel/SystemStatistics.cpp @@ -194,6 +191,8 @@ set(KERNEL_SOURCES FileSystem/SysFS/Subsystems/Kernel/Network/Route.cpp FileSystem/SysFS/Subsystems/Kernel/Network/TCP.cpp FileSystem/SysFS/Subsystems/Kernel/Network/UDP.cpp + FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.cpp + FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.cpp FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp FileSystem/SysFS/Subsystems/Kernel/Variables/CapsLockRemap.cpp FileSystem/SysFS/Subsystems/Kernel/Variables/CoredumpDirectory.cpp diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.cpp deleted file mode 100644 index 8d77808fc3..0000000000 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <Kernel/CommandLine.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.h> -#include <Kernel/Sections.h> - -namespace Kernel { - -UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSCommandLine> SysFSCommandLine::must_create(SysFSDirectory const& parent_directory) -{ - return adopt_lock_ref_if_nonnull(new (nothrow) SysFSCommandLine(parent_directory)).release_nonnull(); -} - -UNMAP_AFTER_INIT SysFSCommandLine::SysFSCommandLine(SysFSDirectory const& parent_directory) - : SysFSGlobalInformation(parent_directory) -{ -} - -ErrorOr<void> SysFSCommandLine::try_generate(KBufferBuilder& builder) -{ - TRY(builder.append(kernel_command_line().string())); - TRY(builder.append('\n')); - return {}; -} - -} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.h b/Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.h deleted file mode 100644 index 24e8873b61..0000000000 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <AK/Types.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h> -#include <Kernel/KBufferBuilder.h> -#include <Kernel/Library/LockRefPtr.h> -#include <Kernel/UserOrKernelBuffer.h> - -namespace Kernel { - -class SysFSCommandLine final : public SysFSGlobalInformation { -public: - virtual StringView name() const override { return "cmdline"sv; } - - static NonnullLockRefPtr<SysFSCommandLine> must_create(SysFSDirectory const& parent_directory); - -private: - SysFSCommandLine(SysFSDirectory const& parent_directory); - virtual ErrorOr<void> try_generate(KBufferBuilder& builder) override; -}; - -} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.cpp new file mode 100644 index 0000000000..35b86f2796 --- /dev/null +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2023, Liav A. <liavalb@hotmail.co.il> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.h> +#include <Kernel/Process.h> +#include <Kernel/Sections.h> + +namespace Kernel { + +StringView SysFSSystemConstantInformation::name() const +{ + switch (m_node_name) { + case NodeName::LoadBase: + return "load_base"sv; + case NodeName::CommandLine: + return "cmdline"sv; + case NodeName::SystemMode: + return "system_mode"sv; + default: + VERIFY_NOT_REACHED(); + } +} + +NonnullLockRefPtr<SysFSSystemConstantInformation> SysFSSystemConstantInformation::must_create(SysFSDirectory const& parent_directory, NonnullOwnPtr<KBuffer> constant_data_buffer, mode_t mode, ReadableByJailedProcesses readable_by_jailed_processes, NodeName name) +{ + auto node = adopt_lock_ref_if_nonnull(new (nothrow) SysFSSystemConstantInformation(parent_directory, move(constant_data_buffer), mode, readable_by_jailed_processes, name)).release_nonnull(); + return node; +} + +ErrorOr<size_t> SysFSSystemConstantInformation::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription*) const +{ + if (offset < 0) + return EINVAL; + if (static_cast<size_t>(offset) >= m_constant_data_buffer->size()) + return 0; + TRY(Process::current().jail().with([&](auto const& my_jail) -> ErrorOr<void> { + if (my_jail && m_readable_by_jailed_processes == ReadableByJailedProcesses::No) + return Error::from_errno(EPERM); + return {}; + })); + ssize_t nread = min(static_cast<off_t>(m_constant_data_buffer->size() - offset), static_cast<off_t>(count)); + TRY(buffer.write(m_constant_data_buffer->data() + offset, nread)); + return nread; +} + +} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.h b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.h new file mode 100644 index 0000000000..7e26b88ba6 --- /dev/null +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2023, Liav A. <liavalb@hotmail.co.il> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <AK/AtomicRefCounted.h> +#include <AK/Error.h> +#include <AK/Types.h> +#include <Kernel/FileSystem/SysFS/Component.h> +#include <Kernel/UserOrKernelBuffer.h> + +namespace Kernel { + +class SysFSSystemConstantInformation final : public SysFSComponent { +public: + enum class NodeName { + LoadBase, + CommandLine, + SystemMode, + }; + + enum class ReadableByJailedProcesses { + Yes, + No, + }; + + virtual StringView name() const override; + static NonnullLockRefPtr<SysFSSystemConstantInformation> must_create(SysFSDirectory const& parent_directory, NonnullOwnPtr<KBuffer> constant_data_buffer, mode_t mode, ReadableByJailedProcesses readable_by_jailed_processes, NodeName name); + + virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override; + +private: + SysFSSystemConstantInformation(SysFSDirectory const& parent_directory, NonnullOwnPtr<KBuffer> constant_data_buffer, mode_t mode, ReadableByJailedProcesses readable_by_jailed_processes, NodeName name) + : SysFSComponent(parent_directory) + , m_constant_data_buffer(move(constant_data_buffer)) + , m_permissions(mode) + , m_readable_by_jailed_processes(readable_by_jailed_processes) + , m_node_name(name) + { + } + + virtual size_t size() const override { return m_constant_data_buffer->size(); } + virtual mode_t permissions() const override { return m_permissions; } + + NonnullOwnPtr<KBuffer> m_constant_data_buffer; + mode_t const m_permissions { 0644 }; + ReadableByJailedProcesses const m_readable_by_jailed_processes { ReadableByJailedProcesses::No }; + NodeName const m_node_name { NodeName::LoadBase }; +}; + +} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.cpp new file mode 100644 index 0000000000..865d14401e --- /dev/null +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023, Liav A. <liavalb@hotmail.co.il> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <AK/Error.h> +#include <AK/Try.h> +#include <Kernel/CommandLine.h> +#include <Kernel/FileSystem/SysFS/Component.h> +#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.h> +#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.h> +#include <Kernel/KBufferBuilder.h> + +namespace Kernel { + +UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSGlobalKernelConstantsDirectory> SysFSGlobalKernelConstantsDirectory::must_create(SysFSDirectory const& parent_directory) +{ + auto global_constants_directory = adopt_lock_ref_if_nonnull(new (nothrow) SysFSGlobalKernelConstantsDirectory(parent_directory)).release_nonnull(); + MUST(global_constants_directory->m_child_components.with([&](auto& list) -> ErrorOr<void> { + { + auto builder = TRY(KBufferBuilder::try_create()); + MUST(builder.appendff("{}", kernel_load_base)); + auto load_base_buffer = builder.build(); + VERIFY(load_base_buffer); + list.append(SysFSSystemConstantInformation::must_create(*global_constants_directory, load_base_buffer.release_nonnull(), S_IRUSR, SysFSSystemConstantInformation::ReadableByJailedProcesses::No, SysFSSystemConstantInformation::NodeName::LoadBase)); + } + + { + auto builder = TRY(KBufferBuilder::try_create()); + MUST(builder.append(kernel_command_line().string())); + MUST(builder.append('\n')); + auto command_line_buffer = builder.build(); + VERIFY(command_line_buffer); + list.append(SysFSSystemConstantInformation::must_create(*global_constants_directory, command_line_buffer.release_nonnull(), S_IRUSR | S_IRGRP | S_IROTH, SysFSSystemConstantInformation::ReadableByJailedProcesses::No, SysFSSystemConstantInformation::NodeName::CommandLine)); + } + + { + auto builder = TRY(KBufferBuilder::try_create()); + MUST(builder.append(kernel_command_line().system_mode())); + MUST(builder.append('\n')); + auto system_mode_buffer = builder.build(); + VERIFY(system_mode_buffer); + list.append(SysFSSystemConstantInformation::must_create(*global_constants_directory, system_mode_buffer.release_nonnull(), S_IRUSR | S_IRGRP | S_IROTH, SysFSSystemConstantInformation::ReadableByJailedProcesses::No, SysFSSystemConstantInformation::NodeName::SystemMode)); + } + return {}; + })); + return global_constants_directory; +} + +UNMAP_AFTER_INIT SysFSGlobalKernelConstantsDirectory::SysFSGlobalKernelConstantsDirectory(SysFSDirectory const& parent_directory) + : SysFSDirectory(parent_directory) +{ +} + +} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.h b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.h new file mode 100644 index 0000000000..1a27949744 --- /dev/null +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023, Liav A. <liavalb@hotmail.co.il> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <AK/Types.h> +#include <Kernel/FileSystem/SysFS/Component.h> +#include <Kernel/FileSystem/SysFS/RootDirectory.h> + +namespace Kernel { + +class SysFSGlobalKernelConstantsDirectory : public SysFSDirectory { +public: + static NonnullLockRefPtr<SysFSGlobalKernelConstantsDirectory> must_create(SysFSDirectory const&); + virtual StringView name() const override { return "constants"sv; } + +private: + explicit SysFSGlobalKernelConstantsDirectory(SysFSDirectory const&); +}; + +} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Directory.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Directory.cpp index 469f7d3fb5..187fba5ef5 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Directory.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Directory.cpp @@ -8,21 +8,19 @@ #include <AK/Try.h> #include <Kernel/FileSystem/SysFS/Component.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/CPUInfo.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/CommandLine.h> +#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Directory.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/DiskUsage.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Interrupts.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Jails.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Keymap.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Log.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/MemoryStatus.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Network/Directory.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Processes.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Profile.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemStatistics.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Uptime.h> #include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/Directory.h> @@ -32,7 +30,9 @@ namespace Kernel { UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSGlobalKernelStatsDirectory> SysFSGlobalKernelStatsDirectory::must_create(SysFSRootDirectory const& root_directory) { auto global_kernel_stats_directory = adopt_lock_ref_if_nonnull(new (nothrow) SysFSGlobalKernelStatsDirectory(root_directory)).release_nonnull(); + auto global_constants_directory = SysFSGlobalKernelConstantsDirectory::must_create(*global_kernel_stats_directory); MUST(global_kernel_stats_directory->m_child_components.with([&](auto& list) -> ErrorOr<void> { + list.append(global_constants_directory); list.append(SysFSDiskUsage::must_create(*global_kernel_stats_directory)); list.append(SysFSMemoryStatus::must_create(*global_kernel_stats_directory)); list.append(SysFSSystemStatistics::must_create(*global_kernel_stats_directory)); @@ -42,10 +42,7 @@ UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSGlobalKernelStatsDirectory> SysFSGlobalK list.append(SysFSInterrupts::must_create(*global_kernel_stats_directory)); list.append(SysFSKeymap::must_create(*global_kernel_stats_directory)); list.append(SysFSUptime::must_create(*global_kernel_stats_directory)); - list.append(SysFSCommandLine::must_create(*global_kernel_stats_directory)); - list.append(SysFSSystemMode::must_create(*global_kernel_stats_directory)); list.append(SysFSProfile::must_create(*global_kernel_stats_directory)); - list.append(SysFSKernelLoadBase::must_create(*global_kernel_stats_directory)); list.append(SysFSPowerStateSwitchNode::must_create(*global_kernel_stats_directory)); list.append(SysFSJails::must_create(*global_kernel_stats_directory)); diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.cpp deleted file mode 100644 index d5e519ecd5..0000000000 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.h> -#include <Kernel/Process.h> -#include <Kernel/Sections.h> - -namespace Kernel { - -UNMAP_AFTER_INIT SysFSKernelLoadBase::SysFSKernelLoadBase(SysFSDirectory const& parent_directory) - : SysFSGlobalInformation(parent_directory) -{ -} - -UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSKernelLoadBase> SysFSKernelLoadBase::must_create(SysFSDirectory const& parent_directory) -{ - return adopt_lock_ref_if_nonnull(new (nothrow) SysFSKernelLoadBase(parent_directory)).release_nonnull(); -} - -ErrorOr<void> SysFSKernelLoadBase::try_generate(KBufferBuilder& builder) -{ - auto current_process_credentials = Process::current().credentials(); - if (!current_process_credentials->is_superuser()) - return EPERM; - return builder.appendff("{}", kernel_load_base); -} - -mode_t SysFSKernelLoadBase::permissions() const -{ - // Note: The kernel load address should not be exposed to non-root users - // as it will help defeat KASLR. - return S_IRUSR; -} - -} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.h b/Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.h deleted file mode 100644 index 4a0e92fd8f..0000000000 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/LoadBase.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <AK/Types.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h> -#include <Kernel/KBufferBuilder.h> -#include <Kernel/Library/LockRefPtr.h> -#include <Kernel/UserOrKernelBuffer.h> - -namespace Kernel { - -class SysFSKernelLoadBase final : public SysFSGlobalInformation { -public: - virtual StringView name() const override { return "load_base"sv; } - - static NonnullLockRefPtr<SysFSKernelLoadBase> must_create(SysFSDirectory const& parent_directory); - -private: - explicit SysFSKernelLoadBase(SysFSDirectory const& parent_directory); - - virtual mode_t permissions() const override; - - virtual ErrorOr<void> try_generate(KBufferBuilder& builder) override; -}; - -} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.cpp deleted file mode 100644 index 36a4716fa3..0000000000 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <Kernel/CommandLine.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.h> -#include <Kernel/Sections.h> - -namespace Kernel { - -UNMAP_AFTER_INIT SysFSSystemMode::SysFSSystemMode(SysFSDirectory const& parent_directory) - : SysFSGlobalInformation(parent_directory) -{ -} - -UNMAP_AFTER_INIT NonnullLockRefPtr<SysFSSystemMode> SysFSSystemMode::must_create(SysFSDirectory const& parent_directory) -{ - return adopt_lock_ref_if_nonnull(new (nothrow) SysFSSystemMode(parent_directory)).release_nonnull(); -} - -ErrorOr<void> SysFSSystemMode::try_generate(KBufferBuilder& builder) -{ - TRY(builder.append(kernel_command_line().system_mode())); - TRY(builder.append('\n')); - return {}; -} - -} diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.h b/Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.h deleted file mode 100644 index e137000cab..0000000000 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/SystemMode.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <AK/Types.h> -#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.h> -#include <Kernel/KBufferBuilder.h> -#include <Kernel/Library/LockRefPtr.h> -#include <Kernel/UserOrKernelBuffer.h> - -namespace Kernel { - -class SysFSSystemMode final : public SysFSGlobalInformation { -public: - virtual StringView name() const override { return "system_mode"sv; } - - static NonnullLockRefPtr<SysFSSystemMode> must_create(SysFSDirectory const& parent_directory); - -private: - explicit SysFSSystemMode(SysFSDirectory const& parent_directory); - virtual ErrorOr<void> try_generate(KBufferBuilder& builder) override; -}; - -} |