summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/SwapKit
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /dev/kernel/SwapKit
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/SwapKit')
-rw-r--r--dev/kernel/SwapKit/DiskSwap.h102
1 files changed, 50 insertions, 52 deletions
diff --git a/dev/kernel/SwapKit/DiskSwap.h b/dev/kernel/SwapKit/DiskSwap.h
index 78b1a896..b7e403aa 100644
--- a/dev/kernel/SwapKit/DiskSwap.h
+++ b/dev/kernel/SwapKit/DiskSwap.h
@@ -1,14 +1,14 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal El Mahrouss Labs, all rights reserved.
+ Copyright (C) 2024-2025 Amlal El Mahrouss Labs, all rights reserved.
------------------------------------------- */
#pragma once
-#include <NewKit/Defines.h>
#include <CompilerKit/CompilerKit.h>
+#include <NewKit/Defines.h>
#include <hint/CompilerHint.h>
#define kSwapBlockMaxSize (mib_cast(16))
@@ -17,58 +17,56 @@
/// @file SwapDisk.h
/// @brief Virtual memory swap disk.
-namespace Kernel
-{
- struct SWAP_DISK_HEADER;
- class DiskSwapInterface;
+namespace Kernel {
+struct SWAP_DISK_HEADER;
+class DiskSwapInterface;
- /// @brief Virtual memory interface to swap memory chunks onto disk.
- /// @note The class only supports the NeFS as of right now, as it is using forks to write data into disk.
- class DiskSwapInterface final
- {
- public:
- explicit DiskSwapInterface() = default;
- ~DiskSwapInterface() = default;
+/// @brief Virtual memory interface to swap memory chunks onto disk.
+/// @note The class only supports the NeFS as of right now, as it is using forks to write data into
+/// disk.
+class DiskSwapInterface final {
+ public:
+ explicit DiskSwapInterface() = default;
+ ~DiskSwapInterface() = default;
- NE_COPY_DELETE(DiskSwapInterface)
- NE_MOVE_DELETE(DiskSwapInterface)
+ NE_COPY_DELETE(DiskSwapInterface)
+ NE_MOVE_DELETE(DiskSwapInterface)
- public:
- /***********************************************************************************/
- /// @brief Write memory chunk onto disk.
- /// @param fork_name The swap name to recognize this memory region.
- /// @param fork_name_len length of fork name.
- /// @param data the data packet.
- /// @return Whether the swap was written to disk, or not.
- /***********************************************************************************/
- BOOL Write(const Char* fork_name, SizeT fork_name_len, SWAP_DISK_HEADER* data);
+ public:
+ /***********************************************************************************/
+ /// @brief Write memory chunk onto disk.
+ /// @param fork_name The swap name to recognize this memory region.
+ /// @param fork_name_len length of fork name.
+ /// @param data the data packet.
+ /// @return Whether the swap was written to disk, or not.
+ /***********************************************************************************/
+ BOOL Write(const Char* fork_name, SizeT fork_name_len, SWAP_DISK_HEADER* data);
- /***********************************************************************************/
- /// @brief Read memory chunk from disk.
- /// @param fork_name The swap name to recognize this memory region.
- /// @param fork_name_len length of fork name.
- /// @param data the data packet length.
- /// @return Whether the swap was fetched to disk, or not.
- /***********************************************************************************/
- _Output SWAP_DISK_HEADER* Read(const Char* fork_name, SizeT fork_name_len, SizeT data_len);
- };
+ /***********************************************************************************/
+ /// @brief Read memory chunk from disk.
+ /// @param fork_name The swap name to recognize this memory region.
+ /// @param fork_name_len length of fork name.
+ /// @param data the data packet length.
+ /// @return Whether the swap was fetched to disk, or not.
+ /***********************************************************************************/
+ _Output SWAP_DISK_HEADER* Read(const Char* fork_name, SizeT fork_name_len, SizeT data_len);
+};
- /// @brief Swap disk header, containing information about the held virtual memory.
- /// @param fMagic Ident number.
- /// @param fHeaderSz This header size.
- /// @param fTeamID Process Team ID.
- /// @param fProcessID Process ID.
- /// @param fVirtualAddress Virtual address pointed by data.
- /// @param fBlobSz Blob's size.
- /// @param fBlob Data blob.
- typedef struct SWAP_DISK_HEADER
- {
- UInt32 fMagic;
- SizeT fHeaderSz;
- UInt64 fTeamID;
- UInt64 fProcessID;
- UInt64 fVirtualAddress;
- SizeT fBlobSz;
- UInt8 fBlob[1];
- } PACKED SWAP_DISK_HEADER;
-} // namespace Kernel
+/// @brief Swap disk header, containing information about the held virtual memory.
+/// @param fMagic Ident number.
+/// @param fHeaderSz This header size.
+/// @param fTeamID Process Team ID.
+/// @param fProcessID Process ID.
+/// @param fVirtualAddress Virtual address pointed by data.
+/// @param fBlobSz Blob's size.
+/// @param fBlob Data blob.
+typedef struct SWAP_DISK_HEADER {
+ UInt32 fMagic;
+ SizeT fHeaderSz;
+ UInt64 fTeamID;
+ UInt64 fProcessID;
+ UInt64 fVirtualAddress;
+ SizeT fBlobSz;
+ UInt8 fBlob[1];
+} PACKED SWAP_DISK_HEADER;
+} // namespace Kernel