[PATCH 00/33] Reorganise ext4l compatibility stubs
From: Simon Glass <simon.glass@canonical.com> The ext4l filesystem uses a large compatibility header (ext4_uboot.h) containing stubs for Linux kernel interfaces. This series moves these stubs to their proper locations in include/linux/, making them available to other subsystems and improving code organisation. The series: - Fixes list_sort() callback signature to match Linux kernel - Moves struct definitions and stubs to appropriate linux/ headers - Adds missing stubs to existing headers (fs.h, blkdev.h, slab.h, etc.) - Creates new stub headers where needed (iomap.h, super_types.h) - Consolidates and sorts the remaining includes This reduces ext4_uboot.h from over 550 lines to around 270 lines. At this point, the work can be considered complete. Simon Glass (33): linux/sort.h: Fix qsort implicit declaration warning list: Add const qualifiers to list_sort callback signature ext4l: Remove redundant header-location comments from ext4_uboot.h ext4l: Move file_operations and inode_operations to linux/fs.h ext4l: Move struct inode and time accessors to linux/fs.h ext4l: Move sb_ functions and SB_ macros to super_types.h ext4l: Move seq_ functions to linux/seq_file.h ext4l: Move inode state accessors to linux/fs.h ext4l: Move generic VFS operations to linux/fs.h ext4l: Move block device operations to linux/blkdev.h ext4l: Move file_ functions to linux/fs.h ext4l: Move fsnotify_sb_error() to linux/fs.h ext4l: Move DEFINE_WAIT to linux/wait.h ext4l: Move filemap_fdatawait_range_keep_errors() to pagemap.h ext4l: Move various stubs to proper linux/ headers ext4l: Consolidate DX_HASH_* into EXT4_UBOOT_NO_EXT4_H block ext4l: Have hash.c include ext4.h directly ext4l: Move inode and filesystem helpers to linux/fs.h ext4l: Move time_is_before_jiffies() to linux/jiffies.h ext4l: Remove duplicate ext4_update_overhead() declaration ext4l: Move xattr helper stubs to linux/xattr.h ext4l: Remove duplicate __ext4_xattr_set_credits() declaration ext4l: Move iomap stubs to linux/iomap.h ext4l: Move setattr stubs to linux/fs.h ext4l: Move finish_open_simple() and ihold() to linux/fs.h ext4l: Move nd_terminate_link() to linux/namei.h ext4l: Move blk_holder_ops to linux/blkdev.h ext4l: Move more stubs to standard Linux headers ext4l: Move WHITEOUT and usercopy stubs to headers ext4l: Move O_SYNC, S_NOQUOTA and kfree_link to headers linux: Add PAGE_SHIFT and PAGE_MASK to linux/compat.h linux: Add DEFINE_RAW_FLEX to linux/overflow.h ext4l: Consolidate and sort includes in ext4_uboot.h .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 9 +- fs/ext4l/ext4_uboot.h | 1476 ++--------------- fs/ext4l/hash.c | 4 +- fs/ext4l/stub.c | 5 + fs/ubifs/gc.c | 19 +- fs/ubifs/replay.c | 6 +- include/linux/blkdev.h | 42 + include/linux/compat.h | 7 + include/linux/dax.h | 23 +- include/linux/fs.h | 336 +++- include/linux/fs/super_types.h | 44 + include/linux/iomap.h | 4 + include/linux/jiffies.h | 3 + include/linux/ktime.h | 9 + include/linux/list_sort.h | 8 +- include/linux/mm_types.h | 3 + include/linux/namei.h | 11 + include/linux/overflow.h | 12 + include/linux/pagemap.h | 2 + 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 + include/linux/seq_file.h | 8 + include/linux/slab.h | 2 + include/linux/sort.h | 2 +- include/linux/wait.h | 3 + include/linux/xattr.h | 4 + lib/efi_loader/efi_memory.c | 7 +- lib/list_sort.c | 12 +- 31 files changed, 716 insertions(+), 1356 deletions(-) -- 2.43.0 base-commit: 8e85f501c225ced3880282e5e168541ed4db047f branch: extw
From: Simon Glass <simon.glass@canonical.com> Include <sort.h> instead of <stdlib.h> to get the proper qsort declaration. U-Boot's stdlib.h does not declare qsort, but sort.h does. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- include/linux/sort.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sort.h b/include/linux/sort.h index dc222d8dc89..f131be8d48c 100644 --- a/include/linux/sort.h +++ b/include/linux/sort.h @@ -6,7 +6,7 @@ #define _LINUX_SORT_H #include <linux/types.h> -#include <stdlib.h> +#include <sort.h> typedef int (*cmp_func_t)(const void *, const void *); -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Update list_sort() to use const qualifiers for the list_head parameters in the comparison callback, matching the Linux kernel interface. Changes to the API: - Add list_cmp_func_t typedef with const qualifiers - Update list_sort() declaration to use the new typedef - Update internal merge functions to use const qualifiers Update all callers: - lib/efi_loader/efi_memory.c: efi_mem_cmp() - fs/ubifs/replay.c: replay_entries_cmp() - fs/ubifs/gc.c: data_nodes_cmp() and nondata_nodes_cmp() - arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: part_cmp() Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- .../mach-stm32mp/cmd_stm32prog/stm32prog.c | 9 +++++---- fs/ubifs/gc.c | 19 ++++++++++--------- fs/ubifs/replay.c | 6 +++--- include/linux/list_sort.h | 8 +++++--- lib/efi_loader/efi_memory.c | 7 ++++--- lib/list_sort.c | 12 ++++++------ 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c index 353aecc09de..a66e003cfb4 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c @@ -708,12 +708,13 @@ static int parse_flash_layout(struct stm32prog_data *data, return 0; } -static int __init part_cmp(void *priv, struct list_head *a, struct list_head *b) +static int __init part_cmp(void *priv, const struct list_head *a, + const struct list_head *b) { - struct stm32prog_part_t *parta, *partb; + const struct stm32prog_part_t *parta, *partb; - parta = container_of(a, struct stm32prog_part_t, list); - partb = container_of(b, struct stm32prog_part_t, list); + parta = container_of(a, const struct stm32prog_part_t, list); + partb = container_of(b, const struct stm32prog_part_t, list); if (parta->part_id != partb->part_id) return parta->part_id - partb->part_id; diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 6a4ada62c82..0577d91104a 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -114,18 +114,19 @@ static int switch_gc_head(struct ubifs_info *c) * This function compares data nodes @a and @b. Returns %1 if @a has greater * inode or block number, and %-1 otherwise. */ -static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) +static int data_nodes_cmp(void *priv, const struct list_head *a, + const struct list_head *b) { ino_t inuma, inumb; struct ubifs_info *c = priv; - struct ubifs_scan_node *sa, *sb; + const struct ubifs_scan_node *sa, *sb; cond_resched(); if (a == b) return 0; - sa = list_entry(a, struct ubifs_scan_node, list); - sb = list_entry(b, struct ubifs_scan_node, list); + sa = list_entry(a, const struct ubifs_scan_node, list); + sb = list_entry(b, const struct ubifs_scan_node, list); ubifs_assert(key_type(c, &sa->key) == UBIFS_DATA_KEY); ubifs_assert(key_type(c, &sb->key) == UBIFS_DATA_KEY); @@ -157,19 +158,19 @@ static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) * first and sorted by length in descending order. Directory entry nodes go * after inode nodes and are sorted in ascending hash valuer order. */ -static int nondata_nodes_cmp(void *priv, struct list_head *a, - struct list_head *b) +static int nondata_nodes_cmp(void *priv, const struct list_head *a, + const struct list_head *b) { ino_t inuma, inumb; struct ubifs_info *c = priv; - struct ubifs_scan_node *sa, *sb; + const struct ubifs_scan_node *sa, *sb; cond_resched(); if (a == b) return 0; - sa = list_entry(a, struct ubifs_scan_node, list); - sb = list_entry(b, struct ubifs_scan_node, list); + sa = list_entry(a, const struct ubifs_scan_node, list); + sb = list_entry(b, const struct ubifs_scan_node, list); ubifs_assert(key_type(c, &sa->key) != UBIFS_DATA_KEY && key_type(c, &sb->key) != UBIFS_DATA_KEY); diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index b6e03b76d41..a323ae6d058 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c @@ -268,10 +268,10 @@ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) * entries @a and @b by comparing their sequence numer. Returns %1 if @a has * greater sequence number and %-1 otherwise. */ -static int replay_entries_cmp(void *priv, struct list_head *a, - struct list_head *b) +static int replay_entries_cmp(void *priv, const struct list_head *a, + const struct list_head *b) { - struct replay_entry *ra, *rb; + const struct replay_entry *ra, *rb; cond_resched(); if (a == b) diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h index 1a2df2efb77..dc760a60644 100644 --- a/include/linux/list_sort.h +++ b/include/linux/list_sort.h @@ -5,7 +5,9 @@ struct list_head; -void list_sort(void *priv, struct list_head *head, - int (*cmp)(void *priv, struct list_head *a, - struct list_head *b)); +typedef int (*list_cmp_func_t)(void *priv, const struct list_head *a, + const struct list_head *b); + +void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp); + #endif diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 4a56dfca37c..190937cf1ff 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -116,10 +116,11 @@ static u64 checksum(struct efi_pool_allocation *alloc) * @b: second memory area * Return: 1 if @a is before @b, -1 if @b is before @a, 0 if equal */ -static int efi_mem_cmp(void *priv, struct list_head *a, struct list_head *b) +static int efi_mem_cmp(void *priv, const struct list_head *a, + const struct list_head *b) { - struct mem_node *mema = list_entry(a, struct mem_node, link); - struct mem_node *memb = list_entry(b, struct mem_node, link); + const struct mem_node *mema = list_entry(a, struct mem_node, link); + const struct mem_node *memb = list_entry(b, struct mem_node, link); if (mema->base == memb->base) return 0; diff --git a/lib/list_sort.c b/lib/list_sort.c index cf5cac17720..5298990b3e7 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -21,8 +21,8 @@ * sentinel head node, "prev" links not maintained. */ static struct list_head *merge(void *priv, - int (*cmp)(void *priv, struct list_head *a, - struct list_head *b), + int (*cmp)(void *priv, const struct list_head *a, + const struct list_head *b), struct list_head *a, struct list_head *b) { struct list_head head, *tail = &head; @@ -50,8 +50,8 @@ static struct list_head *merge(void *priv, * throughout. */ static void merge_and_restore_back_links(void *priv, - int (*cmp)(void *priv, struct list_head *a, - struct list_head *b), + int (*cmp)(void *priv, const struct list_head *a, + const struct list_head *b), struct list_head *head, struct list_head *a, struct list_head *b) { @@ -104,8 +104,8 @@ static void merge_and_restore_back_links(void *priv, * ordering is to be preserved, @cmp must return 0. */ void list_sort(void *priv, struct list_head *head, - int (*cmp)(void *priv, struct list_head *a, - struct list_head *b)) + int (*cmp)(void *priv, const struct list_head *a, + const struct list_head *b)) { struct list_head *part[MAX_LIST_LENGTH_BITS+1]; /* sorted partial lists -- last slot is a sentinel */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Remove comment lines that simply document which header provides a definition, as these add noise without value. The definitions are already in the appropriate headers, so the comments are redundant. This removes approximately 250 standalone comments of the form "/* X is in linux/Y.h */" and consolidates related #include statements. Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 528 +----------------------------------------- 1 file changed, 9 insertions(+), 519 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 2f73325e521..5d62c49663c 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -70,16 +70,6 @@ #undef no_printk #define no_printk(fmt, ...) ({ 0; }) -/* rol32 and ror32 are now in linux/bitops.h */ -/* Time types - timespec64 and time64_t are now in linux/time.h */ - -/* - * ktime_t, sector_t are now in linux/types.h - * atomic_t, atomic64_t are now in asm-generic/atomic.h - * MAX_JIFFY_OFFSET is now in linux/jiffies.h - * BDEVNAME_SIZE is now in linux/blkdev.h - * blk_opf_t is now in linux/blk_types.h - */ #include <asm-generic/atomic.h> #include <linux/jiffies.h> #include <linux/blkdev.h> @@ -90,88 +80,27 @@ #include <linux/uuid.h> #include <linux/smp.h> #include <linux/refcount.h> - -/* atomic_dec_if_positive, atomic_add_unless, etc. are now in asm-generic/atomic.h */ -/* cmpxchg is now in asm-generic/atomic.h */ -/* SMP stubs (raw_smp_processor_id, smp_*mb) are now in linux/smp.h */ -/* refcount_t and operations are now in linux/refcount.h */ - -/* rwlock_t and read_lock/read_unlock are now in linux/spinlock.h */ #include <linux/spinlock.h> - -/* RB tree types - from <linux/rbtree.h> included above */ - -/* percpu - use Linux headers */ #include <linux/percpu_counter.h> #include <linux/percpu.h> - -/* Project ID type - use linux/projid.h */ #include <linux/projid.h> - -/* kobject is now in linux/kobject.h */ #include <linux/kobject.h> - -/* lockdep stubs - needed before jbd2.h is included */ #include <linux/lockdep.h> -/* _THIS_IP_ is in linux/kernel.h */ - -/* completion - use Linux header */ #include <linux/completion.h> - -/* Cache alignment - use linux/cache.h */ #include <linux/cache.h> - -/* ZERO_OR_NULL_PTR is in linux/slab.h */ -/* data_race is in linux/compiler.h */ - -/* REQ_META, REQ_PRIO, REQ_RAHEAD are in linux/blk_types.h */ -/* __GFP_MOVABLE, __GFP_FS are in linux/slab.h */ - -/* Capabilities - use linux/capability.h */ #include <linux/capability.h> - -/* FIEMAP types - use linux/fiemap.h */ #include <linux/fiemap.h> -#define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 - -/* FALLOC_FL_* flags are in linux/fs.h */ +#include <linux/uio.h> +#include <linux/sched/mm.h> -/* File flags */ +#define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 #define O_SYNC 0 +#define S_NOQUOTA 0 -/* Forward declarations (struct inode, struct address_space) are in linux/fs.h */ - -/* pgoff_t is in linux/types.h */ #ifndef PAGE_SHIFT #define PAGE_SHIFT 12 #endif -/* FMODE_32BITHASH, FMODE_64BITHASH are in linux/fs.h */ - -/* struct file is defined in linux/fs.h */ - -/* kiocb, iov_iter - use linux/uio.h */ -#include <linux/uio.h> - -/* __counted_by is in linux/compiler_attributes.h */ - -/* dir_context, filldir_t are in linux/fs.h */ - -/* iomap types and structs are in linux/iomap.h */ - -/* fscrypt_str, qstr are now in ext4_fscrypt.h */ - -/* percpu rw semaphore is in linux/percpu.h */ - -/* Memory allocation context - use linux/sched/mm.h */ -#include <linux/sched/mm.h> - -/* IS_CASEFOLDED is in linux/fs.h */ -/* IS_ENCRYPTED and FSCRYPT_SET_CONTEXT_MAX_SIZE are in ext4_fscrypt.h */ -#define S_NOQUOTA 0 - -/* user_namespace and init_user_ns are in linux/cred.h */ - /* * BUG_ON / BUG - stubs (not using linux/bug.h which panics) * In Linux, these indicate kernel bugs. In ext4l, some BUG_ON conditions @@ -183,57 +112,15 @@ #define BUG_ON(cond) do { (void)(cond); } while (0) #define BUG() do { } while (0) -/* might_sleep is in linux/kernel.h */ - -/* sb_rdonly is in linux/super.h */ - -/* Trace stubs are now in ext4_trace.h */ - -/* Buffer operations are in linux/buffer_head.h */ -/* wait_on_bit_io is now in linux/wait_bit.h */ - -/* inode_needs_sync is in linux/fs.h */ - -/* Memory barriers are now in linux/smp.h */ - -/* - * set_bit/clear_bit are declared extern in asm/bitops.h but not implemented. - * We implement them in interface.c for sandbox. - */ - -/* Little-endian bit operations - use asm-generic/bitops/le.h */ #include <asm-generic/bitops/le.h> - -/* KUNIT stub - use kunit/static_stub.h */ #include <kunit/static_stub.h> - -/* percpu_counter operations are in linux/percpu_counter.h */ - -/* in_group_p is in linux/cred.h */ - -/* Quota operations - use linux/quotaops.h */ #include <linux/quotaops.h> - -/* icount_read is in linux/fs.h */ -/* d_inode is now in linux/dcache.h */ - -/* Random number functions - use linux/random.h */ #include <linux/random.h> -/* Buffer cache operations - sb_find_get_block, sync_dirty_buffer are in linux/buffer_head.h */ - -/* Time functions - ktime_get_real_seconds, time_before32 are in linux/time.h */ - /* Inode operations - iget_locked and new_inode are in interface.c */ extern struct inode *new_inode(struct super_block *sb); -/* i_uid_write, i_gid_write, inode_fsuid_set, inode_init_owner are in linux/fs.h */ -/* insert_inode_locked, unlock_new_inode, clear_nlink are in linux/fs.h */ -/* IS_DIRSYNC is in linux/fs.h */ - -/* fscrypt_prepare_new_inode, fscrypt_set_context are in ext4_fscrypt.h */ -/* ext4_init_acl is provided by acl.h */ -/* xattr stubs for files that don't include xattr.h */ +/* Forward declarations for xattr functions */ struct super_block; struct buffer_head; struct qstr; @@ -243,59 +130,17 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, struct buffer_head *block_bh, size_t value_len, bool is_create); #endif -/* ext4_init_security is provided by xattr.h */ - -/* is_bad_inode is in linux/fs.h */ /* Block device operations - stubs */ #define sb_issue_zeroout(sb, blk, num, gfp) ({ (void)(sb); (void)(blk); (void)(num); (void)(gfp); 0; }) #define blkdev_issue_flush(bdev) ({ (void)(bdev); 0; }) -/* inode_is_locked, i_size_write, i_size_read are in linux/fs.h */ - -/* spin_trylock is defined in linux/spinlock.h */ - -/* atomic_add_unless is now in asm-generic/atomic.h */ - -/* bgl_lock_ptr is now in linux/blockgroup_lock.h */ - -/* RCU stubs - use linux/rcupdate.h */ #include <linux/rcupdate.h> - -/* RCU head for callbacks - defined in linux/compat.h as callback_head */ - -/* lockdep_is_held is in linux/lockdep.h */ - -/* Memory allocation - use linux/slab.h which is already available */ #include <linux/slab.h> -/* KMEM_CACHE macro is in linux/slab.h */ - -/* - * RB tree operations - use real rbtree implementation from lib/rbtree.c - * and include/linux/rbtree.h. rb_entry, rb_first, rb_next, rb_prev, - * rb_insert_color, rb_erase, rb_link_node, RB_EMPTY_ROOT, and - * rbtree_postorder_for_each_entry_safe are all provided by the real - * implementation - do not stub them! - */ - -/* inode/dentry operations */ void iput(struct inode *inode); -/* current task - from linux/sched.h */ #include <linux/sched.h> - -/* _RET_IP_ is in linux/kernel.h */ - -/* SB_FREEZE_* constants are in linux/fs.h */ - -/* sb_writers is in linux/super.h */ - -/* mapping_large_folio_support is in linux/pagemap.h */ - -/* sector_t is now in linux/types.h */ - -/* Buffer head - from linux/buffer_head.h */ #include <linux/buffer_head.h> #include <linux/jbd2.h> @@ -315,29 +160,14 @@ BUFFER_FNS(OwnsData, ownsdata) #define BH_Cached (BH_JBDPrivateStart + 2) BUFFER_FNS(Cached, cached) -/* get_block_t is in linux/fs.h */ - -/* crc32c - from linux/crc32c.h */ #include <linux/crc32c.h> - -/* ratelimit_state - use linux/ratelimit.h */ #include <linux/ratelimit.h> - -/* fscrypt_dummy_policy and qstr are now in ext4_fscrypt.h */ - -/* errseq_t is defined in linux/fs.h */ -/* time64_t is now in linux/time.h */ - -/* IS_NOQUOTA is in linux/fs.h */ -/* dentry, name_snapshot are now in linux/dcache.h */ - -/* VM types - use linux/mm_types.h */ #include <linux/mm_types.h> +#include <linux/mnt_idmapping.h> +#include <linux/rwsem.h> -/* pipe_inode_info - forward declaration */ +/* Forward declarations */ struct pipe_inode_info; - -/* Forward declarations for function prototypes (vm_fault is in linux/mm_types.h) */ struct kstat; struct path; struct file_kattr; @@ -346,67 +176,20 @@ struct readahead_control; struct fiemap_extent_info; struct folio; -/* qsize_t is in linux/quotaops.h */ - -/* blk_opf_t is in linux/blk_types.h */ - -/* bh_end_io_t and struct buffer_head are in linux/buffer_head.h */ - -/* DT_* directory entry types are in linux/fs.h */ - -/* mnt_idmap - use linux/mnt_idmapping.h */ -#include <linux/mnt_idmapping.h> - -/* fstrim_range is in linux/fs.h */ - -/* rw_semaphore - defined in linux/rwsem.h, include it */ -#include <linux/rwsem.h> - -/* block_device is defined in linux/fs.h */ - -/* SB_RDONLY, SB_I_VERSION, etc. superblock flags are in linux/fs.h */ - -/* uuid_t is now in linux/uuid.h */ - -/* super_block is now in linux/super.h */ - -/* Block device read-only check */ static inline int bdev_read_only(struct block_device *bdev) { return bdev ? bdev->read_only : 0; } -/* kuid_t and kgid_t - from linux/cred.h */ #include <linux/cred.h> -/* Inode state bits (I_NEW, I_FREEING, etc.) are in linux/fs.h */ -/* S_SYNC, S_NOATIME, etc. inode flags are in linux/fs.h */ -/* S_IRWXUGO is in linux/fs.h */ - -/* Whiteout mode for overlayfs */ #define WHITEOUT_DEV 0 #define WHITEOUT_MODE 0 -/* RENAME_* flags are in linux/fs.h */ -/* I_DIRTY_TIME is in linux/fs.h */ - -/* SB_LAZYTIME is in linux/fs.h */ -/* ATTR_* iattr valid flags are in linux/fs.h */ -/* STATX_* flags and struct kstat are in linux/stat.h */ -/* VM fault return values are in linux/mm_types.h */ -/* struct path is defined in linux/fs.h */ -/* VM structs (vm_area_struct, page, vm_fault, vm_operations_struct) are in linux/mm_types.h */ - -/* Forward declaration for swap */ struct swap_info_struct; - -/* PF_MEMALLOC is in linux/sched.h */ - -/* Forward declarations for inode operations */ struct inode_operations; struct file_operations; -/* inode - extended for inode.c */ struct inode { struct super_block *i_sb; unsigned long i_ino; @@ -573,12 +356,6 @@ struct dx_hash_info { #define EXT4_HTREE_EOF_32BIT ((1UL << (32 - 1)) - 1) #define EXT4_HTREE_EOF_64BIT ((1ULL << (64 - 1)) - 1) -/* jbd2_buffer_trigger_type is defined in jbd2.h */ -/* struct seq_file is in linux/seq_file.h */ - -/* fscrypt_has_encryption_key, fscrypt_fname_siphash are in ext4_fscrypt.h */ - -/* ext4 warning macros - stubs (only when ext4.h is not included) */ #ifdef EXT4_UBOOT_NO_EXT4_H #define ext4_warning(sb, fmt, ...) \ do { } while (0) @@ -587,31 +364,6 @@ struct dx_hash_info { do { } while (0) #endif -/* fallthrough is in linux/compiler_attributes.h */ - -/* BUILD_BUG_ON is in linux/build_bug.h */ -/* WARN_ON, WARN_ON_ONCE, WARN_ONCE are in linux/bug.h */ -/* pr_warn_once is in linux/printk.h */ - -/* lockdep_assert_held_read is in linux/lockdep.h */ -/* strtomem_pad is in linux/string.h */ -/* strscpy_pad is in linux/string.h */ - -/* memweight is in linux/string.h */ - -/* BITS_PER_BYTE is in linux/bitops.h */ - -/* extents.c stubs */ - -/* rwsem_is_locked is in linux/rwsem.h */ - -/* Buffer operations - sb_getblk_gfp, bh_uptodate_or_lock are in linux/buffer_head.h */ -/* ext4_read_bh is stubbed in interface.c */ - -/* Inode locking stubs are in linux/fs.h */ -/* Lock debugging stubs are in linux/lockdep.h */ - -/* File operations */ #define file_modified(file) ({ (void)(file); 0; }) #define file_accessed(file) do { (void)(file); } while (0) @@ -623,27 +375,13 @@ struct dx_hash_info { #define generic_atomic_write_valid(iocb, from) ({ (void)(iocb); (void)(from); 0; }) #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) -/* IS_NOSEC is in linux/fs.h */ - -/* Filemap operations and fault handlers are in linux/pagemap.h */ - -/* DAX device mapping check - always false in U-Boot */ #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) -/* Inode time/size operations - inode_newsize_ok, i_blocksize, IS_SYNC are in linux/fs.h */ -/* inode_set_ctime_current, inode_set_mtime_to_ts are in linux/fs.h */ - -/* Case-folding stubs - not supported in U-Boot */ #define sb_no_casefold_compat_fallback(sb) ({ (void)(sb); 1; }) #define generic_ci_validate_strict_name(d, n) ({ (void)(d); (void)(n); 1; }) -/* in_range - use linux/minmax.h */ #include <linux/minmax.h> -/* dquot_reclaim_block is in linux/quotaops.h */ - -/* fiemap stubs are now in linux/fiemap.h */ - /* Memory retry wait */ #define memalloc_retry_wait(g) do { } while (0) @@ -652,10 +390,6 @@ struct dx_hash_info { /* indirect.c stubs */ -/* umin is in linux/minmax.h */ - -/* truncate_inode_pages is in linux/pagemap.h */ - /* ext4_sb_bread_nofail is stubbed in interface.c */ /* extents_status.c stubs */ @@ -669,14 +403,6 @@ struct dx_hash_info { /* hrtimer - use linux/hrtimer.h */ #include <linux/hrtimer.h> -/* write_trylock is in linux/spinlock.h */ - -/* percpu_counter_init/destroy are in linux/percpu_counter.h */ - -/* ratelimit macros are now in linux/ratelimit.h */ - -/* SEQ_START_TOKEN is in linux/seq_file.h */ - /* folio and pagemap - use linux/pagemap.h */ #include <linux/pagemap.h> #include <linux/xarray.h> @@ -684,13 +410,6 @@ struct dx_hash_info { /* wbc_to_tag, WB_REASON_* - use linux/writeback.h */ #include <linux/writeback.h> -/* blk_plug is now in linux/blkdev.h */ - -/* address_space_operations is in linux/fs.h */ -/* buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio are in linux/buffer_head.h */ -/* readahead_control, FGP_*, kmap/kunmap, folio stubs are in linux/pagemap.h */ -/* __filemap_get_folio, folio_put, folio_get, mapping_clear_folio_cache are in linux/pagemap.h */ - /* projid_t is now in linux/projid.h */ /* @@ -730,32 +449,8 @@ struct dx_hash_info { /* d_path, path_put - use linux/path.h */ #include <linux/path.h> -/* fscrypt_file_open is in ext4_fscrypt.h */ -/* fsverity_file_open is in linux/fsverity.h */ #include <linux/fsverity.h> -/* dquot_file_open is in linux/quotaops.h */ - -/* inode_io_list_del is in linux/writeback.h */ -/* inode_is_open_for_write, inode_is_dirtytime_only are in linux/fs.h */ - -/* Folio operations and writeback stubs are in linux/pagemap.h */ -/* folio_batch_release is in linux/pagevec.h */ - -/* Quota stubs are in linux/quotaops.h */ - -/* percpu_counter_sub is in linux/percpu_counter.h */ - -/* Filemap operations are in linux/pagemap.h */ -/* try_to_writeback_inodes_sb is in linux/writeback.h */ - -/* Buffer/block folio operations are in linux/buffer_head.h */ -/* write_begin_get_folio is in linux/pagemap.h */ - -/* fscrypt_name, fscrypt_match_name, and fscrypt stubs are in ext4_fscrypt.h */ - -/* fsverity stubs are in linux/fsverity.h */ - /* Inode time setters - needed for ext4.h */ static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode, struct timespec64 ts) @@ -773,7 +468,6 @@ static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, /* Inode version operations - use linux/iversion.h */ #include <linux/iversion.h> -/* inode_set_flags is in linux/fs.h */ /* Inode credential helpers - i_uid_read, i_gid_read need struct inode */ static inline unsigned int i_uid_read(const struct inode *inode) @@ -786,8 +480,6 @@ static inline unsigned int i_gid_read(const struct inode *inode) return inode->i_gid.val; } -/* i_uid_needs_update, i_gid_needs_update, i_uid_update, i_gid_update are in linux/fs.h */ - /* Device encoding helpers are now in linux/kdev_t.h */ #include <linux/kdev_t.h> @@ -796,9 +488,6 @@ static inline unsigned int i_gid_read(const struct inode *inode) /* Inode allocation/state operations */ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); -/* set_nlink, inc_nlink, drop_nlink are in linux/fs.h */ -/* inode_set_cached_link, init_special_inode, make_bad_inode are in linux/fs.h */ -/* iget_failed, find_inode_by_ino_rcu, mark_inode_dirty are in linux/fs.h */ /* Attribute operations */ #define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) @@ -807,8 +496,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define generic_fillattr(m, req, i, s) do { } while (0) #define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) -/* IS_APPEND, IS_IMMUTABLE are in linux/fs.h */ - /* File operations */ #define file_update_time(f) do { } while (0) #define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) @@ -820,8 +507,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); /* Block device alignment */ #define bdev_dma_alignment(bd) (0) -/* Truncation stubs are in linux/pagemap.h */ - /* * Additional stubs for dir.c */ @@ -829,14 +514,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); /* FSTR_INIT - fscrypt_str initializer (fscrypt_str defined in ext4_fscrypt.h) */ #define FSTR_INIT(n, l) { .name = (n), .len = (l) } -/* fscrypt directory operations are in ext4_fscrypt.h */ - -/* Readahead operations are in linux/pagemap.h */ - -/* Inode version operations are in linux/iversion.h */ - -/* dir_emit, dir_relax_shared are in linux/fs.h */ - /* File llseek */ #define generic_file_llseek_size(f, o, w, m, e) ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) @@ -916,19 +593,10 @@ static inline const char *simple_get_link(struct dentry *dentry, return inode->i_link; } -/* fscrypt symlink stubs are in ext4_fscrypt.h */ - /* * Additional stubs for super.c */ -/* QFMT_VFS_* quota format constants are in linux/quotaops.h */ - -/* end_buffer_read_sync is in linux/buffer_head.h */ - -/* REQ_OP_READ is in linux/blk_types.h */ -/* SB_ACTIVE is in linux/fs.h */ - /* Part stat - not used in U-Boot. Note: sectors[X] is passed as second arg */ #define STAT_WRITE 0 #define STAT_READ 0 @@ -936,8 +604,6 @@ static u64 __attribute__((unused)) __ext4_sectors[2]; #define sectors __ext4_sectors #define part_stat_read(p, f) ({ (void)(p); (void)(f); 0ULL; }) -/* system_state, SYSTEM_HALT, etc. are in linux/kernel.h */ - /* * Hex dump - DUMP_PREFIX_* types are in hexdump.h. * However, the Linux kernel print_hex_dump has a different signature @@ -947,25 +613,12 @@ static u64 __attribute__((unused)) __ext4_sectors[2]; #undef print_hex_dump #define print_hex_dump(l, p, pt, rg, gc, b, len, a) do { } while (0) -/* SLAB_RECLAIM_ACCOUNT, SLAB_ACCOUNT are in linux/slab.h */ - /* Forward declarations for super_operations and export_operations */ struct kstatfs; struct fid; -/* super_operations is in linux/fs/super_types.h */ - -/* export_operations and fid - use linux/exportfs.h */ #include <linux/exportfs.h> - -/* uuid_to_fsid is in linux/statfs.h */ - -/* kstatfs - use linux/statfs.h */ #include <linux/statfs.h> - -/* struct seq_file is in linux/seq_file.h */ - -/* Module stubs and register_filesystem are in linux/module.h */ #include <linux/module.h> /* EXT4_GOING flags */ @@ -978,29 +631,17 @@ int ext4_fill_super(struct super_block *sb, struct fs_context *fc); int ext4_commit_super(struct super_block *sb); void ext4_unregister_li_request(struct super_block *sb); -/* prandom - get_random_u32, prandom_u32_max are in linux/random.h */ - -/* ctype */ #include <linux/ctype.h> -/* crc16 - use U-Boot's implementation */ #include <linux/crc16.h> - -/* Timer and timing stubs are in linux/jiffies.h */ - -/* Path lookup flags - use linux/namei.h */ #include <linux/namei.h> /* I/O priority classes - use linux/ioprio.h */ #include <linux/ioprio.h> -/* SB_INLINECRYPT, SB_SILENT, SB_POSIXACL are in linux/fs.h */ #define SB_I_CGROUPWB 0 /* Not supported in U-Boot */ #define SB_I_ALLOW_HSM 0 /* Not supported in U-Boot */ -/* BLK_OPEN_* flags are in linux/blkdev.h */ -/* REQ_OP_*, REQ_SYNC, REQ_FUA are in linux/blk_types.h */ - /* blk_holder_ops for block device */ struct blk_holder_ops { void (*mark_dead)(struct block_device *, bool); @@ -1016,17 +657,11 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* Block size */ #define BLOCK_SIZE 1024 -/* NSEC_PER_SEC is in linux/time.h */ - -/* EXT4 magic number */ #define EXT4_SUPER_MAGIC 0xEF53 -/* MAX_LFS_FILESIZE is in linux/fs.h */ - /* blockgroup_lock - use linux/blockgroup_lock.h */ #include <linux/blockgroup_lock.h> -/* submit_bh is in linux/buffer_head.h */ /* Buffer submission stubs - declarations for stub.c implementations */ struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, unsigned int size, gfp_t gfp); @@ -1044,8 +679,6 @@ void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); char *file_path(struct file *file, char *buf, int buflen); struct block_device *file_bdev(struct file *file); -/* percpu_init_rwsem/percpu_free_rwsem are in linux/percpu.h */ - /* Block device sync - declarations for stub.c */ int sync_blockdev(struct block_device *bdev); void invalidate_bdev(struct block_device *bdev); @@ -1056,40 +689,14 @@ void invalidate_bdev(struct block_device *bdev); /* DAX - declaration for stub.c */ void fs_put_dax(void *dax, void *holder); -/* fscrypt declarations are in ext4_fscrypt.h */ - -/* alloc_inode_sb, inode_generic_drop are in linux/fs.h */ -/* inode_set_iversion is in linux/iversion.h */ - -/* rwlock_init is a macro in linux/spinlock.h */ - /* slab usercopy - use regular kmem_cache_create */ #define kmem_cache_create_usercopy(n, sz, al, fl, uo, us, c) \ kmem_cache_create(n, sz, al, fl, c) -/* invalidate_inode_buffers, clear_inode are in linux/fs.h */ -/* fsverity_cleanup_inode is in linux/fsverity.h */ - -/* NFS export helpers are now in linux/exportfs.h */ - -/* Path operations - path_put, d_path are in linux/path.h */ - -/* I/O priority stubs are in linux/ioprio.h */ - -/* kmemdup_nul is in linux/slab.h */ -/* fscrypt declarations are in ext4_fscrypt.h */ - /* Memory allocation - declarations for stub.c */ void *kvzalloc(size_t size, gfp_t flags); #define kvmalloc(size, flags) kvzalloc(size, flags) -/* Time operations - ktime_get_ns is in linux/ktime.h */ -/* nsecs_to_jiffies is in linux/jiffies.h */ - -/* sb_start_write, sb_end_write are in linux/fs/super_types.h */ - -/* schedule_timeout_interruptible is in linux/sched.h */ - /* Page allocation - declarations for stub.c */ unsigned long get_zeroed_page(gfp_t gfp); void free_page(unsigned long addr); @@ -1098,8 +705,6 @@ void free_page(unsigned long addr); void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); -/* Block device atomic write stubs are in linux/blkdev.h */ - /* Superblock blocksize - declaration for stub.c */ int sb_set_blocksize(struct super_block *sb, int size); @@ -1114,10 +719,6 @@ int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); u64 sb_bdev_nr_blocks(struct super_block *sb); unsigned int bdev_max_discard_sectors(struct block_device *bdev); -/* bgl_lock_init is now in linux/blockgroup_lock.h */ - -/* set_task_ioprio is in linux/ioprio.h */ - /* Superblock identity functions */ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, unsigned len) @@ -1136,16 +737,6 @@ static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, #define xattr_handler_can_list(h, d) ({ (void)(h); (void)(d); 0; }) #define xattr_prefix(h) ({ (void)(h); (const char *)NULL; }) -/* I_MUTEX_* constants and inode locking stubs are in linux/fs.h */ - -/* PF_MEMALLOC_NOFS is in linux/sched.h */ - -/* generic_set_sb_d_ops, d_make_root are now in linux/dcache.h */ - -/* strreplace is in linux/string.h */ - -/* ratelimit_state_init is now in linux/ratelimit.h */ - /* Block device operations - declarations for stub.c */ void bdev_fput(void *file); void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, @@ -1154,48 +745,20 @@ void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, /* Filesystem sync - declaration for stub.c */ int sync_filesystem(void *sb); -/* Quota operations are in linux/quotaops.h */ - /* Block device file operations - stubs */ #define set_blocksize(f, size) ({ (void)(f); (void)(size); 0; }) struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned size); -/* flush_workqueue is now in linux/workqueue.h */ - -/* Quota stubs for super.c are in linux/quotaops.h */ - /* * Stubs for mballoc.c */ -/* XArray is now in linux/xarray.h */ -/* Per-CPU stubs are in linux/percpu.h */ - -/* Little-endian bit operations are in asm-generic/bitops/le.h */ - -/* atomic64 operations are now in asm-generic/atomic.h */ - -/* get_cycles is in asm-generic/timex.h */ #include <asm-generic/timex.h> - -/* folio_address is in linux/pagemap.h */ - -/* sb_end_intwrite defined earlier */ - -/* WARN_RATELIMIT is in linux/ratelimit.h */ - -/* folio_get - now implemented in support.c */ - -/* array_index_nospec is in linux/nospec.h */ #include <linux/nospec.h> -/* atomic_inc_return and atomic_add_return are now in asm-generic/atomic.h */ - /* pde_data - proc dir entry data (not supported in U-Boot) */ #define pde_data(inode) ((void *)NULL) -/* struct seq_operations is in linux/seq_file.h */ - /* 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 @@ -1203,8 +766,6 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* Block layer constants */ #define BLK_MAX_SEGMENT_SIZE 65536 -/* num_possible_cpus, alloc_percpu, free_percpu are in linux/percpu.h */ - /* Block device properties */ #define bdev_nonrot(bdev) ({ (void)(bdev); 0; }) @@ -1212,16 +773,9 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned #define sb_issue_discard(sb, sector, nr_sects, gfp, flags) \ ({ (void)(sb); (void)(sector); (void)(nr_sects); (void)(gfp); (void)(flags); 0; }) -/* atomic_sub, atomic64_sub, atomic_dec_and_test are in asm-generic/atomic.h */ - -/* RCU list operations are in linux/rcupdate.h */ - /* raw_cpu_ptr - get pointer to per-CPU data for current CPU */ #define raw_cpu_ptr(ptr) (ptr) -/* schedule_timeout_uninterruptible, need_resched are in linux/sched.h */ - -/* sb_find_get_block_nonatomic, __find_get_block_nonatomic are in linux/buffer_head.h */ #define bdev_discard_granularity(bdev) \ ({ (void)(bdev); 0U; }) @@ -1230,40 +784,15 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned */ #include <linux/bio.h> -/* refcount operations are now in linux/refcount.h */ - -/* xchg is now in asm-generic/atomic.h */ - -/* printk_ratelimited is in linux/printk.h */ - -/* atomic_inc is in asm-generic/atomic.h */ -/* GFP_NOIO is in linux/slab.h */ - -/* fscrypt page-io stubs are in ext4_fscrypt.h */ - -/* folio writeback operations are in linux/pagemap.h */ -/* writeback control stubs are in linux/pagemap.h */ -/* bio_add_folio is in linux/bio.h */ - /* * Stubs for readpage.c */ -/* mempool is now in linux/mempool.h */ #include <linux/mempool.h> -/* folio read operations are in linux/pagemap.h */ -/* fscrypt readpage stubs are in ext4_fscrypt.h */ - -/* fsverity stubs are in linux/fsverity.h */ - -/* readahead operations are in linux/pagemap.h */ - /* prefetch operations */ #define prefetchw(addr) do { (void)(addr); } while (0) -/* block_read_full_folio is in linux/buffer_head.h */ - /* * Stubs for fast_commit.c */ @@ -1271,30 +800,13 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* Wait bit operations - use linux/wait_bit.h */ #include <linux/wait_bit.h> -/* Dentry name snapshot operations are now in linux/dcache.h */ - -/* lockdep_assert_not_held is in linux/lockdep.h */ -/* REQ_IDLE, REQ_PREFLUSH are in linux/blk_types.h */ -/* wake_up_bit is now in linux/wait_bit.h */ - -/* d_alloc, d_drop are now in linux/dcache.h */ - -/* get_current_ioprio is in linux/ioprio.h */ - -/* JBD2 checkpoint.c stubs */ -/* mutex_lock_io is in linux/mutex.h */ -/* write_dirty_buffer is in linux/buffer_head.h */ -/* spin_needbreak is in linux/spinlock.h */ - -/* JBD2 commit.c stubs (folio_trylock is in linux/pagemap.h) */ -/* clear_bit_unlock is in asm-generic/bitops/lock.h */ +/* JBD2 checkpoint.c and commit.c stubs */ #include <asm-generic/bitops/lock.h> /* smp_mb__after_atomic is now in linux/smp.h */ #define ktime_get_coarse_real_ts64(ts) do { (ts)->tv_sec = 0; (ts)->tv_nsec = 0; } while (0) #define filemap_fdatawait_range_keep_errors(m, s, e) \ ({ (void)(m); (void)(s); (void)(e); 0; }) #define crc32_be(crc, p, len) crc32(crc, p, len) -/* free_buffer_head is in linux/buffer_head.h */ /* ext4l support functions (support.c) */ void ext4l_crc32c_init(void); @@ -1317,10 +829,7 @@ struct disk_partition *ext4l_get_partition(void); /* DEFINE_WAIT stub - creates a wait queue entry */ #define DEFINE_WAIT(name) int name = 0 -/* cond_resched_lock is in linux/sched.h */ - /* JBD2 journal.c stubs */ -/* alloc_buffer_head, __getblk are in linux/buffer_head.h */ int bmap(struct inode *inode, sector_t *block); /* seq_file operations for /proc - stubs */ @@ -1334,30 +843,19 @@ int bmap(struct inode *inode, sector_t *block); ssize_t seq_read(struct file *f, char *b, size_t s, loff_t *p); loff_t seq_lseek(struct file *f, loff_t o, int w); -/* S_IRUGO is in linux/fs.h */ - -/* procfs stubs are now in linux/proc_fs.h */ - -/* lockdep_init_map and lock_class_key are in linux/lockdep.h */ - /* Block device operations for journal.c */ -/* bh_read, bh_read_nowait, bh_readahead_batch are in linux/buffer_head.h */ #define truncate_inode_pages_range(m, s, e) \ do { (void)(m); (void)(s); (void)(e); } while (0) #define blkdev_issue_discard(bdev, s, n, gfp) \ ({ (void)(bdev); (void)(s); (void)(n); (void)(gfp); 0; }) #define blkdev_issue_zeroout(bdev, s, n, gfp, f) \ ({ (void)(bdev); (void)(s); (void)(n); (void)(gfp); (void)(f); 0; }) -/* SECTOR_SHIFT, SECTOR_SIZE are in linux/blk_types.h */ -/* mapping_max_folio_order is in linux/pagemap.h */ /* Memory allocation for journal.c */ #define __get_free_pages(gfp, order) ((unsigned long)memalign(PAGE_SIZE, PAGE_SIZE << (order))) #define free_pages(addr, order) free((void *)(addr)) #define get_order(size) ilog2(roundup_pow_of_two((size) / PAGE_SIZE)) -/* pr_notice_ratelimited is in linux/printk.h */ - /* * Stubs for mmp.c */ @@ -1373,23 +871,15 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); #define down_write_nested(sem, subclass) \ do { (void)(sem); (void)(subclass); } while (0) -/* filemap_release_folio is in linux/pagemap.h */ - -/* IS_SWAPFILE is in linux/fs.h */ - /* PAGE_MASK - mask for page alignment */ #ifndef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE - 1)) #endif -/* lock_two_nondirectories, unlock_two_nondirectories are in linux/fs.h */ - /* * Stubs for resize.c */ -/* test_and_set_bit_lock is in asm-generic/bitops/lock.h */ - /* time_is_before_jiffies - check if time is before current jiffies */ #define time_is_before_jiffies(a) ({ (void)(a); 0; }) -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the file_operations and inode_operations structure definitions from ext4_uboot.h to include/linux/fs.h where they belong according to Linux kernel conventions. Add necessary forward declarations for types used by these structures (delayed_call, fiemap_extent_info, file_kattr, posix_acl, mnt_idmap, kstat). Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 48 --------------------------------- include/linux/fs.h | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 48 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5d62c49663c..fb5c7cc8872 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -524,18 +524,6 @@ ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, /* struct_size - use linux/overflow.h */ #include <linux/overflow.h> -/* file_operations - extended for dir.c */ -struct file_operations { - int (*open)(struct inode *, struct file *); - loff_t (*llseek)(struct file *, loff_t, int); - ssize_t (*read)(struct file *, char *, size_t, loff_t *); - int (*iterate_shared)(struct file *, struct dir_context *); - long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); - int (*fsync)(struct file *, loff_t, loff_t, int); - int (*release)(struct inode *, struct file *); -}; - -/* delayed_call - use linux/delayed_call.h */ #include <linux/delayed_call.h> #define kfree_link kfree @@ -546,42 +534,6 @@ static inline void nd_terminate_link(void *name, loff_t len, int maxlen) ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; } -/* inode_operations - for file and directory operations */ -struct inode_operations { - /* Symlink operations */ - const char *(*get_link)(struct dentry *, struct inode *, - struct delayed_call *); - /* Common operations */ - int (*getattr)(struct mnt_idmap *, const struct path *, - struct kstat *, u32, unsigned int); - ssize_t (*listxattr)(struct dentry *, char *, size_t); - int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64, u64); - int (*setattr)(struct mnt_idmap *, struct dentry *, struct iattr *); - struct posix_acl *(*get_inode_acl)(struct inode *, int, bool); - int (*set_acl)(struct mnt_idmap *, struct dentry *, - struct posix_acl *, int); - int (*fileattr_get)(struct dentry *, struct file_kattr *); - int (*fileattr_set)(struct mnt_idmap *, struct dentry *, - struct file_kattr *); - /* Directory operations */ - struct dentry *(*lookup)(struct inode *, struct dentry *, unsigned int); - int (*create)(struct mnt_idmap *, struct inode *, struct dentry *, - umode_t, bool); - int (*link)(struct dentry *, struct inode *, struct dentry *); - int (*unlink)(struct inode *, struct dentry *); - int (*symlink)(struct mnt_idmap *, struct inode *, struct dentry *, - const char *); - struct dentry *(*mkdir)(struct mnt_idmap *, struct inode *, - struct dentry *, umode_t); - int (*rmdir)(struct inode *, struct dentry *); - int (*mknod)(struct mnt_idmap *, struct inode *, struct dentry *, - umode_t, dev_t); - int (*rename)(struct mnt_idmap *, struct inode *, struct dentry *, - struct inode *, struct dentry *, unsigned int); - int (*tmpfile)(struct mnt_idmap *, struct inode *, struct file *, - umode_t); -}; - /* file open helper */ #define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) diff --git a/include/linux/fs.h b/include/linux/fs.h index aac88e7c68c..3f82a027931 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -402,4 +402,67 @@ struct fstrim_range { u64 minlen; }; +/* Forward declarations for file/inode operations */ +struct delayed_call; +struct fiemap_extent_info; +struct file_kattr; +struct posix_acl; +struct mnt_idmap; +struct kstat; + +/** + * struct file_operations - filesystem file operations + * + * Methods for file I/O and directory iteration. + */ +struct file_operations { + int (*open)(struct inode *, struct file *); + loff_t (*llseek)(struct file *, loff_t, int); + ssize_t (*read)(struct file *, char *, size_t, loff_t *); + int (*iterate_shared)(struct file *, struct dir_context *); + long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); + int (*fsync)(struct file *, loff_t, loff_t, int); + int (*release)(struct inode *, struct file *); +}; + +/** + * struct inode_operations - filesystem inode operations + * + * Methods for inode manipulation, including symlinks and directories. + */ +struct inode_operations { + /* Symlink operations */ + const char *(*get_link)(struct dentry *, struct inode *, + struct delayed_call *); + /* Common operations */ + int (*getattr)(struct mnt_idmap *, const struct path *, + struct kstat *, u32, unsigned int); + ssize_t (*listxattr)(struct dentry *, char *, size_t); + int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64, u64); + int (*setattr)(struct mnt_idmap *, struct dentry *, struct iattr *); + struct posix_acl *(*get_inode_acl)(struct inode *, int, bool); + int (*set_acl)(struct mnt_idmap *, struct dentry *, + struct posix_acl *, int); + int (*fileattr_get)(struct dentry *, struct file_kattr *); + int (*fileattr_set)(struct mnt_idmap *, struct dentry *, + struct file_kattr *); + /* Directory operations */ + struct dentry *(*lookup)(struct inode *, struct dentry *, unsigned int); + int (*create)(struct mnt_idmap *, struct inode *, struct dentry *, + umode_t, bool); + int (*link)(struct dentry *, struct inode *, struct dentry *); + int (*unlink)(struct inode *, struct dentry *); + int (*symlink)(struct mnt_idmap *, struct inode *, struct dentry *, + const char *); + struct dentry *(*mkdir)(struct mnt_idmap *, struct inode *, + struct dentry *, umode_t); + int (*rmdir)(struct inode *, struct dentry *); + int (*mknod)(struct mnt_idmap *, struct inode *, struct dentry *, + umode_t, dev_t); + int (*rename)(struct mnt_idmap *, struct inode *, struct dentry *, + struct inode *, struct dentry *, unsigned int); + int (*tmpfile)(struct mnt_idmap *, struct inode *, struct file *, + umode_t); +}; + #endif /* _LINUX_FS_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the inode structure definition and its time accessor functions from ext4_uboot.h to include/linux/fs.h where they belong according to Linux kernel conventions. This includes: - struct inode definition - inode_get_atime(), inode_get_mtime(), inode_get_ctime() - inode_get_atime_sec(), inode_get_mtime_sec(), inode_get_ctime_sec() - inode_set_atime(), inode_set_mtime(), inode_set_ctime() - inode_set_atime_to_ts(), inode_set_ctime_to_ts() - simple_inode_init_ts() - i_uid_read(), i_gid_read() Add necessary includes to linux/fs.h for inode dependencies (cred.h, rwsem.h, time.h, atomic.h). Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 126 ----------------------------------------- include/linux/fs.h | 129 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 128 insertions(+), 127 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index fb5c7cc8872..6f4ebd7e68b 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -181,105 +181,9 @@ static inline int bdev_read_only(struct block_device *bdev) return bdev ? bdev->read_only : 0; } -#include <linux/cred.h> - #define WHITEOUT_DEV 0 #define WHITEOUT_MODE 0 -struct swap_info_struct; -struct inode_operations; -struct file_operations; - -struct inode { - struct super_block *i_sb; - unsigned long i_ino; - umode_t i_mode; - unsigned int i_nlink; - loff_t i_size; - struct address_space *i_mapping; - struct address_space i_data; - kuid_t i_uid; - kgid_t i_gid; - unsigned long i_blocks; - unsigned int i_generation; - unsigned int i_flags; - unsigned int i_blkbits; - unsigned long i_state; - struct timespec64 i_atime; - struct timespec64 i_mtime; - struct timespec64 i_ctime; - struct list_head i_io_list; - dev_t i_rdev; - const struct inode_operations *i_op; - const struct file_operations *i_fop; - atomic_t i_writecount; /* Count of writers */ - atomic_t i_count; /* Reference count */ - struct rw_semaphore i_rwsem; /* inode lock */ - const char *i_link; /* Symlink target for fast symlinks */ - unsigned short i_write_hint; /* Write life time hint */ - - /* U-Boot: linkage into super_block s_inodes list */ - struct list_head i_sb_list; -}; - -/* Inode time accessors */ -static inline struct timespec64 inode_get_atime(const struct inode *inode) -{ - return inode->i_atime; -} - -static inline struct timespec64 inode_get_mtime(const struct inode *inode) -{ - return inode->i_mtime; -} - -static inline struct timespec64 inode_get_ctime(const struct inode *inode) -{ - return inode->i_ctime; -} - -static inline time_t inode_get_atime_sec(const struct inode *inode) -{ - return inode->i_atime.tv_sec; -} - -static inline time_t inode_get_ctime_sec(const struct inode *inode) -{ - return inode->i_ctime.tv_sec; -} - -static inline time_t inode_get_mtime_sec(const struct inode *inode) -{ - return inode->i_mtime.tv_sec; -} - -static inline void inode_set_ctime(struct inode *inode, time_t sec, long nsec) -{ - inode->i_ctime.tv_sec = sec; - inode->i_ctime.tv_nsec = nsec; -} - -static inline void inode_set_atime(struct inode *inode, time_t sec, long nsec) -{ - inode->i_atime.tv_sec = sec; - inode->i_atime.tv_nsec = nsec; -} - -static inline void inode_set_mtime(struct inode *inode, time_t sec, long nsec) -{ - inode->i_mtime.tv_sec = sec; - inode->i_mtime.tv_nsec = nsec; -} - -static inline void simple_inode_init_ts(struct inode *inode) -{ - struct timespec64 ts = { .tv_sec = 0, .tv_nsec = 0 }; - - inode->i_atime = ts; - inode->i_mtime = ts; - inode->i_ctime = ts; -} - /* * Inode state accessors - simplified for single-threaded U-Boot. * Linux uses READ_ONCE/WRITE_ONCE and lockdep assertions; we use direct access. @@ -450,37 +354,7 @@ struct dx_hash_info { #include <linux/path.h> #include <linux/fsverity.h> - -/* Inode time setters - needed for ext4.h */ -static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode, - struct timespec64 ts) -{ - inode->i_atime = ts; - return ts; -} - -static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, - struct timespec64 ts) -{ - inode->i_ctime = ts; - return ts; -} - -/* Inode version operations - use linux/iversion.h */ #include <linux/iversion.h> - -/* Inode credential helpers - i_uid_read, i_gid_read need struct inode */ -static inline unsigned int i_uid_read(const struct inode *inode) -{ - return inode->i_uid.val; -} - -static inline unsigned int i_gid_read(const struct inode *inode) -{ - return inode->i_gid.val; -} - -/* Device encoding helpers are now in linux/kdev_t.h */ #include <linux/kdev_t.h> /* UID/GID bit helpers - use linux/highuid.h */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 3f82a027931..e78ac5f7284 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -11,9 +11,12 @@ #include <linux/list.h> #include <linux/mutex.h> #include <linux/fs/super_types.h> +#include <linux/cred.h> +#include <linux/rwsem.h> +#include <linux/time.h> +#include <asm-generic/atomic.h> /* Forward declarations */ -struct inode; struct buffer_head; struct file; struct folio; @@ -100,6 +103,130 @@ struct address_space_operations { sector_t *); }; +/* Forward declarations for inode */ +struct inode_operations; +struct file_operations; + +/** + * struct inode - filesystem inode + * + * Core filesystem object representing a file, directory, or other entity. + */ +struct inode { + struct super_block *i_sb; + unsigned long i_ino; + umode_t i_mode; + unsigned int i_nlink; + loff_t i_size; + struct address_space *i_mapping; + struct address_space i_data; + kuid_t i_uid; + kgid_t i_gid; + unsigned long i_blocks; + unsigned int i_generation; + unsigned int i_flags; + unsigned int i_blkbits; + unsigned long i_state; + struct timespec64 i_atime; + struct timespec64 i_mtime; + struct timespec64 i_ctime; + struct list_head i_io_list; + dev_t i_rdev; + const struct inode_operations *i_op; + const struct file_operations *i_fop; + atomic_t i_writecount; /* Count of writers */ + atomic_t i_count; /* Reference count */ + struct rw_semaphore i_rwsem; /* inode lock */ + const char *i_link; /* Symlink target for fast symlinks */ + unsigned short i_write_hint; /* Write life time hint */ +#ifdef __UBOOT__ + struct list_head i_sb_list; /* Linkage into super_block s_inodes */ +#endif +}; + +/* Inode time accessors */ +static inline struct timespec64 inode_get_atime(const struct inode *inode) +{ + return inode->i_atime; +} + +static inline struct timespec64 inode_get_mtime(const struct inode *inode) +{ + return inode->i_mtime; +} + +static inline struct timespec64 inode_get_ctime(const struct inode *inode) +{ + return inode->i_ctime; +} + +static inline time_t inode_get_atime_sec(const struct inode *inode) +{ + return inode->i_atime.tv_sec; +} + +static inline time_t inode_get_ctime_sec(const struct inode *inode) +{ + return inode->i_ctime.tv_sec; +} + +static inline time_t inode_get_mtime_sec(const struct inode *inode) +{ + return inode->i_mtime.tv_sec; +} + +static inline void inode_set_ctime(struct inode *inode, time_t sec, long nsec) +{ + inode->i_ctime.tv_sec = sec; + inode->i_ctime.tv_nsec = nsec; +} + +static inline void inode_set_atime(struct inode *inode, time_t sec, long nsec) +{ + inode->i_atime.tv_sec = sec; + inode->i_atime.tv_nsec = nsec; +} + +static inline void inode_set_mtime(struct inode *inode, time_t sec, long nsec) +{ + inode->i_mtime.tv_sec = sec; + inode->i_mtime.tv_nsec = nsec; +} + +static inline void simple_inode_init_ts(struct inode *inode) +{ + struct timespec64 ts = { .tv_sec = 0, .tv_nsec = 0 }; + + inode->i_atime = ts; + inode->i_mtime = ts; + inode->i_ctime = ts; +} + +static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode, + struct timespec64 ts) +{ + inode->i_atime = ts; + return ts; +} + +static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, + struct timespec64 ts) +{ + inode->i_ctime = ts; + return ts; +} + +/* Inode credential helpers */ +static inline unsigned int i_uid_read(const struct inode *inode) +{ + return inode->i_uid.val; +} + +static inline unsigned int i_gid_read(const struct inode *inode) +{ + return inode->i_gid.val; +} + /* block_device - minimal stub */ struct block_device { struct address_space *bd_mapping; -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move superblock-related functions and macros from ext4_uboot.h to include/linux/fs/super_types.h where struct super_block is defined. This includes: - sb_start_intwrite(), sb_end_intwrite(), sb_start_intwrite_trylock() - sb_start_pagefault(), sb_end_pagefault() - sb_set_blocksize(), sb_min_blocksize(), sb_bdev_nr_blocks() - sb_issue_zeroout(), sb_issue_discard() - sb_is_blkdev_sb(), sb_no_casefold_compat_fallback() - super_set_uuid() - SB_I_CGROUPWB, SB_I_ALLOW_HSM Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 42 -------------------------------- include/linux/fs/super_types.h | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6f4ebd7e68b..0cddc46cf98 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -132,7 +132,6 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, #endif /* Block device operations - stubs */ -#define sb_issue_zeroout(sb, blk, num, gfp) ({ (void)(sb); (void)(blk); (void)(num); (void)(gfp); 0; }) #define blkdev_issue_flush(bdev) ({ (void)(bdev); 0; }) #include <linux/rcupdate.h> @@ -281,7 +280,6 @@ struct dx_hash_info { #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) -#define sb_no_casefold_compat_fallback(sb) ({ (void)(sb); 1; }) #define generic_ci_validate_strict_name(d, n) ({ (void)(d); (void)(n); 1; }) #include <linux/minmax.h> @@ -343,14 +341,6 @@ struct dx_hash_info { #define dax_zero_range(i, p, l, d, op) ({ (void)(i); (void)(p); (void)(l); (void)(d); (void)(op); -EOPNOTSUPP; }) #define dax_break_layout_inode(i, m) ({ (void)(i); (void)(m); 0; }) -/* Superblock freezing stubs */ -#define sb_start_intwrite(sb) do { (void)(sb); } while (0) -#define sb_end_intwrite(sb) do { (void)(sb); } while (0) -#define sb_start_intwrite_trylock(sb) ({ (void)(sb); 1; }) -#define sb_start_pagefault(sb) do { (void)(sb); } while (0) -#define sb_end_pagefault(sb) do { (void)(sb); } while (0) - -/* d_path, path_put - use linux/path.h */ #include <linux/path.h> #include <linux/fsverity.h> @@ -465,9 +455,6 @@ void ext4_unregister_li_request(struct super_block *sb); /* I/O priority classes - use linux/ioprio.h */ #include <linux/ioprio.h> -#define SB_I_CGROUPWB 0 /* Not supported in U-Boot */ -#define SB_I_ALLOW_HSM 0 /* Not supported in U-Boot */ - /* blk_holder_ops for block device */ struct blk_holder_ops { void (*mark_dead)(struct block_device *, bool); @@ -531,32 +518,9 @@ void free_page(unsigned long addr); void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); -/* Superblock blocksize - declaration for stub.c */ -int sb_set_blocksize(struct super_block *sb, int size); - -/* Superblock min blocksize - stub */ -static inline int sb_min_blocksize(struct super_block *sb, int size) -{ - return sb_set_blocksize(sb, size); -} - /* Block device size - declarations for stub.c */ int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); -u64 sb_bdev_nr_blocks(struct super_block *sb); unsigned int bdev_max_discard_sectors(struct block_device *bdev); - -/* Superblock identity functions */ -static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, - unsigned len) -{ - if (len > sizeof(sb->s_uuid.b)) - len = sizeof(sb->s_uuid.b); - memcpy(sb->s_uuid.b, uuid, len); -} - -/* super_set_sysfs_name_bdev is now in linux/kobject.h */ - -/* mb_cache - use linux/mbcache.h */ #include <linux/mbcache.h> /* xattr helper stubs for xattr.c */ @@ -595,10 +559,6 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* Block device properties */ #define bdev_nonrot(bdev) ({ (void)(bdev); 0; }) -/* sb_issue_discard - issue discard request (no-op in U-Boot) */ -#define sb_issue_discard(sb, sector, nr_sects, gfp, flags) \ - ({ (void)(sb); (void)(sector); (void)(nr_sects); (void)(gfp); (void)(flags); 0; }) - /* raw_cpu_ptr - get pointer to per-CPU data for current CPU */ #define raw_cpu_ptr(ptr) (ptr) @@ -650,8 +610,6 @@ void ext4l_print_msgs(void); struct blk_desc *ext4l_get_blk_dev(void); struct disk_partition *ext4l_get_partition(void); -#define sb_is_blkdev_sb(sb) ({ (void)(sb); 0; }) - /* DEFINE_WAIT stub - creates a wait queue entry */ #define DEFINE_WAIT(name) int name = 0 diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h index c575d268c43..189a40dd123 100644 --- a/include/linux/fs/super_types.h +++ b/include/linux/fs/super_types.h @@ -9,6 +9,7 @@ #include <linux/list.h> #include <linux/rwsem.h> +#include <linux/string.h> #include <linux/time.h> #include <linux/types.h> #include <linux/uuid.h> @@ -98,4 +99,47 @@ static inline bool sb_rdonly(const struct super_block *sb) #define sb_end_write(sb) do { (void)(sb); } while (0) #define sb_start_write_trylock(sb) ({ (void)(sb); 1; }) +/* Superblock internal write operations */ +#define sb_start_intwrite(sb) do { (void)(sb); } while (0) +#define sb_end_intwrite(sb) do { (void)(sb); } while (0) +#define sb_start_intwrite_trylock(sb) ({ (void)(sb); 1; }) + +/* Superblock pagefault operations */ +#define sb_start_pagefault(sb) do { (void)(sb); } while (0) +#define sb_end_pagefault(sb) do { (void)(sb); } while (0) + +/* Superblock internal flags */ +#define SB_I_CGROUPWB 0 /* Not supported in U-Boot */ +#define SB_I_ALLOW_HSM 0 /* Not supported in U-Boot */ + +/* Superblock block size operations - sb_set_blocksize in stub.c */ +int sb_set_blocksize(struct super_block *sb, int size); + +static inline int sb_min_blocksize(struct super_block *sb, int size) +{ + return sb_set_blocksize(sb, size); +} + +/* Superblock block device operations */ +u64 sb_bdev_nr_blocks(struct super_block *sb); +#define sb_is_blkdev_sb(sb) ({ (void)(sb); 0; }) + +/* Superblock discard/zeroout operations - no-op in U-Boot */ +#define sb_issue_zeroout(sb, blk, num, gfp) \ + ({ (void)(sb); (void)(blk); (void)(num); (void)(gfp); 0; }) +#define sb_issue_discard(sb, sector, nr_sects, gfp, flags) \ + ({ (void)(sb); (void)(sector); (void)(nr_sects); (void)(gfp); (void)(flags); 0; }) + +/* Case-folding - not supported in U-Boot */ +#define sb_no_casefold_compat_fallback(sb) ({ (void)(sb); 1; }) + +/* Superblock identity functions */ +static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, + unsigned len) +{ + if (len > sizeof(sb->s_uuid.b)) + len = sizeof(sb->s_uuid.b); + memcpy(sb->s_uuid.b, uuid, len); +} + #endif /* _LINUX_FS_SUPER_TYPES_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move seq_file operation stubs and declarations from ext4_uboot.h to include/linux/seq_file.h where they belong. This includes: - seq_open(), seq_release() stubs - seq_read(), seq_lseek() declarations Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 9 --------- include/linux/seq_file.h | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 0cddc46cf98..278351a9fef 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -616,17 +616,8 @@ struct disk_partition *ext4l_get_partition(void); /* JBD2 journal.c stubs */ int bmap(struct inode *inode, sector_t *block); -/* seq_file operations for /proc - stubs */ -#define seq_open(f, ops) ({ (void)(f); (void)(ops); 0; }) -#define seq_release(i, f) ({ (void)(i); (void)(f); 0; }) - -/* proc_ops - use linux/proc_fs.h */ #include <linux/proc_fs.h> -/* seq_read and seq_lseek declarations (defined in stub.c) */ -ssize_t seq_read(struct file *f, char *b, size_t s, loff_t *p); -loff_t seq_lseek(struct file *f, loff_t o, int w); - /* Block device operations for journal.c */ #define truncate_inode_pages_range(m, s, e) \ do { (void)(m); (void)(s); (void)(e); } while (0) diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index c10da3e4f98..6afe754745c 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -29,4 +29,12 @@ struct seq_operations { #define seq_puts(m, s) do { (void)(m); (void)(s); } while (0) #define seq_putc(m, c) do { (void)(m); (void)(c); } while (0) +/* seq_file operations - stubs */ +#define seq_open(f, ops) ({ (void)(f); (void)(ops); 0; }) +#define seq_release(i, f) ({ (void)(i); (void)(f); 0; }) + +/* seq_read and seq_lseek - implemented in ext4l/stub.c */ +ssize_t seq_read(struct file *f, char *b, size_t s, loff_t *p); +loff_t seq_lseek(struct file *f, loff_t o, int w); + #endif /* _LINUX_SEQ_FILE_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the inode state accessor functions from ext4_uboot.h to include/linux/fs.h where struct inode is defined. This includes: - inode_state_read_once(), inode_state_read() - inode_state_set_raw(), inode_state_set() - inode_state_clear_raw(), inode_state_clear() - inode_state_assign_raw(), inode_state_assign() Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 46 ------------------------------------------- include/linux/fs.h | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 278351a9fef..d3ad76f2618 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -183,52 +183,6 @@ static inline int bdev_read_only(struct block_device *bdev) #define WHITEOUT_DEV 0 #define WHITEOUT_MODE 0 -/* - * Inode state accessors - simplified for single-threaded U-Boot. - * Linux uses READ_ONCE/WRITE_ONCE and lockdep assertions; we use direct access. - */ -static inline unsigned long inode_state_read_once(struct inode *inode) -{ - return inode->i_state; -} - -static inline unsigned long inode_state_read(struct inode *inode) -{ - return inode->i_state; -} - -static inline void inode_state_set_raw(struct inode *inode, unsigned long flags) -{ - inode->i_state |= flags; -} - -static inline void inode_state_set(struct inode *inode, unsigned long flags) -{ - inode->i_state |= flags; -} - -static inline void inode_state_clear_raw(struct inode *inode, - unsigned long flags) -{ - inode->i_state &= ~flags; -} - -static inline void inode_state_clear(struct inode *inode, unsigned long flags) -{ - inode->i_state &= ~flags; -} - -static inline void inode_state_assign_raw(struct inode *inode, - unsigned long flags) -{ - inode->i_state = flags; -} - -static inline void inode_state_assign(struct inode *inode, unsigned long flags) -{ - inode->i_state = flags; -} - /* QSTR_INIT and dotdot_name are now in linux/dcache.h */ /* diff --git a/include/linux/fs.h b/include/linux/fs.h index e78ac5f7284..f50a081b32b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -227,6 +227,52 @@ static inline unsigned int i_gid_read(const struct inode *inode) return inode->i_gid.val; } +/* + * Inode state accessors - simplified for single-threaded U-Boot. + * Linux uses READ_ONCE/WRITE_ONCE and lockdep assertions; we use direct access. + */ +static inline unsigned long inode_state_read_once(struct inode *inode) +{ + return inode->i_state; +} + +static inline unsigned long inode_state_read(struct inode *inode) +{ + return inode->i_state; +} + +static inline void inode_state_set_raw(struct inode *inode, unsigned long flags) +{ + inode->i_state |= flags; +} + +static inline void inode_state_set(struct inode *inode, unsigned long flags) +{ + inode->i_state |= flags; +} + +static inline void inode_state_clear_raw(struct inode *inode, + unsigned long flags) +{ + inode->i_state &= ~flags; +} + +static inline void inode_state_clear(struct inode *inode, unsigned long flags) +{ + inode->i_state &= ~flags; +} + +static inline void inode_state_assign_raw(struct inode *inode, + unsigned long flags) +{ + inode->i_state = flags; +} + +static inline void inode_state_assign(struct inode *inode, unsigned long flags) +{ + inode->i_state = flags; +} + /* block_device - minimal stub */ struct block_device { struct address_space *bd_mapping; -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the generic VFS operation stubs from ext4_uboot.h to include/linux/fs.h where they belong. This includes: - generic_file_read_iter(), generic_write_checks() - generic_perform_write(), generic_write_sync() - generic_atomic_write_valid() - generic_buffers_fsync_noflush() - generic_fillattr(), generic_fill_statx_atomic_writes() - generic_file_llseek_size() - generic_ci_validate_strict_name() - generic_read_dir(), generic_check_addressable() Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 21 +-------------------- include/linux/fs.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index d3ad76f2618..35626a95cf8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -224,18 +224,10 @@ struct dx_hash_info { #define file_modified(file) ({ (void)(file); 0; }) #define file_accessed(file) do { (void)(file); } while (0) -/* Generic file operations - stubs for file.c */ -#define generic_file_read_iter(iocb, to) ({ (void)(iocb); (void)(to); 0L; }) -#define generic_write_checks(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) -#define generic_perform_write(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) -#define generic_write_sync(iocb, count) ({ (void)(iocb); (count); }) -#define generic_atomic_write_valid(iocb, from) ({ (void)(iocb); (void)(from); 0; }) #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) -#define generic_ci_validate_strict_name(d, n) ({ (void)(d); (void)(n); 1; }) - #include <linux/minmax.h> /* Memory retry wait */ @@ -284,7 +276,6 @@ struct dx_hash_info { /* Sync operations - stubs */ #define sync_mapping_buffers(m) ({ (void)(m); 0; }) #define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; }) -#define generic_buffers_fsync_noflush(f, s, e, d) ({ (void)(f); (void)(s); (void)(e); (void)(d); 0; }) #define file_write_and_wait_range(f, s, e) ({ (void)(f); (void)(s); (void)(e); 0; }) #define file_check_and_advance_wb_err(f) ({ (void)(f); 0; }) @@ -311,8 +302,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) #define setattr_copy(m, i, a) do { } while (0) #define posix_acl_chmod(m, i, mo) ({ (void)(m); (void)(i); (void)(mo); 0; }) -#define generic_fillattr(m, req, i, s) do { } while (0) -#define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) /* File operations */ #define file_update_time(f) do { } while (0) @@ -332,13 +321,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); /* FSTR_INIT - fscrypt_str initializer (fscrypt_str defined in ext4_fscrypt.h) */ #define FSTR_INIT(n, l) { .name = (n), .len = (l) } -/* File llseek */ -#define generic_file_llseek_size(f, o, w, m, e) ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) - -/* generic_read_dir - stub function (needs to be a real function for struct init) */ -ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, - loff_t *ppos); - /* struct_size - use linux/overflow.h */ #include <linux/overflow.h> @@ -472,8 +454,7 @@ void free_page(unsigned long addr); void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); -/* Block device size - declarations for stub.c */ -int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); +/* Block device size - declaration for stub.c */ unsigned int bdev_max_discard_sectors(struct block_device *bdev); #include <linux/mbcache.h> diff --git a/include/linux/fs.h b/include/linux/fs.h index f50a081b32b..3fa54146f44 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -638,4 +638,37 @@ struct inode_operations { umode_t); }; +/* + * Generic VFS operations - stubs for U-Boot + */ + +/* Generic file I/O operations */ +#define generic_file_read_iter(iocb, to) ({ (void)(iocb); (void)(to); 0L; }) +#define generic_write_checks(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) +#define generic_perform_write(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) +#define generic_write_sync(iocb, count) ({ (void)(iocb); (count); }) +#define generic_atomic_write_valid(iocb, from) ({ (void)(iocb); (void)(from); 0; }) + +/* Generic fsync operation */ +#define generic_buffers_fsync_noflush(f, s, e, d) \ + ({ (void)(f); (void)(s); (void)(e); (void)(d); 0; }) + +/* Generic attribute operations */ +#define generic_fillattr(m, req, i, s) do { } while (0) +#define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) + +/* Generic seek operation */ +#define generic_file_llseek_size(f, o, w, m, e) \ + ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) + +/* Case-insensitive name validation - not supported */ +#define generic_ci_validate_strict_name(d, n) ({ (void)(d); (void)(n); 1; }) + +/* Generic directory read - implemented in ext4l/stub.c */ +ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, + loff_t *ppos); + +/* Block addressability check - implemented in ext4l/stub.c */ +int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); + #endif /* _LINUX_FS_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move block device operation stubs and declarations from ext4_uboot.h to include/linux/blkdev.h where they belong. This includes: - bdev_read_only(), bdev_write_zeroes_unmap_sectors() - bdev_dma_alignment(), bdev_nonrot(), bdev_discard_granularity() - bdev_max_discard_sectors(), bdev_fput(), bdev_file_open_by_dev() - bdev_getblk(), __bread(), set_blocksize() - sync_blockdev(), invalidate_bdev() - blkdev_issue_flush(), blkdev_issue_discard(), blkdev_issue_zeroout() - BLK_MAX_SEGMENT_SIZE constant Move bdev_read_only() implementation to stub.c since it needs the full struct block_device definition. Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 46 +----------------------------------------- fs/ext4l/stub.c | 5 +++++ include/linux/blkdev.h | 39 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 35626a95cf8..f12dbe2b76d 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -131,9 +131,6 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, bool is_create); #endif -/* Block device operations - stubs */ -#define blkdev_issue_flush(bdev) ({ (void)(bdev); 0; }) - #include <linux/rcupdate.h> #include <linux/slab.h> @@ -175,11 +172,6 @@ struct readahead_control; struct fiemap_extent_info; struct folio; -static inline int bdev_read_only(struct block_device *bdev) -{ - return bdev ? bdev->read_only : 0; -} - #define WHITEOUT_DEV 0 #define WHITEOUT_MODE 0 @@ -233,9 +225,6 @@ struct dx_hash_info { /* Memory retry wait */ #define memalloc_retry_wait(g) do { } while (0) -/* bdev operations */ -#define bdev_write_zeroes_unmap_sectors(b) ({ (void)(b); 0; }) - /* indirect.c stubs */ /* ext4_sb_bread_nofail is stubbed in interface.c */ @@ -311,9 +300,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define iomap_bmap(m, b, o) ({ (void)(m); (void)(b); (void)(o); 0UL; }) #define iomap_swapfile_activate(s, f, sp, o) ({ (void)(s); (void)(f); (void)(sp); (void)(o); -EOPNOTSUPP; }) -/* Block device alignment */ -#define bdev_dma_alignment(bd) (0) - /* * Additional stubs for dir.c */ @@ -411,9 +397,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* blockgroup_lock - use linux/blockgroup_lock.h */ #include <linux/blockgroup_lock.h> -/* Buffer submission stubs - declarations for stub.c implementations */ -struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, - unsigned int size, gfp_t gfp); +/* Buffer submission stubs - declaration for stub.c */ int trylock_buffer(struct buffer_head *bh); /* Trace stubs for super.c - declaration for stub.c implementation */ @@ -428,10 +412,6 @@ void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); char *file_path(struct file *file, char *buf, int buflen); struct block_device *file_bdev(struct file *file); -/* Block device sync - declarations for stub.c */ -int sync_blockdev(struct block_device *bdev); -void invalidate_bdev(struct block_device *bdev); - /* kobject_put is now in linux/kobject.h */ /* wait_for_completion is now a macro in linux/completion.h */ @@ -454,26 +434,15 @@ void free_page(unsigned long addr); void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); -/* Block device size - declaration for stub.c */ -unsigned int bdev_max_discard_sectors(struct block_device *bdev); #include <linux/mbcache.h> /* xattr helper stubs for xattr.c */ #define xattr_handler_can_list(h, d) ({ (void)(h); (void)(d); 0; }) #define xattr_prefix(h) ({ (void)(h); (const char *)NULL; }) -/* Block device operations - declarations for stub.c */ -void bdev_fput(void *file); -void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, - const struct blk_holder_ops *ops); - /* Filesystem sync - declaration for stub.c */ int sync_filesystem(void *sb); -/* Block device file operations - stubs */ -#define set_blocksize(f, size) ({ (void)(f); (void)(size); 0; }) -struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned size); - /* * Stubs for mballoc.c */ @@ -488,18 +457,9 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned #define DEFINE_RAW_FLEX(type, name, member, count) \ type *name = NULL -/* Block layer constants */ -#define BLK_MAX_SEGMENT_SIZE 65536 - -/* Block device properties */ -#define bdev_nonrot(bdev) ({ (void)(bdev); 0; }) - /* raw_cpu_ptr - get pointer to per-CPU data for current CPU */ #define raw_cpu_ptr(ptr) (ptr) -#define bdev_discard_granularity(bdev) \ - ({ (void)(bdev); 0U; }) - /* * Stubs for page-io.c - bio types are in linux/bio.h */ @@ -556,10 +516,6 @@ int bmap(struct inode *inode, sector_t *block); /* Block device operations for journal.c */ #define truncate_inode_pages_range(m, s, e) \ do { (void)(m); (void)(s); (void)(e); } while (0) -#define blkdev_issue_discard(bdev, s, n, gfp) \ - ({ (void)(bdev); (void)(s); (void)(n); (void)(gfp); 0; }) -#define blkdev_issue_zeroout(bdev, s, n, gfp, f) \ - ({ (void)(bdev); (void)(s); (void)(n); (void)(gfp); (void)(f); 0; }) /* Memory allocation for journal.c */ #define __get_free_pages(gfp, order) ((unsigned long)memalign(PAGE_SIZE, PAGE_SIZE << (order))) diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 1b9c72a6cc2..3da511fa1cf 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -433,6 +433,11 @@ void invalidate_bdev(struct block_device *bdev) { } +int bdev_read_only(struct block_device *bdev) +{ + return bdev ? bdev->read_only : 0; +} + struct block_device *file_bdev(struct file *file) { return NULL; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index eaf2984c08f..89d284dab26 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -55,4 +55,43 @@ struct blk_plug { #define bdev_atomic_write_unit_max_bytes(bdev) ({ (void)(bdev); (unsigned int)0; }) #define bdev_atomic_write_unit_min_bytes(bdev) ({ (void)(bdev); 0UL; }) +/* Block device read-only check - implemented in ext4l/stub.c */ +int bdev_read_only(struct block_device *bdev); + +/* Block device property stubs */ +#define bdev_write_zeroes_unmap_sectors(b) ({ (void)(b); 0; }) +#define bdev_dma_alignment(bd) (0) +#define bdev_nonrot(bdev) ({ (void)(bdev); 0; }) +#define bdev_discard_granularity(bdev) ({ (void)(bdev); 0U; }) +#define set_blocksize(f, size) ({ (void)(f); (void)(size); 0; }) + +/* Block layer constants */ +#define BLK_MAX_SEGMENT_SIZE 65536 + +/* Block device I/O operations - stubs */ +#define blkdev_issue_flush(bdev) ({ (void)(bdev); 0; }) +#define blkdev_issue_discard(bdev, s, n, gfp) \ + ({ (void)(bdev); (void)(s); (void)(n); (void)(gfp); 0; }) +#define blkdev_issue_zeroout(bdev, s, n, gfp, f) \ + ({ (void)(bdev); (void)(s); (void)(n); (void)(gfp); (void)(f); 0; }) + +/* Block device sync - implemented in ext4l/stub.c */ +int sync_blockdev(struct block_device *bdev); +void invalidate_bdev(struct block_device *bdev); + +/* Block device size - implemented in ext4l/stub.c */ +unsigned int bdev_max_discard_sectors(struct block_device *bdev); + +/* Block device file operations - implemented in ext4l/stub.c */ +struct blk_holder_ops; +void bdev_fput(void *file); +void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, + const struct blk_holder_ops *ops); + +/* Buffer operations on block devices - implemented in ext4l/stub.c */ +struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, + unsigned int size, gfp_t gfp); +struct buffer_head *__bread(struct block_device *bdev, sector_t block, + unsigned int size); + #endif /* _LINUX_BLKDEV_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move file-related operations from ext4_uboot.h to the standard linux/fs.h header. This includes file_modified(), file_accessed(), file_update_time(), file_write_and_wait_range(), file_check_and_advance_wb_err(), file_path(), and file_bdev(). Also remove redundant forward declarations (file_kattr, dir_context, readahead_control, fiemap_extent_info, folio) that are already in fs.h. This reduces ext4_uboot.h from 568 to 553 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 15 --------------- include/linux/fs.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index f12dbe2b76d..746d4e9a748 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -166,11 +166,6 @@ BUFFER_FNS(Cached, cached) struct pipe_inode_info; struct kstat; struct path; -struct file_kattr; -struct dir_context; -struct readahead_control; -struct fiemap_extent_info; -struct folio; #define WHITEOUT_DEV 0 #define WHITEOUT_MODE 0 @@ -213,9 +208,6 @@ struct dx_hash_info { do { } while (0) #endif -#define file_modified(file) ({ (void)(file); 0; }) -#define file_accessed(file) do { (void)(file); } while (0) - #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) @@ -265,8 +257,6 @@ struct dx_hash_info { /* Sync operations - stubs */ #define sync_mapping_buffers(m) ({ (void)(m); 0; }) #define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; }) -#define file_write_and_wait_range(f, s, e) ({ (void)(f); (void)(s); (void)(e); 0; }) -#define file_check_and_advance_wb_err(f) ({ (void)(f); 0; }) /* DAX stubs - DAX not supported in U-Boot */ #define IS_DAX(inode) (0) @@ -293,7 +283,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define posix_acl_chmod(m, i, mo) ({ (void)(m); (void)(i); (void)(mo); 0; }) /* File operations */ -#define file_update_time(f) do { } while (0) #define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) /* iomap stubs */ @@ -408,10 +397,6 @@ void trace_ext4_error(struct super_block *sb, const char *func, unsigned int lin /* Filesystem notification - declaration for stub.c */ void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); -/* File path operations - declaration for stub.c */ -char *file_path(struct file *file, char *buf, int buflen); -struct block_device *file_bdev(struct file *file); - /* kobject_put is now in linux/kobject.h */ /* wait_for_completion is now a macro in linux/completion.h */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 3fa54146f44..ea4d1fdf97e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -321,6 +321,17 @@ static inline struct inode *file_inode(struct file *f) return f->f_inode; } +/* File modification tracking - stubs for U-Boot */ +#define file_modified(file) ({ (void)(file); 0; }) +#define file_accessed(file) do { (void)(file); } while (0) +#define file_update_time(f) do { } while (0) +#define file_write_and_wait_range(f, s, e) ({ (void)(f); (void)(s); (void)(e); 0; }) +#define file_check_and_advance_wb_err(f) ({ (void)(f); 0; }) + +/* File path operations - implemented in ext4l/stub.c */ +char *file_path(struct file *file, char *buf, int buflen); +struct block_device *file_bdev(struct file *file); + /* iattr - inode attributes for setattr */ struct iattr { unsigned int ia_valid; -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move fsnotify_sb_error() declaration to linux/fs.h alongside the existing fsnotify_change() stub. The implementation remains in ext4l/stub.c. This reduces ext4_uboot.h from 553 to 550 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 3 --- include/linux/fs.h | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 746d4e9a748..51fdcfab281 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -394,9 +394,6 @@ void trace_ext4_error(struct super_block *sb, const char *func, unsigned int lin /* ___ratelimit is now in linux/ratelimit.h */ -/* Filesystem notification - declaration for stub.c */ -void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); - /* kobject_put is now in linux/kobject.h */ /* wait_for_completion is now a macro in linux/completion.h */ diff --git a/include/linux/fs.h b/include/linux/fs.h index ea4d1fdf97e..9ced2c78017 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -358,9 +358,12 @@ struct iattr { /* writeback_control - defined in linux/compat.h */ -/* fsnotify - stub */ +/* fsnotify - stubs */ #define fsnotify_change(d, m) do { } while (0) +/* fsnotify_sb_error - implemented in ext4l/stub.c */ +void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); + /* inode_init_once - stub */ static inline void inode_init_once(struct inode *inode) { -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the DEFINE_WAIT macro to linux/wait.h alongside the other wait queue stubs. This is a more appropriate location since it is a standard Linux kernel wait queue primitive. This reduces ext4_uboot.h from 550 to 547 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 3 --- include/linux/wait.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 51fdcfab281..0c214501cef 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -487,9 +487,6 @@ void ext4l_print_msgs(void); struct blk_desc *ext4l_get_blk_dev(void); struct disk_partition *ext4l_get_partition(void); -/* DEFINE_WAIT stub - creates a wait queue entry */ -#define DEFINE_WAIT(name) int name = 0 - /* JBD2 journal.c stubs */ int bmap(struct inode *inode, sector_t *block); diff --git a/include/linux/wait.h b/include/linux/wait.h index 70ebdc4919d..3dbcb100337 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -28,4 +28,7 @@ struct wait_queue_entry { #define wait_event(wq, condition) do { } while (0) #define wait_event_interruptible(wq, condition) 0 +/* DEFINE_WAIT - creates a wait queue entry (stub for U-Boot) */ +#define DEFINE_WAIT(name) int name = 0 + #endif /* _LINUX_WAIT_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move this filemap function to linux/pagemap.h alongside the other filemap_ stubs already defined there. This reduces ext4_uboot.h from 547 to 545 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 2 -- include/linux/pagemap.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 0c214501cef..f1c4a5a0fca 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -467,8 +467,6 @@ int sync_filesystem(void *sb); #include <asm-generic/bitops/lock.h> /* smp_mb__after_atomic is now in linux/smp.h */ #define ktime_get_coarse_real_ts64(ts) do { (ts)->tv_sec = 0; (ts)->tv_nsec = 0; } while (0) -#define filemap_fdatawait_range_keep_errors(m, s, e) \ - ({ (void)(m); (void)(s); (void)(e); 0; }) #define crc32_be(crc, p, len) crc32(crc, p, len) /* ext4l support functions (support.c) */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index eb689fa885f..22c7f05c57e 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -155,6 +155,8 @@ void mapping_clear_folio_cache(struct address_space *mapping); #define filemap_fdatawrite_range(m, s, e) ({ (void)(m); (void)(s); (void)(e); 0; }) #define filemap_flush(m) ({ (void)(m); 0; }) #define filemap_write_and_wait(m) ({ (void)(m); 0; }) +#define filemap_fdatawait_range_keep_errors(m, s, e) \ + ({ (void)(m); (void)(s); (void)(e); 0; }) #define filemap_release_folio(folio, gfp) ({ (void)(folio); (void)(gfp); 1; }) #define mapping_tagged(m, t) (0) #define tag_pages_for_writeback(m, s, e) do { } while (0) -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move definitions to their appropriate standard headers: - sync_mapping_buffers(), sync_inode_metadata() to linux/fs.h - DAX stubs (IS_DAX, dax_break_layout_final, dax_writeback_mapping_range, dax_zero_range, dax_break_layout_inode, daxdev_mapping_supported) to linux/dax.h - ktime_get_coarse_real_ts64() to linux/ktime.h - Remove duplicate truncate_inode_pages_range (already in pagemap.h) Also fix linux/dax.h to use mm_types.h for vm_fault_t and VM_FAULT_* definitions, and update daxdev_mapping_supported to use the 3-arg signature expected by ext4. This reduces ext4_uboot.h from 545 to 528 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 19 +------------------ include/linux/dax.h | 23 +++++++++++++---------- include/linux/fs.h | 4 ++++ include/linux/ktime.h | 9 +++++++++ 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index f1c4a5a0fca..e21732da843 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -210,8 +210,6 @@ struct dx_hash_info { #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) -#define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) - #include <linux/minmax.h> /* Memory retry wait */ @@ -254,18 +252,8 @@ struct dx_hash_info { #define finish_open_simple(f, e) (e) #define ihold(i) do { (void)(i); } while (0) -/* Sync operations - stubs */ -#define sync_mapping_buffers(m) ({ (void)(m); 0; }) -#define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; }) - -/* DAX stubs - DAX not supported in U-Boot */ -#define IS_DAX(inode) (0) -#define dax_break_layout_final(inode) do { } while (0) -#define dax_writeback_mapping_range(m, bd, wb) ({ (void)(m); (void)(bd); (void)(wb); 0; }) -#define dax_zero_range(i, p, l, d, op) ({ (void)(i); (void)(p); (void)(l); (void)(d); (void)(op); -EOPNOTSUPP; }) -#define dax_break_layout_inode(i, m) ({ (void)(i); (void)(m); 0; }) - #include <linux/path.h> +#include <linux/dax.h> #include <linux/fsverity.h> #include <linux/iversion.h> @@ -466,7 +454,6 @@ int sync_filesystem(void *sb); /* JBD2 checkpoint.c and commit.c stubs */ #include <asm-generic/bitops/lock.h> /* smp_mb__after_atomic is now in linux/smp.h */ -#define ktime_get_coarse_real_ts64(ts) do { (ts)->tv_sec = 0; (ts)->tv_nsec = 0; } while (0) #define crc32_be(crc, p, len) crc32(crc, p, len) /* ext4l support functions (support.c) */ @@ -490,10 +477,6 @@ int bmap(struct inode *inode, sector_t *block); #include <linux/proc_fs.h> -/* Block device operations for journal.c */ -#define truncate_inode_pages_range(m, s, e) \ - do { (void)(m); (void)(s); (void)(e); } while (0) - /* Memory allocation for journal.c */ #define __get_free_pages(gfp, order) ((unsigned long)memalign(PAGE_SIZE, PAGE_SIZE << (order))) #define free_pages(addr, order) free((void *)(addr)) diff --git a/include/linux/dax.h b/include/linux/dax.h index adc0f9411a2..7e80fc97cd3 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -4,6 +4,7 @@ #include <linux/types.h> #include <linux/pfn_t.h> +#include <linux/mm_types.h> struct address_space; struct dax_device; @@ -12,11 +13,8 @@ struct iomap_ops; struct kiocb; struct iov_iter; struct vm_fault; - -typedef unsigned int vm_fault_t; - -#define VM_FAULT_SIGBUS 0x0002 -#define VM_FAULT_NOPAGE 0x0100 +struct file; +struct inode; /* DAX is not supported in U-Boot - provide stubs */ static inline ssize_t @@ -44,10 +42,15 @@ static inline bool dax_mapping(struct address_space *mapping) return false; } -static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, - struct dax_device *dax_dev) -{ - return false; -} +/* 3-arg version used by ext4 */ +#define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) + +/* DAX stubs */ +#define IS_DAX(inode) (0) +#define dax_break_layout_final(inode) do { } while (0) +#define dax_writeback_mapping_range(m, bd, wb) ({ (void)(m); (void)(bd); (void)(wb); 0; }) +#define dax_zero_range(i, p, l, d, op) \ + ({ (void)(i); (void)(p); (void)(l); (void)(d); (void)(op); -EOPNOTSUPP; }) +#define dax_break_layout_inode(i, m) ({ (void)(i); (void)(m); 0; }) #endif /* _LINUX_DAX_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 9ced2c78017..c8006d668b5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -667,6 +667,10 @@ struct inode_operations { #define generic_buffers_fsync_noflush(f, s, e, d) \ ({ (void)(f); (void)(s); (void)(e); (void)(d); 0; }) +/* Sync operations - stubs */ +#define sync_mapping_buffers(m) ({ (void)(m); 0; }) +#define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; }) + /* Generic attribute operations */ #define generic_fillattr(m, req, i, s) do { } while (0) #define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) diff --git a/include/linux/ktime.h b/include/linux/ktime.h index c853e694823..04767da5305 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -67,4 +67,13 @@ static inline ktime_t ktime_add_ns(ktime_t kt, s64 ns) */ #define ktime_get_ns() (0ULL) +/** + * ktime_get_coarse_real_ts64() - get coarse real time + * @ts: timespec64 to fill + * + * U-Boot stub - sets time to 0. + */ +#define ktime_get_coarse_real_ts64(ts) \ + do { (ts)->tv_sec = 0; (ts)->tv_nsec = 0; } while (0) + #endif /* _LINUX_KTIME_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> The DX_HASH_* and EXT4_HTREE_EOF_* constants are already defined in ext4.h. Move them inside the EXT4_UBOOT_NO_EXT4_H conditional block so they are only defined for files like hash.c that do not include ext4.h. Also merge adjacent EXT4_UBOOT_NO_EXT4_H blocks for cleaner code. This reduces ext4_uboot.h from 528 to 526 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index e21732da843..7356ddb6213 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -173,8 +173,8 @@ struct path; /* QSTR_INIT and dotdot_name are now in linux/dcache.h */ /* - * Hash info structure - defined in ext4.h. - * Only defined here for files that don't include ext4.h (like hash.c) + * Hash info structure and constants - defined in ext4.h. + * Only defined here for files that don't include ext4.h (like hash.c). * This is wrapped in EXT4_UBOOT_NO_EXT4_H which hash.c defines. */ #ifdef EXT4_UBOOT_NO_EXT4_H @@ -184,7 +184,6 @@ struct dx_hash_info { int hash_version; u32 *seed; }; -#endif /* Hash algorithm types */ #define DX_HASH_LEGACY 0 @@ -200,7 +199,6 @@ struct dx_hash_info { #define EXT4_HTREE_EOF_32BIT ((1UL << (32 - 1)) - 1) #define EXT4_HTREE_EOF_64BIT ((1ULL << (64 - 1)) - 1) -#ifdef EXT4_UBOOT_NO_EXT4_H #define ext4_warning(sb, fmt, ...) \ do { } while (0) -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Change hash.c to include ext4.h instead of using the EXT4_UBOOT_NO_EXT4_H workaround. This allows removal of the duplicated dx_hash_info struct, DX_HASH_* constants, EXT4_HTREE_EOF_* constants, and ext4_warning macros from ext4_uboot.h since they are already defined in ext4.h. This reduces ext4_uboot.h from 526 to 493 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 34 ---------------------------------- fs/ext4l/hash.c | 4 +--- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 7356ddb6213..14b3d075dd4 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -172,40 +172,6 @@ struct path; /* QSTR_INIT and dotdot_name are now in linux/dcache.h */ -/* - * Hash info structure and constants - defined in ext4.h. - * Only defined here for files that don't include ext4.h (like hash.c). - * This is wrapped in EXT4_UBOOT_NO_EXT4_H which hash.c defines. - */ -#ifdef EXT4_UBOOT_NO_EXT4_H -struct dx_hash_info { - u32 hash; - u32 minor_hash; - int hash_version; - u32 *seed; -}; - -/* Hash algorithm types */ -#define DX_HASH_LEGACY 0 -#define DX_HASH_HALF_MD4 1 -#define DX_HASH_TEA 2 -#define DX_HASH_LEGACY_UNSIGNED 3 -#define DX_HASH_HALF_MD4_UNSIGNED 4 -#define DX_HASH_TEA_UNSIGNED 5 -#define DX_HASH_SIPHASH 6 -#define DX_HASH_LAST DX_HASH_SIPHASH - -/* EOF markers for htree */ -#define EXT4_HTREE_EOF_32BIT ((1UL << (32 - 1)) - 1) -#define EXT4_HTREE_EOF_64BIT ((1ULL << (64 - 1)) - 1) - -#define ext4_warning(sb, fmt, ...) \ - do { } while (0) - -#define ext4_warning_inode(inode, fmt, ...) \ - do { } while (0) -#endif - #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) #include <linux/minmax.h> diff --git a/fs/ext4l/hash.c b/fs/ext4l/hash.c index 58063a872d3..c033e44b2d5 100644 --- a/fs/ext4l/hash.c +++ b/fs/ext4l/hash.c @@ -5,9 +5,7 @@ * Copyright (C) 2002 by Theodore Ts'o */ -#define EXT4_UBOOT_NO_EXT4_H -#include "ext4_uboot.h" -#include <linux/compiler.h> +#include "ext4.h" #define DELTA 0x9E3779B9 -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move inode lifecycle functions (new_inode, iget_locked, iput), block mapping (bmap), and simple filesystem helpers (simple_open, simple_get_link) from ext4_uboot.h to linux/fs.h where they belong. Also replace the list_sort and sort stub macros with proper includes of linux/list_sort.h and linux/sort.h. This reduces ext4_uboot.h from 492 to 466 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 30 +++--------------------------- include/linux/fs.h | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 14b3d075dd4..1228ced8e6c 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -117,9 +117,6 @@ #include <linux/quotaops.h> #include <linux/random.h> -/* Inode operations - iget_locked and new_inode are in interface.c */ -extern struct inode *new_inode(struct super_block *sb); - /* Forward declarations for xattr functions */ struct super_block; struct buffer_head; @@ -134,8 +131,6 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, #include <linux/rcupdate.h> #include <linux/slab.h> -void iput(struct inode *inode); - #include <linux/sched.h> #include <linux/buffer_head.h> #include <linux/jbd2.h> @@ -226,9 +221,6 @@ struct path; /* UID/GID bit helpers - use linux/highuid.h */ #include <linux/highuid.h> -/* Inode allocation/state operations */ -extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); - /* Attribute operations */ #define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) #define setattr_copy(m, i, a) do { } while (0) @@ -261,17 +253,6 @@ static inline void nd_terminate_link(void *name, loff_t len, int maxlen) ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; } -/* file open helper */ -#define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) - -/* simple_get_link - for fast symlinks stored in inode */ -static inline const char *simple_get_link(struct dentry *dentry, - struct inode *inode, - struct delayed_call *callback) -{ - return inode->i_link; -} - /* * Additional stubs for super.c */ @@ -436,9 +417,6 @@ void ext4l_print_msgs(void); struct blk_desc *ext4l_get_blk_dev(void); struct disk_partition *ext4l_get_partition(void); -/* JBD2 journal.c stubs */ -int bmap(struct inode *inode, sector_t *block); - #include <linux/proc_fs.h> /* Memory allocation for journal.c */ @@ -483,10 +461,8 @@ int ext4_update_overhead(struct super_block *sb, bool force); /* fsmap is now in linux/fsmap.h */ #include <linux/fsmap.h> -/* list_sort and sort stubs for fsmap.c - not used in U-Boot */ -#define list_sort(priv, head, cmp) \ - do { (void)(priv); (void)(head); (void)(cmp); } while (0) -#define sort(base, num, size, cmp, swap) \ - do { (void)(base); (void)(num); (void)(size); (void)(cmp); (void)(swap); } while (0) +/* list_sort and sort for fsmap.c */ +#include <linux/list_sort.h> +#include <linux/sort.h> #endif /* __EXT4_UBOOT_H__ */ diff --git a/include/linux/fs.h b/include/linux/fs.h index c8006d668b5..07fe8c5e711 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -557,11 +557,29 @@ enum { #define unlock_two_nondirectories(i1, i2) \ do { (void)(i1); (void)(i2); } while (0) -/* Inode allocation - implemented in ext4l/stub.c */ +/* Inode allocation and lifecycle - implemented in ext4l */ struct kmem_cache; void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, gfp_t gfp); int inode_generic_drop(struct inode *inode); +struct inode *new_inode(struct super_block *sb); +struct inode *iget_locked(struct super_block *sb, unsigned long ino); +void iput(struct inode *inode); + +/* Block mapping - implemented in ext4l/stub.c */ +int bmap(struct inode *inode, sector_t *block); + +/* Simple filesystem helpers */ +#define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) + +/* simple_get_link - for fast symlinks stored in inode */ +struct delayed_call; +static inline const char *simple_get_link(struct dentry *dentry, + struct inode *inode, + struct delayed_call *callback) +{ + return inode->i_link; +} /** * get_block_t - block mapping callback type -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the time_is_before_jiffies() stub macro to linux/jiffies.h where other jiffies-related definitions reside. This reduces ext4_uboot.h from 468 to 465 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 3 --- include/linux/jiffies.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1228ced8e6c..9229fc7ffc3 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -448,9 +448,6 @@ struct disk_partition *ext4l_get_partition(void); * Stubs for resize.c */ -/* time_is_before_jiffies - check if time is before current jiffies */ -#define time_is_before_jiffies(a) ({ (void)(a); 0; }) - /* ext4_update_overhead - declaration for stub.c */ int ext4_update_overhead(struct super_block *sb, bool force); diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 153a2841bf5..161ec56f688 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -29,4 +29,7 @@ #define nsecs_to_jiffies(ns) ((ns) / (1000000000L / HZ)) #define round_jiffies_up(j) (j) +/* Time comparison - stub for U-Boot (jiffies is always 0) */ +#define time_is_before_jiffies(a) ({ (void)(a); 0; }) + #endif /* _LINUX_JIFFIES_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> This function is already declared in ext4.h, so remove the duplicate from ext4_uboot.h. This reduces ext4_uboot.h from 465 to 458 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 9229fc7ffc3..7b883f9a7ff 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -444,13 +444,6 @@ struct disk_partition *ext4l_get_partition(void); #define PAGE_MASK (~(PAGE_SIZE - 1)) #endif -/* - * Stubs for resize.c - */ - -/* ext4_update_overhead - declaration for stub.c */ -int ext4_update_overhead(struct super_block *sb, bool force); - /* * Stubs for fsmap.c */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move xattr_handler_can_list() and xattr_prefix() stubs to linux/xattr.h where they belong. This reduces ext4_uboot.h from 458 to 455 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 5 +---- include/linux/xattr.h | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 7b883f9a7ff..6b943934069 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -350,10 +350,7 @@ void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); #include <linux/mbcache.h> - -/* xattr helper stubs for xattr.c */ -#define xattr_handler_can_list(h, d) ({ (void)(h); (void)(d); 0; }) -#define xattr_prefix(h) ({ (void)(h); (const char *)NULL; }) +#include <linux/xattr.h> /* Filesystem sync - declaration for stub.c */ int sync_filesystem(void *sb); diff --git a/include/linux/xattr.h b/include/linux/xattr.h index db1bf4d3ee6..11cb3c8ad05 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -57,4 +57,8 @@ struct xattr_handler { #define XATTR_CREATE 0x1 #define XATTR_REPLACE 0x2 +/* xattr handler helpers - stubs for U-Boot */ +#define xattr_handler_can_list(h, d) ({ (void)(h); (void)(d); 0; }) +#define xattr_prefix(h) ({ (void)(h); (const char *)NULL; }) + #endif /* _LINUX_XATTR_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> This function is already declared in fs/ext4l/xattr.h, so remove the duplicate from ext4_uboot.h. This reduces ext4_uboot.h from 455 to 445 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6b943934069..240d3bf2fb2 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -117,17 +117,6 @@ #include <linux/quotaops.h> #include <linux/random.h> -/* Forward declarations for xattr functions */ -struct super_block; -struct buffer_head; -struct qstr; - -#ifdef CONFIG_EXT4_XATTR -int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, - struct buffer_head *block_bh, size_t value_len, - bool is_create); -#endif - #include <linux/rcupdate.h> #include <linux/slab.h> -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move iomap_bmap() and iomap_swapfile_activate() stubs to linux/iomap.h where other iomap stubs are already defined. This reduces ext4_uboot.h from 444 to 440 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 4 ---- include/linux/iomap.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 240d3bf2fb2..2954723e2de 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -218,10 +218,6 @@ struct path; /* File operations */ #define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) -/* iomap stubs */ -#define iomap_bmap(m, b, o) ({ (void)(m); (void)(b); (void)(o); 0UL; }) -#define iomap_swapfile_activate(s, f, sp, o) ({ (void)(s); (void)(f); (void)(sp); (void)(o); -EOPNOTSUPP; }) - /* * Additional stubs for dir.c */ diff --git a/include/linux/iomap.h b/include/linux/iomap.h index a426cf35f40..9240ef443bd 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -105,4 +105,8 @@ iomap_seek_data(struct inode *inode, loff_t pos, const struct iomap_ops *ops) return -EOPNOTSUPP; } +#define iomap_bmap(m, b, o) ({ (void)(m); (void)(b); (void)(o); 0UL; }) +#define iomap_swapfile_activate(s, f, sp, o) \ + ({ (void)(s); (void)(f); (void)(sp); (void)(o); -EOPNOTSUPP; }) + #endif /* LINUX_IOMAP_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move setattr_prepare(), setattr_copy(), and posix_acl_chmod() stubs to linux/fs.h alongside the iattr structure and ATTR_* flags. This reduces ext4_uboot.h from 440 to 435 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 5 ----- include/linux/fs.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 2954723e2de..9ddd88d78aa 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -210,11 +210,6 @@ struct path; /* UID/GID bit helpers - use linux/highuid.h */ #include <linux/highuid.h> -/* Attribute operations */ -#define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) -#define setattr_copy(m, i, a) do { } while (0) -#define posix_acl_chmod(m, i, mo) ({ (void)(m); (void)(i); (void)(mo); 0; }) - /* File operations */ #define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) diff --git a/include/linux/fs.h b/include/linux/fs.h index 07fe8c5e711..0f3e44214c5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -356,6 +356,11 @@ struct iattr { #define ATTR_KILL_SGID (1 << 12) #define ATTR_TIMES_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) +/* Attribute operations - stubs for U-Boot */ +#define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) +#define setattr_copy(m, i, a) do { } while (0) +#define posix_acl_chmod(m, i, mo) ({ (void)(m); (void)(i); (void)(mo); 0; }) + /* writeback_control - defined in linux/compat.h */ /* fsnotify - stubs */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move these filesystem helpers to linux/fs.h where related functions reside. This reduces ext4_uboot.h from 435 to 431 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 4 ---- include/linux/fs.h | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 9ddd88d78aa..8d1aa0e504e 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -196,10 +196,6 @@ struct path; /* hash_64 - use linux/hash.h */ #include <linux/hash.h> -/* Dentry operations are now in linux/dcache.h */ -#define finish_open_simple(f, e) (e) -#define ihold(i) do { (void)(i); } while (0) - #include <linux/path.h> #include <linux/dax.h> diff --git a/include/linux/fs.h b/include/linux/fs.h index 0f3e44214c5..5b865715d51 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -570,12 +570,14 @@ int inode_generic_drop(struct inode *inode); struct inode *new_inode(struct super_block *sb); struct inode *iget_locked(struct super_block *sb, unsigned long ino); void iput(struct inode *inode); +#define ihold(i) do { (void)(i); } while (0) /* Block mapping - implemented in ext4l/stub.c */ int bmap(struct inode *inode, sector_t *block); /* Simple filesystem helpers */ #define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) +#define finish_open_simple(f, e) (e) /* simple_get_link - for fast symlinks stored in inode */ struct delayed_call; -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move this pathname lookup helper to linux/namei.h where it belongs. This reduces ext4_uboot.h from 431 to 425 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 6 ------ include/linux/namei.h | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 8d1aa0e504e..4e8c2199800 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -223,12 +223,6 @@ struct path; #define kfree_link kfree -/* nd_terminate_link - terminate symlink string */ -static inline void nd_terminate_link(void *name, loff_t len, int maxlen) -{ - ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; -} - /* * Additional stubs for super.c */ diff --git a/include/linux/namei.h b/include/linux/namei.h index 7b66fb242d6..10ea86dc49d 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -23,4 +23,12 @@ #define LOOKUP_EXCL 0x40000 /* Exclusive create */ #define LOOKUP_RENAME_TARGET 0x80000 /* Rename target */ +#include <linux/minmax.h> + +/* nd_terminate_link - terminate symlink string */ +static inline void nd_terminate_link(void *name, loff_t len, int maxlen) +{ + ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; +} + #endif /* _LINUX_NAMEI_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move the blk_holder_ops struct definition and fs_holder_ops to linux/blkdev.h where other block device operations reside. This reduces ext4_uboot.h from 425 to 420 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 6 ------ include/linux/blkdev.h | 5 ++++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 4e8c2199800..6f8c78bdeb0 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -269,12 +269,6 @@ void ext4_unregister_li_request(struct super_block *sb); /* I/O priority classes - use linux/ioprio.h */ #include <linux/ioprio.h> -/* blk_holder_ops for block device */ -struct blk_holder_ops { - void (*mark_dead)(struct block_device *, bool); -}; -static const struct blk_holder_ops fs_holder_ops; - /* end_buffer_write_sync - implemented in support.c */ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 89d284dab26..1ee5b33da72 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -83,7 +83,10 @@ void invalidate_bdev(struct block_device *bdev); unsigned int bdev_max_discard_sectors(struct block_device *bdev); /* Block device file operations - implemented in ext4l/stub.c */ -struct blk_holder_ops; +struct blk_holder_ops { + void (*mark_dead)(struct block_device *, bool); +}; +static const struct blk_holder_ops fs_holder_ops; void bdev_fput(void *file); void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, const struct blk_holder_ops *ops); -- 2.43.0
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(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6f8c78bdeb0..5c6a8711a9f 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -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)) diff --git a/include/linux/fs.h b/include/linux/fs.h index 5b865715d51..2fa12a40aa7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -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 diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 57a52769b05..1d1a0fcd6c1 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -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 diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 3aa71c1451f..969cf152a7c 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -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) diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h index 4b9bbfbe7e9..c62da091eba 100644 --- a/include/linux/prefetch.h +++ b/include/linux/prefetch.h @@ -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 */ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index ba674440c44..572ed2759bb 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.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 */ diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 7beaf5062ed..e3480b276b4 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.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) diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 7a105f768cb..956bbaf18a8 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -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 */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move definitions to their canonical Linux kernel locations: - WHITEOUT_DEV and WHITEOUT_MODE to linux/fs.h - kmem_cache_create_usercopy() to linux/slab.h Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 7 ------- include/linux/fs.h | 4 ++++ include/linux/slab.h | 2 ++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5c6a8711a9f..a7c7abf30b8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -151,9 +151,6 @@ struct pipe_inode_info; struct kstat; struct path; -#define WHITEOUT_DEV 0 -#define WHITEOUT_MODE 0 - /* QSTR_INIT and dotdot_name are now in linux/dcache.h */ #include <linux/minmax.h> @@ -283,10 +280,6 @@ void trace_ext4_error(struct super_block *sb, const char *func, unsigned int lin /* DAX - declaration for stub.c */ void fs_put_dax(void *dax, void *holder); -/* slab usercopy - use regular kmem_cache_create */ -#define kmem_cache_create_usercopy(n, sz, al, fl, uo, us, c) \ - kmem_cache_create(n, sz, al, fl, c) - /* Memory allocation - declarations for stub.c */ void *kvzalloc(size_t size, gfp_t flags); #define kvmalloc(size, flags) kvzalloc(size, flags) diff --git a/include/linux/fs.h b/include/linux/fs.h index 2fa12a40aa7..69178235141 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -397,6 +397,10 @@ static inline void inode_init_once(struct inode *inode) #define RENAME_EXCHANGE (1 << 1) #define RENAME_WHITEOUT (1 << 2) +/* Whiteout device - used for overlayfs */ +#define WHITEOUT_DEV 0 +#define WHITEOUT_MODE 0 + /* Superblock flags */ #define SB_RDONLY (1 << 0) /* Read-only mount */ #define SB_POSIXACL (1 << 16) /* POSIX ACL support */ diff --git a/include/linux/slab.h b/include/linux/slab.h index 628126e0a3b..6722450a5cc 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -126,6 +126,8 @@ struct kmem_cache { struct kmem_cache *get_mem(int element_sz); #define kmem_cache_create(a, sz, c, d, e) ({ (void)(a); (void)(e); get_mem(sz); }) +#define kmem_cache_create_usercopy(n, sz, al, fl, uo, us, c) \ + kmem_cache_create(n, sz, al, fl, c) /** * KMEM_CACHE - shorthand for creating a named kmem_cache -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move definitions to their canonical Linux kernel locations: - O_SYNC and S_NOQUOTA to linux/fs.h - kfree_link to linux/namei.h Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 5 ----- include/linux/fs.h | 4 ++++ include/linux/namei.h | 3 +++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index a7c7abf30b8..11d1d8b0d48 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 -#define O_SYNC 0 -#define S_NOQUOTA 0 - #ifndef PAGE_SHIFT #define PAGE_SHIFT 12 #endif @@ -210,8 +207,6 @@ struct path; #include <linux/delayed_call.h> -#define kfree_link kfree - /* * Additional stubs for super.c */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 69178235141..0d6da467026 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -387,6 +387,10 @@ static inline void inode_init_once(struct inode *inode) #define S_ENCRYPTED 64 /* Encrypted */ #define S_CASEFOLD 128 /* Case-folded */ #define S_VERITY 256 /* Verity enabled */ +#define S_NOQUOTA 0 /* No quota (stub) */ + +/* Open flags - stubs for U-Boot */ +#define O_SYNC 0 /* Permission mode constants */ #define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) diff --git a/include/linux/namei.h b/include/linux/namei.h index 10ea86dc49d..0b9000e8472 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -31,4 +31,7 @@ static inline void nd_terminate_link(void *name, loff_t len, int maxlen) ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; } +/* kfree_link - free a symlink target allocated with kmalloc */ +#define kfree_link kfree + #endif /* _LINUX_NAMEI_H */ -- 2.43.0
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(-) 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 {}; -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Move DEFINE_RAW_FLEX macro from ext4_uboot.h to linux/overflow.h where it belongs alongside struct_size() and other size helpers. In the kernel this macro allocates a flexible array struct on the stack. In U-Boot it is stubbed to NULL since the code paths that use it are not exercised. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 4 ---- include/linux/overflow.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index ad3e59a7f6c..04ed9c3c846 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -297,10 +297,6 @@ int sync_filesystem(void *sb); #include <asm-generic/timex.h> #include <linux/nospec.h> -/* 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 - /* * Stubs for page-io.c - bio types are in linux/bio.h */ diff --git a/include/linux/overflow.h b/include/linux/overflow.h index 672377ede42..75e8ad44ecf 100644 --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -20,4 +20,16 @@ #define struct_size(p, member, count) \ (sizeof(*(p)) + sizeof((p)->member[0]) * (count)) +/** + * DEFINE_RAW_FLEX() - Define a flexible array struct on the stack + * @type: Structure type containing flexible array + * @name: Variable name for the struct pointer + * @member: Name of the flexible array member + * @count: Number of elements + * + * In the kernel this allocates on stack; U-Boot stubs it to NULL. + */ +#define DEFINE_RAW_FLEX(type, name, member, count) \ + type *name = NULL + #endif /* _LINUX_OVERFLOW_H */ -- 2.43.0
From: Simon Glass <simon.glass@canonical.com> Reorganise ext4_uboot.h to: - Move all #include directives to the top of the file - Sort includes alphabetically within each section - Place BUG_ON/BUG override immediately after linux/bug.h - Sort forward declarations and function declarations alphabetically The include order is preserved where dependencies require it, particularly for no_printk and BUG_ON/BUG overrides which must come after certain headers are included. This reduces the file from 366 to 270 lines. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 402 ++++++++++++++++-------------------------- 1 file changed, 153 insertions(+), 249 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 04ed9c3c846..24402f21790 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -19,48 +19,52 @@ #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-variable" +/* U-Boot headers */ #include <div64.h> +#include <hexdump.h> +#include <u-boot/crc.h> +#include <vsprintf.h> + +/* Linux types - must come first */ #include <linux/types.h> -#include <linux/bitops.h> -#include <vsprintf.h> /* For panic() */ -#include <linux/string.h> -#include <linux/stat.h> + +/* Linux headers (alphabetical) */ #include <asm/byteorder.h> -#include <linux/errno.h> +#include <linux/bitops.h> +#include <linux/bug.h> +#include <linux/build_bug.h> +#include <linux/cred.h> #include <linux/err.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/init.h> +#include <linux/iomap.h> #include <linux/list.h> #include <linux/log2.h> -#include <linux/init.h> #include <linux/math64.h> -#include <linux/workqueue.h> -#include <linux/cred.h> -#include <linux/fs.h> -#include <linux/iomap.h> +#include <linux/minmax.h> +#include <linux/pagevec.h> +#include <linux/rbtree.h> #include <linux/seq_file.h> -#include <linux/rbtree.h> /* Real rbtree implementation */ -#include <linux/time.h> /* For timespec64, time64_t */ -#include <linux/pagevec.h> /* For struct folio_batch */ -#include <linux/build_bug.h> /* For BUILD_BUG_ON */ -#include <linux/bug.h> /* For WARN_ON, WARN_ONCE */ -#include <u-boot/crc.h> /* For crc32() used by crc32_be */ -#include "ext4_trace.h" /* Trace event stubs */ -#include "ext4_fscrypt.h" /* fscrypt stubs */ +#include <linux/stat.h> +#include <linux/string.h> +#include <linux/time.h> +#include <linux/workqueue.h> /* - * __CHAR_UNSIGNED__ - directory hash algorithm selection - * - * The ext4 filesystem uses different hash algorithms for directory indexing - * depending on whether the platform's 'char' type is signed or unsigned. - * GCC automatically defines __CHAR_UNSIGNED__ on platforms where char is - * unsigned (e.g., ARM), and leaves it undefined where char is signed - * (e.g., x86/sandbox). - * - * The filesystem stores EXT2_FLAGS_UNSIGNED_HASH or EXT2_FLAGS_SIGNED_HASH - * in the superblock to record which hash variant was used when the filesystem - * was created, ensuring correct behavior regardless of the mounting platform. - * - * See super.c:5123 and ioctl.c:1489 for the hash algorithm selection code. + * BUG_ON / BUG - stubs (not using linux/bug.h which panics) + * In Linux, these indicate kernel bugs. In ext4l, some BUG_ON conditions + * that check for race conditions can trigger in single-threaded U-Boot, + * so we stub them out as no-ops. */ +#undef BUG_ON +#undef BUG +#define BUG_ON(cond) do { (void)(cond); } while (0) +#define BUG() do { } while (0) + +/* Local ext4l headers */ +#include "ext4_fscrypt.h" +#include "ext4_trace.h" /* * Override no_printk to avoid format warnings in disabled debug prints. @@ -70,53 +74,111 @@ #undef no_printk #define no_printk(fmt, ...) ({ 0; }) +/* More Linux headers (alphabetical) */ #include <asm-generic/atomic.h> -#include <linux/jiffies.h> +#include <asm-generic/bitops/le.h> +#include <asm-generic/bitops/lock.h> +#include <asm-generic/timex.h> +#include <kunit/static_stub.h> +#include <linux/bio.h> #include <linux/blkdev.h> #include <linux/blk_types.h> +#include <linux/blockgroup_lock.h> +#include <linux/buffer_head.h> +#include <linux/cache.h> +#include <linux/capability.h> +#include <linux/completion.h> +#include <linux/crc16.h> +#include <linux/crc32c.h> +#include <linux/ctype.h> +#include <linux/dax.h> +#include <linux/dcache.h> +#include <linux/delayed_call.h> +#include <linux/exportfs.h> +#include <linux/fiemap.h> +#include <linux/fsmap.h> #include <linux/fs_context.h> #include <linux/fs_parser.h> -#include <linux/dcache.h> -#include <linux/uuid.h> -#include <linux/smp.h> -#include <linux/refcount.h> -#include <linux/spinlock.h> -#include <linux/percpu_counter.h> -#include <linux/percpu.h> -#include <linux/projid.h> +#include <linux/fsverity.h> +#include <linux/hash.h> +#include <linux/highuid.h> +#include <linux/hrtimer.h> +#include <linux/ioprio.h> +#include <linux/iversion.h> +#include <linux/jbd2.h> +#include <linux/jiffies.h> +#include <linux/kdev_t.h> #include <linux/kobject.h> +#include <linux/ktime.h> +#include <linux/list_sort.h> #include <linux/lockdep.h> -#include <linux/completion.h> -#include <linux/cache.h> -#include <linux/capability.h> -#include <linux/fiemap.h> -#include <linux/uio.h> +#include <linux/mbcache.h> +#include <linux/mempool.h> +#include <linux/mm_types.h> +#include <linux/mnt_idmapping.h> +#include <linux/module.h> +#include <linux/namei.h> +#include <linux/nospec.h> +#include <linux/overflow.h> +#include <linux/pagemap.h> +#include <linux/path.h> +#include <linux/percpu.h> +#include <linux/percpu_counter.h> +#include <linux/prefetch.h> +#include <linux/proc_fs.h> +#include <linux/projid.h> +#include <linux/quotaops.h> +#include <linux/random.h> +#include <linux/ratelimit.h> +#include <linux/rcupdate.h> +#include <linux/refcount.h> +#include <linux/rwsem.h> +#include <linux/sched.h> #include <linux/sched/mm.h> - -#define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 +#include <linux/shrinker.h> +#include <linux/slab.h> +#include <linux/smp.h> +#include <linux/sort.h> +#include <linux/spinlock.h> +#include <linux/statfs.h> +#include <linux/uio.h> +#include <linux/utsname.h> +#include <linux/uuid.h> +#include <linux/wait_bit.h> +#include <linux/writeback.h> +#include <linux/xarray.h> +#include <linux/xattr.h> /* - * BUG_ON / BUG - stubs (not using linux/bug.h which panics) - * In Linux, these indicate kernel bugs. In ext4l, some BUG_ON conditions - * that check for race conditions can trigger in single-threaded U-Boot, - * so we stub them out as no-ops. + * Hex dump - Linux kernel print_hex_dump has a different signature + * (includes log level) than U-Boot's, so we stub it out here. */ -#undef BUG_ON -#undef BUG -#define BUG_ON(cond) do { (void)(cond); } while (0) -#define BUG() do { } while (0) +#undef print_hex_dump +#define print_hex_dump(l, p, pt, rg, gc, b, len, a) do { } while (0) -#include <asm-generic/bitops/le.h> -#include <kunit/static_stub.h> -#include <linux/quotaops.h> -#include <linux/random.h> +/* + * __CHAR_UNSIGNED__ - directory hash algorithm selection + * + * The ext4 filesystem uses different hash algorithms for directory indexing + * depending on whether the platform's 'char' type is signed or unsigned. + * GCC automatically defines __CHAR_UNSIGNED__ on platforms where char is + * unsigned (e.g., ARM), and leaves it undefined where char is signed + * (e.g., x86/sandbox). + * + * The filesystem stores EXT2_FLAGS_UNSIGNED_HASH or EXT2_FLAGS_SIGNED_HASH + * in the superblock to record which hash variant was used when the filesystem + * was created, ensuring correct behavior regardless of the mounting platform. + * + * See super.c:5123 and ioctl.c:1489 for the hash algorithm selection code. + */ -#include <linux/rcupdate.h> -#include <linux/slab.h> +/* ext4-specific constants */ +#define EXT4_FIEMAP_EXTENT_HOLE 0x08000000 +#define EXT4_SUPER_MAGIC 0xEF53 -#include <linux/sched.h> -#include <linux/buffer_head.h> -#include <linux/jbd2.h> +#define EXT4_GOING_FLAGS_DEFAULT 0 +#define EXT4_GOING_FLAGS_LOGFLUSH 1 +#define EXT4_GOING_FLAGS_NOLOGFLUSH 2 /* * U-Boot buffer head private bits. @@ -134,143 +196,30 @@ BUFFER_FNS(OwnsData, ownsdata) #define BH_Cached (BH_JBDPrivateStart + 2) BUFFER_FNS(Cached, cached) -#include <linux/crc32c.h> -#include <linux/ratelimit.h> -#include <linux/mm_types.h> -#include <linux/mnt_idmapping.h> -#include <linux/rwsem.h> - /* Forward declarations */ -struct pipe_inode_info; +struct fid; struct kstat; +struct kstatfs; struct path; - -/* QSTR_INIT and dotdot_name are now in linux/dcache.h */ - -#include <linux/minmax.h> - -/* indirect.c stubs */ - -/* ext4_sb_bread_nofail is stubbed in interface.c */ - -/* extents_status.c stubs */ - -/* shrinker - use linux/shrinker.h */ -#include <linux/shrinker.h> - -/* ktime functions - use linux/ktime.h */ -#include <linux/ktime.h> - -/* hrtimer - use linux/hrtimer.h */ -#include <linux/hrtimer.h> - -/* folio and pagemap - use linux/pagemap.h */ -#include <linux/pagemap.h> -#include <linux/xarray.h> - -/* wbc_to_tag, WB_REASON_* - use linux/writeback.h */ -#include <linux/writeback.h> - -/* projid_t is now in linux/projid.h */ - -/* - * Additional stubs for inode.c - */ - -/* try_cmpxchg is now in asm-generic/atomic.h */ - -/* hash_64 - use linux/hash.h */ -#include <linux/hash.h> - -#include <linux/path.h> -#include <linux/dax.h> - -#include <linux/fsverity.h> -#include <linux/iversion.h> -#include <linux/kdev_t.h> - -/* UID/GID bit helpers - use linux/highuid.h */ -#include <linux/highuid.h> - -/* - * Additional stubs for dir.c - */ +struct pipe_inode_info; /* FSTR_INIT - fscrypt_str initializer (fscrypt_str defined in ext4_fscrypt.h) */ #define FSTR_INIT(n, l) { .name = (n), .len = (l) } -/* struct_size - use linux/overflow.h */ -#include <linux/overflow.h> - -#include <linux/delayed_call.h> - -/* - * Additional stubs for super.c - */ - /* Part stat - not used in U-Boot. Note: sectors[X] is passed as second arg */ -#define STAT_WRITE 0 #define STAT_READ 0 +#define STAT_WRITE 0 static u64 __attribute__((unused)) __ext4_sectors[2]; #define sectors __ext4_sectors #define part_stat_read(p, f) ({ (void)(p); (void)(f); 0ULL; }) -/* - * Hex dump - DUMP_PREFIX_* types are in hexdump.h. - * However, the Linux kernel print_hex_dump has a different signature - * (includes log level) than U-Boot's, so we stub it out here. - */ -#include <hexdump.h> -#undef print_hex_dump -#define print_hex_dump(l, p, pt, rg, gc, b, len, a) do { } while (0) - -/* Forward declarations for super_operations and export_operations */ -struct kstatfs; -struct fid; - -#include <linux/exportfs.h> -#include <linux/statfs.h> -#include <linux/module.h> - -/* EXT4_GOING flags */ -#define EXT4_GOING_FLAGS_DEFAULT 0 -#define EXT4_GOING_FLAGS_LOGFLUSH 1 -#define EXT4_GOING_FLAGS_NOLOGFLUSH 2 - -/* ext4 superblock initialisation and commit */ -int ext4_fill_super(struct super_block *sb, struct fs_context *fc); -int ext4_commit_super(struct super_block *sb); -void ext4_unregister_li_request(struct super_block *sb); - -#include <linux/ctype.h> - -#include <linux/crc16.h> -#include <linux/namei.h> - -/* I/O priority classes - use linux/ioprio.h */ -#include <linux/ioprio.h> - -/* end_buffer_write_sync - implemented in support.c */ -void end_buffer_write_sync(struct buffer_head *bh, int uptodate); - -#define EXT4_SUPER_MAGIC 0xEF53 - -/* blockgroup_lock - use linux/blockgroup_lock.h */ -#include <linux/blockgroup_lock.h> - -/* Buffer submission stubs - declaration for stub.c */ -int trylock_buffer(struct buffer_head *bh); - -/* Trace stubs for super.c - declaration for stub.c implementation */ -void trace_ext4_error(struct super_block *sb, const char *func, unsigned int line); - -/* ___ratelimit is now in linux/ratelimit.h */ - -/* kobject_put is now in linux/kobject.h */ -/* wait_for_completion is now a macro in linux/completion.h */ +/* CRC32 big-endian - map to U-Boot's crc32() */ +#define crc32_be(crc, p, len) crc32(crc, p, len) -/* DAX - declaration for stub.c */ -void fs_put_dax(void *dax, void *holder); +/* Memory allocation for journal.c */ +#define __get_free_pages(gfp, order) ((unsigned long)memalign(PAGE_SIZE, PAGE_SIZE << (order))) +#define free_pages(addr, order) free((void *)(addr)) +#define get_order(size) ilog2(roundup_pow_of_two((size) / PAGE_SIZE)) /* Memory allocation - declarations for stub.c */ void *kvzalloc(size_t size, gfp_t flags); @@ -280,87 +229,42 @@ void *kvzalloc(size_t size, gfp_t flags); unsigned long get_zeroed_page(gfp_t gfp); void free_page(unsigned long addr); -/* DAX - declaration for stub.c */ +/* DAX - declarations for stub.c */ void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); +void fs_put_dax(void *dax, void *holder); -#include <linux/mbcache.h> -#include <linux/xattr.h> +/* Buffer submission - declaration for stub.c */ +int trylock_buffer(struct buffer_head *bh); /* Filesystem sync - declaration for stub.c */ int sync_filesystem(void *sb); -/* - * Stubs for mballoc.c - */ - -#include <asm-generic/timex.h> -#include <linux/nospec.h> - -/* - * Stubs for page-io.c - bio types are in linux/bio.h - */ -#include <linux/bio.h> - -/* - * Stubs for readpage.c - */ - -#include <linux/mempool.h> - -#include <linux/prefetch.h> - -/* - * Stubs for fast_commit.c - */ +/* Trace stubs for super.c - declaration for stub.c */ +void trace_ext4_error(struct super_block *sb, const char *func, unsigned int line); -/* Wait bit operations - use linux/wait_bit.h */ -#include <linux/wait_bit.h> +/* end_buffer_write_sync - implemented in support.c */ +void end_buffer_write_sync(struct buffer_head *bh, int uptodate); -/* JBD2 checkpoint.c and commit.c stubs */ -#include <asm-generic/bitops/lock.h> -/* smp_mb__after_atomic is now in linux/smp.h */ -#define crc32_be(crc, p, len) crc32(crc, p, len) +/* ext4 superblock initialisation and commit */ +int ext4_commit_super(struct super_block *sb); +int ext4_fill_super(struct super_block *sb, struct fs_context *fc); +void ext4_unregister_li_request(struct super_block *sb); /* ext4l support functions (support.c) */ -void ext4l_crc32c_init(void); -void bh_cache_release_jbd(void); -void bh_cache_clear(void); int bh_cache_sync(void); int ext4l_read_block(sector_t block, size_t size, void *buffer); int ext4l_write_block(sector_t block, size_t size, void *buffer); -void ext4l_msg_init(void); -void ext4l_record_msg(const char *msg, int len); struct membuf *ext4l_get_msg_buf(void); +void bh_cache_clear(void); +void bh_cache_release_jbd(void); +void ext4l_crc32c_init(void); +void ext4l_msg_init(void); void ext4l_print_msgs(void); +void ext4l_record_msg(const char *msg, int len); /* ext4l interface functions (interface.c) */ struct blk_desc *ext4l_get_blk_dev(void); struct disk_partition *ext4l_get_partition(void); -#include <linux/proc_fs.h> - -/* Memory allocation for journal.c */ -#define __get_free_pages(gfp, order) ((unsigned long)memalign(PAGE_SIZE, PAGE_SIZE << (order))) -#define free_pages(addr, order) free((void *)(addr)) -#define get_order(size) ilog2(roundup_pow_of_two((size) / PAGE_SIZE)) - -/* - * Stubs for mmp.c - */ - -/* init_utsname - use linux/utsname.h */ -#include <linux/utsname.h> - -/* - * Stubs for fsmap.c - */ - -/* fsmap is now in linux/fsmap.h */ -#include <linux/fsmap.h> - -/* list_sort and sort for fsmap.c */ -#include <linux/list_sort.h> -#include <linux/sort.h> - #endif /* __EXT4_UBOOT_H__ */ -- 2.43.0
participants (1)
-
Simon Glass