/* * Copyright (c) 2020, Andreas Kling * Copyright (c) 2021, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include #include namespace Kernel { class PowerStateSwitchNode final : public SysFSComponent { public: virtual StringView name() const override { return "power_state"sv; } static NonnullRefPtr must_create(FirmwareSysFSDirectory&); virtual mode_t permissions() const override; virtual ErrorOr write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override; virtual ErrorOr truncate(u64) override; virtual ErrorOr set_mtime(time_t) override { return {}; } private: PowerStateSwitchNode(FirmwareSysFSDirectory&); void reboot(); void poweroff(); }; }