Re: 2.6.12-rc5-mm1 - missing #define SECTIONS_SHIFT in sparsemem

From: Andy Whitcroft
Date: Tue May 31 2005 - 11:10:25 EST


Could you try this patch out for me. I've reordered the code
slightly to better match the original intent of the code whilst
avoiding the reference to the undefined value.

Cheers.

-apw

=== 8< ===

valdis.kletnieks@xxxxxx reported that with -Wundef triggers warnings
for each use of mm.h, out of the flags fit code for SPARSEMEM.
Change this check so that it uses the actually allocated flags widths
rather than the maxima for each. This matches the original intent,
adding the nodes field if there is space and avoids the reference
to SECTIONS_SHIFT which was triggering the warning.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>

---
mm.h | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/include/linux/mm.h current/include/linux/mm.h
--- reference/include/linux/mm.h
+++ current/include/linux/mm.h
@@ -421,12 +421,6 @@ static inline void put_page(struct page
* with space for node: | SECTION | NODE | ZONE | ... | FLAGS |
* no space for node: | SECTION | ZONE | ... | FLAGS |
*/
-#if SECTIONS_SHIFT+NODES_SHIFT+ZONES_SHIFT <= FLAGS_RESERVED
-#define NODES_WIDTH NODES_SHIFT
-#else
-#define NODES_WIDTH 0
-#endif
-
#ifdef CONFIG_SPARSEMEM
#define SECTIONS_WIDTH SECTIONS_SHIFT
#else
@@ -435,6 +429,12 @@ static inline void put_page(struct page

#define ZONES_WIDTH ZONES_SHIFT

+#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED
+#define NODES_WIDTH NODES_SHIFT
+#else
+#define NODES_WIDTH 0
+#endif
+
/* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
#define SECTIONS_PGOFF ((sizeof(page_flags_t)*8) - SECTIONS_WIDTH)
#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/