-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swap: Building blocks for swap support
Includes swap parsing, mkswap, swapon(1) and swapon(2). Does _not_ include actual swapping yet. Signed-off-by: Pedro Falcato <[email protected]>
- Loading branch information
Showing
13 changed files
with
726 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024 Pedro Falcato | ||
* This file is part of Onyx, and is released under the terms of the MIT License | ||
* check LICENSE at the root directory for more information | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#ifndef _UAPI_SWAP_H | ||
#define _UAPI_SWAP_H | ||
|
||
#include <onyx/types.h> | ||
|
||
#define SWAP_VERSION_CURRENT 0 | ||
/* MAGIC = "ONYXSWAP", backwards on big endian */ | ||
#define SWAP_MAGIC 0x5041575358594E4F | ||
|
||
/* Used if we go over BADBLOCKS, or if BADBLOCKS themselves are bad */ | ||
#define SWP_FLAG_BAD (1 << 0) | ||
|
||
#define SWP_RESERVED_BADBLOCKS_PAGES 8 | ||
|
||
typedef __u64 __swap_block_t; | ||
|
||
struct swap_super | ||
{ | ||
__u64 swp_magic; | ||
__u32 swp_version; | ||
__u32 swp_pagesize; | ||
__swap_block_t swp_nr_pages; | ||
__u32 swp_flags; | ||
__u32 swp_nr_badblocks; | ||
__u8 swp_uuid[16]; | ||
}; | ||
|
||
#define MIN_SWAP_SIZE_PAGES (SWP_RESERVED_BADBLOCKS_PAGES + 1) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.