1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 09:35:08 +00:00
serenity/Kernel/FileSystem/SysFS/Subsystems/Kernel/DiskUsage.h
Liav A 95d8aa2982 Kernel: Allow read access sparingly to some /sys/kernel directory nodes
Those nodes are not exposing any sensitive information so there's no
harm in exposing them.
2022-12-03 05:47:58 -07:00

30 lines
816 B
C++

/*
* 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 SysFSDiskUsage final : public SysFSGlobalInformation {
public:
virtual StringView name() const override { return "df"sv; }
static NonnullLockRefPtr<SysFSDiskUsage> must_create(SysFSDirectory const& parent_directory);
private:
SysFSDiskUsage(SysFSDirectory const& parent_directory);
virtual ErrorOr<void> try_generate(KBufferBuilder& builder) override;
virtual bool is_readable_by_jailed_processes() const override { return true; }
};
}