Skip to content

Commit

Permalink
vmm: add explicit gfp_flags_t type
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Sep 12, 2023
1 parent 29ab2da commit 6c435cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions include/mm/vmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,24 @@ enum gfp_flags {
GFP_IDENT = 0x00000004,
GFP_KERNEL_MAP = 0x00000008,
};
typedef enum gfp_flags gfp_flags_t;

/* External definitions */

extern void *get_free_pages(unsigned int order, uint32_t flags);
extern void *get_free_pages(unsigned int order, gfp_flags_t flags);
extern void put_pages(void *page, unsigned int order);

/* Static definitions */

static inline void *get_free_page(uint32_t flags) {
static inline void *get_free_page(gfp_flags_t flags) {
return get_free_pages(PAGE_ORDER_4K, flags);
}

static inline void *get_free_pages_top(unsigned int order, uint32_t flags) {
static inline void *get_free_pages_top(unsigned int order, gfp_flags_t flags) {
return get_free_pages(order, flags) + (PAGE_SIZE << order);
}

static inline void *get_free_page_top(uint32_t flags) {
static inline void *get_free_page_top(gfp_flags_t flags) {
return get_free_page(flags) + PAGE_SIZE;
}

Expand Down
2 changes: 1 addition & 1 deletion mm/vmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <mm/pmm.h>
#include <mm/vmm.h>

void *get_free_pages(unsigned int order, uint32_t flags) {
void *get_free_pages(unsigned int order, gfp_flags_t flags) {
frame_t *frame = get_free_frames(order);
void *va = NULL;
mfn_t mfn;
Expand Down

0 comments on commit 6c435cc

Please sign in to comment.