-
-
Save heatd/40652ac145ea90c1d05e71bbf49a82f5 to your computer and use it in GitHub Desktop.
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
#ifdef __clang__ | |
#pragma GCC diagnostic push | |
#pragma GCC diagnostic ignored "-Wstring-plus-int" | |
#endif | |
struct page_flag | |
{ | |
unsigned long val; | |
const char *name; | |
}; | |
/* 10 = strlen(PAGE_FLAG_) */ | |
#define X(macro) \ | |
{ \ | |
.val = macro, .name = #macro + 10 \ | |
} | |
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | |
static const struct page_flag flags[] = { | |
X(PAGE_FLAG_LOCKED), X(PAGE_FLAG_DIRTY), | |
X(PAGE_FLAG_PINNED), {.val = PAGE_BUDDY, .name = "BUDDY"}, | |
X(PAGE_FLAG_BUFFER), X(PAGE_FLAG_FILESYSTEM1), | |
X(PAGE_FLAG_WAITERS), X(PAGE_FLAG_UPTODATE), | |
X(PAGE_FLAG_WRITEBACK), X(PAGE_FLAG_READAHEAD), | |
X(PAGE_FLAG_LRU), X(PAGE_FLAG_REFERENCED), | |
}; | |
#ifdef __clang__ | |
#pragma GCC diagnostic pop | |
#endif | |
#undef X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment