mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 07:12:43 +00:00 
			
		
		
		
	 280694bb46
			
		
	
	
		280694bb46
		
	
	
	
	
		
			
			Instead of having three separate APIs (one for each timestamp), there's now only Inode::update_timestamps() and it takes 3x optional timestamps. The non-empty timestamps are updated while holding the inode mutex, and the outside world no longer has to look at intermediate timestamp states.
		
			
				
	
	
		
			38 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 | |
|  * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Types.h>
 | |
| #include <AK/Vector.h>
 | |
| #include <Kernel/FileSystem/SysFS.h>
 | |
| #include <Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.h>
 | |
| #include <Kernel/KBuffer.h>
 | |
| #include <Kernel/Library/LockRefPtr.h>
 | |
| #include <Kernel/Memory/MappedROM.h>
 | |
| #include <Kernel/Memory/Region.h>
 | |
| #include <Kernel/PhysicalAddress.h>
 | |
| #include <Kernel/VirtualAddress.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| class PowerStateSwitchNode final : public SysFSComponent {
 | |
| public:
 | |
|     virtual StringView name() const override { return "power_state"sv; }
 | |
|     static NonnullLockRefPtr<PowerStateSwitchNode> must_create(FirmwareSysFSDirectory&);
 | |
|     virtual mode_t permissions() const override;
 | |
|     virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override;
 | |
|     virtual ErrorOr<void> truncate(u64) override;
 | |
| 
 | |
| private:
 | |
|     PowerStateSwitchNode(FirmwareSysFSDirectory&);
 | |
| 
 | |
|     void reboot();
 | |
|     void poweroff();
 | |
| };
 | |
| 
 | |
| }
 |