[Concept,31/33] linux: Add PAGE_SHIFT and PAGE_MASK to linux/compat.h

Message ID 20260121220857.2137568-32-sjg@u-boot.org
State New
Headers
Series Reorganise ext4l compatibility stubs |

Commit Message

Simon Glass Jan. 21, 2026, 10:08 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add PAGE_SHIFT and PAGE_MASK definitions alongside the existing
PAGE_SIZE definition in linux/compat.h. This allows ext4l to use
these standard page-related constants from a common header.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h  | 12 ------------
 include/linux/compat.h |  7 +++++++
 2 files changed, 7 insertions(+), 12 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 11d1d8b0d48..ad3e59a7f6c 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -94,9 +94,6 @@ 
 #include <linux/sched/mm.h>
 
 #define EXT4_FIEMAP_EXTENT_HOLE		0x08000000
-#ifndef PAGE_SHIFT
-#define PAGE_SHIFT	12
-#endif
 
 /*
  * BUG_ON / BUG - stubs (not using linux/bug.h which panics)
@@ -359,15 +356,6 @@  struct disk_partition *ext4l_get_partition(void);
 /* init_utsname - use linux/utsname.h */
 #include <linux/utsname.h>
 
-/*
- * Stubs for move_extent.c
- */
-
-/* PAGE_MASK - mask for page alignment */
-#ifndef PAGE_MASK
-#define PAGE_MASK	(~(PAGE_SIZE - 1))
-#endif
-
 /*
  * Stubs for fsmap.c
  */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index df67b775b5b..9699f5274b5 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -90,6 +90,13 @@  typedef struct unused unused_t;
 #define PAGE_SIZE	4096
 #endif
 
+#ifndef PAGE_SHIFT
+#define PAGE_SHIFT	12
+#endif
+
+#ifndef PAGE_MASK
+#define PAGE_MASK	(~(PAGE_SIZE - 1))
+#endif
 
 /* include/linux/leds.h */
 struct led_trigger {};