mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-07 17:32:45 -04:00
Fixed page size of 4096 bytes
This commit is contained in:
parent
8171750d23
commit
dd64b69c2c
2 changed files with 3 additions and 17 deletions
|
@ -6,8 +6,7 @@
|
|||
#define KERNAUX_PFA_ZONES_COUNT_MAX 10
|
||||
#define KERNAUX_PFA_ZONE_NAME_SIZE_MAX 256
|
||||
#define KERNAUX_PFA_ZONE_NAME_SLEN_MAX (KERNAUX_PFA_ZONE_NAME_SIZE_MAX - 1)
|
||||
#define KERNAUX_PFA_PAGE_SIZE_MIN (4 * 1024)
|
||||
#define KERNAUX_PFA_PAGE_SIZE_MAX (((unsigned long long)4) * 1024 * 1024 * 1024)
|
||||
#define KERNAUX_PFA_PAGE_SIZE (4 * 1024)
|
||||
#define KERNAUX_PFA_ZONE_PAGES_COUNT_MAX (1024 * 1024)
|
||||
#define KERNAUX_PFA_ZONE_PAGE_LIST_SIZE (KERNAUX_PFA_ZONE_PAGES_COUNT_MAX / 8)
|
||||
|
||||
|
@ -28,15 +27,12 @@ struct KernAux_PFA_Zone {
|
|||
struct KernAux_PFA {
|
||||
kernaux_bool initialized;
|
||||
|
||||
unsigned long long page_size;
|
||||
|
||||
struct KernAux_PFA_Zone zones[KERNAUX_PFA_ZONES_COUNT_MAX];
|
||||
unsigned int zones_count;
|
||||
};
|
||||
|
||||
kernaux_bool KernAux_PFA_initialize_start(
|
||||
struct KernAux_PFA *pfa,
|
||||
unsigned long long page_size
|
||||
struct KernAux_PFA *pfa
|
||||
)
|
||||
__attribute__((nonnull));
|
||||
|
||||
|
|
12
src/pfa.c
12
src/pfa.c
|
@ -3,26 +3,16 @@
|
|||
#include <kernaux/pfa.h>
|
||||
|
||||
kernaux_bool KernAux_PFA_initialize_start(
|
||||
struct KernAux_PFA *const pfa,
|
||||
const unsigned long long page_size
|
||||
struct KernAux_PFA *const pfa
|
||||
) {
|
||||
if (pfa->initialized) {
|
||||
return KERNAUX_FALSE;
|
||||
}
|
||||
|
||||
if (page_size < KERNAUX_PFA_PAGE_SIZE_MIN) {
|
||||
return KERNAUX_FALSE;
|
||||
}
|
||||
|
||||
if (page_size > KERNAUX_PFA_PAGE_SIZE_MAX) {
|
||||
return KERNAUX_FALSE;
|
||||
}
|
||||
|
||||
for (unsigned long long i = 0; i < sizeof(*pfa); ++i) {
|
||||
*((unsigned char*)pfa + i) = 0;
|
||||
}
|
||||
|
||||
pfa->page_size = page_size;
|
||||
pfa->zones_count = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue