libkernaux/include/kernaux/pfa.h

45 lines
866 B
C
Raw Normal View History

#ifndef KERNAUX_INCLUDED_PFA
#define KERNAUX_INCLUDED_PFA 1
2020-11-27 09:28:13 +00:00
2020-12-06 10:16:15 +00:00
#include <stdbool.h>
#define KERNAUX_PFA_PAGE_SIZE (4 * 1024)
#define KERNAUX_PFA_PAGES_COUNT_MAX (1024 * 1024)
2020-11-27 09:28:13 +00:00
#ifdef __cplusplus
extern "C" {
#endif
struct KernAux_PFA {
2020-12-06 10:16:15 +00:00
bool pages[KERNAUX_PFA_PAGES_COUNT_MAX];
};
2020-11-30 23:38:55 +00:00
void KernAux_PFA_initialize(struct KernAux_PFA *pfa)
__attribute__((nonnull));
void KernAux_PFA_mark_available(
struct KernAux_PFA *pfa,
unsigned int start,
unsigned int end
)
__attribute__((nonnull));
void KernAux_PFA_mark_unavailable(
struct KernAux_PFA *pfa,
unsigned int start,
unsigned int end
)
__attribute__((nonnull));
2020-11-30 23:38:55 +00:00
unsigned int KernAux_PFA_alloc_page(struct KernAux_PFA *pfa)
__attribute__((nonnull));
void KernAux_PFA_free_page(struct KernAux_PFA *pfa, unsigned int page_addr)
__attribute__((nonnull));
2020-11-27 09:28:13 +00:00
#ifdef __cplusplus
}
#endif
#endif