Add the ext4 inline data implementation file to the build.
Add stubs to ext4_uboot.h:
- FGP_WRITEBEGIN flag (combined from FGP_LOCK | FGP_WRITE | FGP_CREAT |
FGP_STABLE)
- kmap_local_folio, kunmap_local for memory mapping
- folio_zero_tail, folio_zero_segment for folio zeroing
- mapping_gfp_mask for address space GFP mask
Remove obsolete inline data stubs from stub.c that are now provided
by inline.c.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add symlink.c which provides symlink inode operations.
Changes needed:
- Add ext4_uboot.h include to symlink.c
- Add delayed_call struct and set_delayed_call macro
- Add kfree_link definition
- Add nd_terminate_link helper function
- Add get_link member to inode_operations struct
- Add simple_get_link function for fast symlinks
- Add i_link field to struct inode
- Add fscrypt_get_symlink and fscrypt_symlink_getattr stubs
- Add ext4_read_inline_link stub
- Remove ext4_symlink_inode_operations and
ext4_fast_symlink_inode_operations stubs from stub.c
Drop some duplicate declarations in ext4_uboot.h
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add file.c which provides file operations for ext4l filesystem.
Changes needed for file.c support:
- Add i_writecount and i_rwsem fields to struct inode
- Add IOMAP_DIO_* flags to linux/iomap.h
- Add vm_operations_struct definition
- Add VM flags (VM_SHARED, VM_HUGEPAGE, etc.)
- Add vm_area_desc and pipe_inode_info structures
- Add FMODE_* flags and SEEK_HOLE/SEEK_DATA to linux/fs.h
- Add vfsmount, path structs and f_path to struct file
- Add inode_trylock*, lockdep_assert_held_write macros
- Add filemap_fault, filemap_map_pages stubs
- Add inode_operations struct definition
- Add various stubs: d_path, fscrypt_file_open, fsverity_file_open,
dquot_file_open, sb_start_intwrite_trylock, ext4_listxattr
Simplify ext4_file_operations and ext4_file_inode_operations
initializers to use only the members defined in U-Boot's structs.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add super.c to the ext4l Makefile and provide the infrastructure
needed to compile it:
- Add stubs for block device operations (bdev_file_open_by_dev,
bdev_fput, bdev_getblk, submit_bh, trylock_buffer)
- Add stubs for NFS export helpers (generic_fh_to_dentry/parent)
- Add stubs for filesystem operations (sync_filesystem, dquot_suspend)
- Add stubs for string operations (strreplace, strtomem_pad)
- Add stubs for memory allocation (alloc_inode_sb, kvzalloc)
- Add stubs for ratelimit, workqueue, and trace functions
- Add fs_context and fs_parameter structures for mount options
- Add blk_holder_ops structure for block device holder operations
- Add pragma to suppress unused function/variable warnings
- Add __maybe_unused to __init/__exit macros in init.h
The only change to super.c itself is replacing the Linux kernel
includes with the U-Boot compatibility header ext4_uboot.h.
Series-to: concept
Cover-letter:
ext4l: Add more ext4 files to the build (part D)
This series continues the ext4l port by adding super.c to the build. The
super.c file contains the superblock operations and filesystem
registration code from the kernel's ext4 driver.
To support this effort compilation, this series adds numerous stubs and
compatibility shims for Linux kernel interfaces not available in
U-Boot, including block device operations, filesystem context
handling, NFS export helpers, and various utility functions.
In particular, fs/ext4l/ext4_uboot.h contains a lot of U-Boot specific
declarations and stubs, with fs/ext4l/stub.c containing various others.
The goal is to eventually have a fully functional ext4 implementation
ported from Linux that can be used for both reading and writing ext4
filesystems in U-Boot.
END
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add dir.c to the Makefile and provide necessary stubs:
- Replace Linux includes with ext4_uboot.h
- Add fscrypt directory operation stubs
- Add readahead, inode version, and dir_emit stubs
- Add struct file_operations with needed members
- Add generic_read_dir, ext4_llseek, ext4_htree_fill_tree stubs
- Add ext4_ioctl, ext4_sync_file, ext4_dirblock_csum_verify stubs
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add xattr_user.c and xattr_hurd.c to the ext4l build:
- Update includes to use ext4_uboot.h
- Add d_sb member to struct dentry
- Add XATTR_HURD_PREFIX to linux/xattr.h
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add xattr_trusted.c to the ext4l build with necessary changes:
- Update xattr_trusted.c includes to use ext4_uboot.h
- Add xattr.h include to ialloc.c for ext4_init_security
- Remove duplicate ext4_init_security declaration from ext4_uboot.h
(now provided by xattr.h inline stub)
- Add ext4_xattr_get and ext4_xattr_set stubs
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add orphan.c to the ext4l build and fix various build issues:
- Add atomic_inc/atomic_dec macros to ext4_uboot.h
- Add s_flags member to struct super_block and SB_RDONLY constant
- Add bdev_read_only() stub function
- Add kvfree() and kvmalloc_array() to linux/slab.h
- Add stub functions for orphan.c: ext4_reserve_inode_write,
ext4_superblock_csum_set, ext4_mark_iloc_dirty, ext4_truncate,
ext4_feature_set_ok, ext4_bread
- Fix orphan.c to use U-Boot include pattern
- Remove linux/atomic.h include from buffer_head.h (types provided
by ext4_uboot.h)
- Add kunit/static_stub.h and linux/nospec.h stub headers
- Simplify seq_file.h macros
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add stub declarations and implementations for xattr functions that
ialloc.c calls but which are defined in xattr.c (not yet compiled):
- __ext4_xattr_set_credits
- ext4_init_security
Add declarations to ext4_uboot.h and implementations to stub.c.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Mark variables as __maybe_unused where they are only used in macro
calls that expand to no-ops in U-Boot's single-threaded environment:
- tree in ext4_es_try_to_merge_left/right
- es_stats in ext4_seq_es_shrinker_info_show
- ei in ext4_clear_inode_es, ext4_remove_pending, ext4_is_pending
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add the extent status tree implementation to the ext4l build. This
module tracks extent status in memory to support delayed allocation
and SEEK_DATA/SEEK_HOLE operations.
Changes:
- Add extents_status.o to Makefile
- Add include guard to acl.h
- Add shrinker, ktime, and ratelimit stubs to ext4_uboot.h
- Guard iomap definitions in ext4_uboot.h when iomap.h is included
- Guard dquot macros when quotaops.h is included
- Remove stub functions now provided by extents_status.c
- Add ext4_da_release_space/update_reserve_space stubs
Series-to: u-boot
Cover-letter:
ext4l: Adjust some of the smaller files (part C)
This series makes various changes to allow some of the ext4l files to
compile successfully.
It provides a basic Kconfig to allow selecting ext4l (ext4 from Linu)
instead of the existing ext4 implementation.
To reduce the large number of include/linux files somewhat and to avoid
exceesive diffs against the Linux files, a new ext4_uboot.h header is
created. This will expand over time.
END
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add extents.c (extent handling) to the build and provide stubs.
Changes to extents.c:
- Replace Linux includes with ext4_uboot.h
Changes to ext4_uboot.h:
- Add __GFP_MOVABLE, __GFP_FS memory allocation flags
- Add FIEMAP_EXTENT_* flags for fiemap operations
- Add FALLOC_FL_* flags for fallocate operations
- Add O_SYNC flag and struct file with f_mapping
- Add struct iomap and iomap_ops for I/O mapping
- Add IOMAP_* type constants
- Add struct fiemap_extent_info and FIEMAP_FLAG_* constants
- Add i_blkbits member to inode struct
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add balloc.c (block allocation) to the build and provide stubs.
Changes to balloc.c:
- Replace Linux includes with ext4_uboot.h
Changes to mballoc.h:
- Replace Linux includes with ext4_uboot.h
Changes to ext4_uboot.h:
- Add REQ_META, REQ_PRIO, REQ_RAHEAD block I/O request flags
- Add CAP_SYS_ADMIN, CAP_SYS_RESOURCE capability stubs
- Add capable() stub that always returns true
- Add s_id member to super_block struct
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add ext4_jbd2.c to the build and provide the necessary stubs. To avoid
build warnings while we build out the required interfacing, start a new
stub.c file containing empty functions.
Changes to ext4_jbd2.c:
- Remove trace/events/ext4.h include (not needed)
- Stub out ext4_check_bdev_write_error() since U-Boot lacks async
I/O error tracking
- Add return after BUG() to silence non-void function warning
Changes to ext4_jbd2.h:
- Include ext4_uboot.h instead of linux/fs.h
Changes to ext4_uboot.h:
- Add sb_writers struct and SB_FREEZE constants
- Add _RET_IP_ macro
- Add mapping_large_folio_support() stub
- Add WARN_ON_ONCE/WARN_ON as proper stubs
- Add BUG(), might_sleep(), sb_rdonly() stubs
- Add trace function stubs
- Add buffer operation stubs (wait_on_buffer, mark_buffer_dirty, etc.)
- Add inode_needs_sync stub
- Include linux/sched.h for current task
Changes to include/linux/buffer_head.h:
- Add inline bh_*_bit functions for buffer state management
- Use bh_ prefixed functions in BUFFER_FNS/TAS_BUFFER_FNS macros
Changes to include/linux/fs.h:
- Add bd_disk to block_device struct
Changes to include/linux/workqueue.h:
- Fix flush_work macro to avoid unused value warning
Add stub functions to interface.c for jbd2 journal functions:
- jbd2__journal_start, jbd2_journal_stop
- jbd2_journal_free_reserved, jbd2_journal_start_reserved
- jbd2_journal_extend, jbd2_journal_get_write_access
- jbd2_journal_set_triggers, jbd2_journal_forget
- jbd2_journal_revoke, jbd2_journal_get_create_access
- jbd2_journal_dirty_metadata
- __ext4_error, __ext4_std_error, ext4_decode_error
Keep full Linux jbd2.h with compatibility header includes.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Move mutex definitions from compat.h to a dedicated mutex.h header,
matching the Linux structure.
U-Boot is single-threaded so mutexes are no-ops. The new header provides
struct mutex and mutex_init/lock/unlock stubs.
Update compat.h to include linux/mutex.h.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add hash.c to the ext4l build with required compatibility headers.
Create ext4_uboot.h with minimal definitions needed for hash.c:
- rol32() rotation function
- struct inode and super_block stubs
- struct qstr and dx_hash_info for directory hashing
- DX_HASH_* constants and EXT4_HTREE_EOF_32BIT
- fscrypt stub functions (encryption not supported)
- ext4_warning macros (stubbed out)
Modify hash.c to use ext4_uboot.h instead of Linux kernel headers.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add the basic build infrastructure for the ext4l filesystem:
- Add FS_EXT4L Kconfig option in fs/ext4l/Kconfig
- Add ext4l to fs/Kconfig and fs/Makefile
- Add fstype_info entry in fs_legacy.c with unsupported stubs
- Add minimal interface.c with stub probe/close functions
This allows sandbox to build with CONFIG_FS_EXT4L=y. The filesystem
doesn't work yet - all operations return unsupported.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Create include/linux/module.h with stub definitions for kernel module
support. U-Boot doesn't use loadable modules, so these are no-ops.
Includes:
- THIS_MODULE, try_module_get(), module_put()
- module_init(), module_exit()
- module_param() and variants
- MODULE_* macros (LICENSE, AUTHOR, DESCRIPTION, etc.)
Update compat.h to include module.h and remove duplicate definitions.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Copy Kconfig and Makefile from Linux v6.18 fs/ext4 directory.
- Kconfig: configuration options for ext4
- Makefile: build rules
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy indirect.c and inline.c from Linux v6.18 fs/ext4 directory.
- indirect: indirect block mapping for ext2/ext3 compatibility
- inline: inline data support for small files stored in inode
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy ext4_jbd2.c, ext4_jbd2.h, fast_commit.c, and fast_commit.h from
Linux v6.18 fs/ext4 directory.
- ext4_jbd2: ext4-specific JBD2 journal interface wrappers
- fast_commit: fast commit journal optimization
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy extents_status.c, extents_status.h, fsync.c, and hash.c from
Linux v6.18 fs/ext4 directory.
- extents_status: extent status tree for tracking extent state
- fsync: file synchronization operations
- hash: directory entry hashing for htree directories
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy ext4.h from Linux v6.18 fs/ext4 directory. This is the main header
file defining structures, constants, and function prototypes for ext4.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy super.c from Linux v6.18 fs/ext4 directory. This file implements
superblock operations including mount, unmount, and filesystem options.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy namei.c from Linux v6.18 fs/ext4 directory. This file implements
directory operations including lookup, create, link, unlink, and rename.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy mballoc.c from Linux v6.18 fs/ext4 directory. This file implements
the multiblock allocator for efficient block allocation.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy inode.c from Linux v6.18 fs/ext4 directory. This file implements
inode operations including reading, writing, and truncating files.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Copy extents.c and ext4_extents.h from Linux v6.18 fs/ext4 directory.
These files implement the extent-based block mapping used by ext4.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Convert all __u8, __u16, and __u32 types to their u8, u16, u32
equivalents throughout the FAT filesystem code.
Series-to: u-boot
Series-cc: heinrich
Cover-letter:
fat: Some code improvements
This is an attempt to improve the structure of the FAT code, since it
doesn't fully follow the U-Boot conventions:
- fat_write.c includes fat.c which is odd
- use of __u32 and its ilk
- use of typedef
- old-style struct comments
This series resolves these problems, making it easier to take on other
improvements in future.
END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Convert the struct fat_itr documentation from the older style with
separate @field comments to the standard kernel-doc style where field
descriptions are listed in the header comment block.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Currently fat_write.c includes fat.c directly, which is unusual and
makes the code harder to maintain. Use the internal header file to hold
shared functions, to avoid this.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
As a first step towards separating fat.c from fat_write.c, create a
header file for the definitions.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
Add a Kconfig optiion to enable this library and add it to the lib/
Makefile, being careful to avoid a conflict with the existing blake2b
implementation.
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This function is used by the EFI loader but we want to avoid it for the
app, since it records global state.
We don't intend to support running arbitrary EFI apps outside of a
bootstd context, so drop this call for the EFI app.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present a new directory device is created for every access to a
directory. This means that a new device is always created when 'ls' is
used.
Where the directory being accessed matches an existing device, this is
not necessary.
Check that path against existing directories and reuse the device if
possible.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is easier to use an empty string when the root directory is intended.
Adjust the code to drop use of "/" and NULL and just use and empty
string.
Signed-off-by: Simon Glass <sjg@chromium.org>
This name matches the ARM name and 'emulation' is not really a vendor.
Use ARCH_QEMU_X86 instead, moving that option from its existing location.
Signed-off-by: Simon Glass <sjg@chromium.org>