diff options
| author | Andrew Morton <akpm@zip.com.au> | 2002-07-28 03:14:57 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-07-28 03:14:57 -0700 |
| commit | f183c478d32d866b7018a9980eb4b61975b8f1fb (patch) | |
| tree | c1caa9e51a6ad42367cd0364ee296646c9fb452a /include | |
| parent | a854c11b7c948ce137816f2ba1bcd18e2b6ef3c3 (diff) | |
[PATCH] for_each_pgdat macro
Patch from Robert Love.
This patch implements for_each_pgdat(pg_data_t *) which is a helper
macro to cleanup code that does a loop of the form:
pgdat = pgdat_list;
while(pgdat) {
/* ... */
pgdat = pgdat->node_next;
}
and replace it with:
for_each_pgdat(pgdat) {
/* ... */
}
This code is from Rik's 2.4-rmap patch and is by William Irwin.
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/mmzone.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 7b3557e39d45..9a0bccc09e64 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -136,7 +136,7 @@ typedef struct pglist_data { unsigned long node_start_mapnr; unsigned long node_size; int node_id; - struct pglist_data *node_next; + struct pglist_data *pgdat_next; } pg_data_t; extern int numnodes; @@ -163,6 +163,20 @@ extern void free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, extern pg_data_t contig_page_data; +/** + * for_each_pgdat - helper macro to iterate over all nodes + * @pgdat - pointer to a pg_data_t variable + * + * Meant to help with common loops of the form + * pgdat = pgdat_list; + * while(pgdat) { + * ... + * pgdat = pgdat->pgdat_next; + * } + */ +#define for_each_pgdat(pgdat) \ + for (pgdat = pgdat_list; pgdat; pgdat = pgdat->pgdat_next) + #ifndef CONFIG_DISCONTIGMEM #define NODE_DATA(nid) (&contig_page_data) |
