Enforce the number of pages in a sector to be a power of two.

This commit is contained in:
nvt-se 2008-08-15 22:38:43 +00:00
parent a6148ac3d0
commit 8b7e743921

View file

@ -53,6 +53,11 @@
#define PRINTF(...) #define PRINTF(...)
#endif #endif
#if COFFEE_PAGES_PER_SECTOR & (COFFEE_PAGES_PER_SECTOR - 1)
#error COFFEE_PAGES_PER_SECTOR must be a power of two.
#error Change COFFEE_PAGES_PER_SECTOR in cfs-coffee-arch.h.
#endif
#define kb * 1024UL #define kb * 1024UL
#define Mb * (1024 kb) #define Mb * (1024 kb)
@ -322,6 +327,7 @@ find_contiguous_pages(unsigned wanted)
return start; return start;
} }
} }
/* Jump to the next sector. */
page = (page + COFFEE_PAGES_PER_SECTOR) & ~(COFFEE_PAGES_PER_SECTOR - 1); page = (page + COFFEE_PAGES_PER_SECTOR) & ~(COFFEE_PAGES_PER_SECTOR - 1);
} else { } else {
start = -1; start = -1;