From: Simon Glass <simon.glass@canonical.com>
Move definitions to their canonical Linux kernel locations:
- vfs_setpos(), FS_MGTIME, BLOCK_SIZE to linux/fs.h
- vmf_fs_error() to linux/mm_types.h
- down_write_nested() to linux/rwsem.h
- pde_data() to linux/proc_fs.h
- memalloc_retry_wait() to linux/sched/mm.h
- raw_cpu_ptr() to linux/percpu.h
- prefetchw() now via include of linux/prefetch.h
Also fix linux/prefetch.h to use expression form ((void)0) instead of
do-while(0) statement, as list.h uses prefetch() in comma expressions.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 27 +--------------------------
include/linux/fs.h | 10 ++++++++++
include/linux/mm_types.h | 3 +++
include/linux/percpu.h | 1 +
include/linux/prefetch.h | 4 ++--
include/linux/proc_fs.h | 1 +
include/linux/rwsem.h | 2 ++
include/linux/sched/mm.h | 3 +++
8 files changed, 23 insertions(+), 28 deletions(-)
@@ -156,13 +156,8 @@ struct path;
/* QSTR_INIT and dotdot_name are now in linux/dcache.h */
-#define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); })
-
#include <linux/minmax.h>
-/* Memory retry wait */
-#define memalloc_retry_wait(g) do { } while (0)
-
/* indirect.c stubs */
/* ext4_sb_bread_nofail is stubbed in interface.c */
@@ -206,9 +201,6 @@ struct path;
/* UID/GID bit helpers - use linux/highuid.h */
#include <linux/highuid.h>
-/* File operations */
-#define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS)
-
/*
* Additional stubs for dir.c
*/
@@ -272,12 +264,6 @@ void ext4_unregister_li_request(struct super_block *sb);
/* end_buffer_write_sync - implemented in support.c */
void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
-/* File system management time flag */
-#define FS_MGTIME 0
-
-/* Block size */
-#define BLOCK_SIZE 1024
-
#define EXT4_SUPER_MAGIC 0xEF53
/* blockgroup_lock - use linux/blockgroup_lock.h */
@@ -326,16 +312,10 @@ int sync_filesystem(void *sb);
#include <asm-generic/timex.h>
#include <linux/nospec.h>
-/* pde_data - proc dir entry data (not supported in U-Boot) */
-#define pde_data(inode) ((void *)NULL)
-
/* DEFINE_RAW_FLEX - define a flexible array struct on the stack (stubbed to NULL) */
#define DEFINE_RAW_FLEX(type, name, member, count) \
type *name = NULL
-/* raw_cpu_ptr - get pointer to per-CPU data for current CPU */
-#define raw_cpu_ptr(ptr) (ptr)
-
/*
* Stubs for page-io.c - bio types are in linux/bio.h
*/
@@ -347,8 +327,7 @@ int sync_filesystem(void *sb);
#include <linux/mempool.h>
-/* prefetch operations */
-#define prefetchw(addr) do { (void)(addr); } while (0)
+#include <linux/prefetch.h>
/*
* Stubs for fast_commit.c
@@ -396,10 +375,6 @@ struct disk_partition *ext4l_get_partition(void);
* Stubs for move_extent.c
*/
-/* down_write_nested - nested write lock acquisition */
-#define down_write_nested(sem, subclass) \
- do { (void)(sem); (void)(subclass); } while (0)
-
/* PAGE_MASK - mask for page alignment */
#ifndef PAGE_MASK
#define PAGE_MASK (~(PAGE_SIZE - 1))
@@ -412,6 +412,16 @@ static inline void inode_init_once(struct inode *inode)
#define SB_FREEZE_FS 3
#define SB_FREEZE_COMPLETE 4
+/* Filesystem management time flag */
+#define FS_MGTIME 0
+
+/* Block size constant */
+#define BLOCK_SIZE 1024
+
+/* VFS position helper */
+#define vfs_setpos(file, offset, maxsize) \
+ ({ (void)(file); (void)(maxsize); (offset); })
+
/* fallocate() flags */
#define FALLOC_FL_KEEP_SIZE 0x01
#define FALLOC_FL_PUNCH_HOLE 0x02
@@ -44,6 +44,9 @@ typedef unsigned int vm_fault_t;
#define VM_FAULT_NOPAGE 0x0010
#define VM_FAULT_LOCKED 0x0200
+/* VM fault error helper */
+#define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS)
+
/* Maximum order for page cache allocations */
#define MAX_PAGECACHE_ORDER 12
@@ -17,6 +17,7 @@
#define DEFINE_PER_CPU(type, name) type name
#define per_cpu(var, cpu) (var)
#define per_cpu_ptr(ptr, cpu) (ptr)
+#define raw_cpu_ptr(ptr) (ptr)
#define this_cpu_inc(var) ((var)++)
#define this_cpu_read(var) (var)
@@ -11,7 +11,7 @@
#ifndef _LINUX_PREFETCH_H
#define _LINUX_PREFETCH_H
-#define prefetch(x) do { } while (0)
-#define prefetchw(x) do { } while (0)
+#define prefetch(x) ((void)0)
+#define prefetchw(x) ((void)0)
#endif /* _LINUX_PREFETCH_H */
@@ -34,5 +34,6 @@ struct proc_ops {
(struct proc_dir_entry *)NULL; })
#define remove_proc_entry(n, p) \
do { (void)(n); (void)(p); } while (0)
+#define pde_data(inode) ((void *)NULL)
#endif /* _LINUX_PROC_FS_H */
@@ -22,6 +22,8 @@ struct rw_semaphore {
#define up_read(sem) do { } while (0)
#define down_write(sem) do { } while (0)
#define down_write_trylock(sem) 1
+#define down_write_nested(sem, subclass) \
+ do { (void)(sem); (void)(subclass); } while (0)
#define up_write(sem) do { } while (0)
#define downgrade_write(sem) do { } while (0)
#define rwsem_is_locked(sem) (1)
@@ -29,4 +29,7 @@ static inline void memalloc_nofs_restore(unsigned int flags)
{
}
+/* Memory allocation retry wait - stub for U-Boot */
+#define memalloc_retry_wait(g) do { } while (0)
+
#endif /* _LINUX_SCHED_MM_H */