5 Commits

Author SHA1 Message Date
Simon Glass
593b2d9dd4 ext4l: Add mballoc.c to build
Add the multiblock allocator (mballoc.c) to the build. This implements
the ext4 block allocation routines.

Stubs added for:
- Per-CPU operations (simplified to single-threaded)
- XArray operations
- RCU list operations
- Block device properties
- Various trace functions
- Atomic operations (atomic_sub, atomic64_sub, atomic_inc_return)
- WARN_RATELIMIT, folio_get, array_index_nospec
- seq_operations for procfs
- DEFINE_RAW_FLEX macro

Remove stub functions that are now properly implemented:
- ext4_mb_new_blocks
- ext4_free_blocks
- ext4_discard_preallocations
- ext4_mb_mark_bb

Add ext4_fc_replay_check_excluded stub for fast commit replay.
Add file member to struct seq_file for procfs compatibility.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-21 11:36:34 +00:00
Simon Glass
b074a781fc linux: Convert timer/workqueue stubs to static inline functions
Convert most of the stub macros in timer.h and workqueue.h to static
inline functions for better type checking. Keep macros for functions
that take callback pointers (setup_timer, timer_setup, INIT_WORK,
INIT_DELAYED_WORK, del_timer_sync) since some callers pass functions
that are conditionally compiled out.

Fixes: 3b4667ed88 ("ext4l: Add super.c to build")

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:53:23 -07:00
Simon Glass
3b4667ed88 ext4l: Add super.c to build
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>
2025-12-20 14:09:14 -07:00
Simon Glass
166dcda718 linux: Add compatibility headers for ext4l
Add stub headers to support ext4l filesystem compilation:

New headers:
- bit_spinlock.h: bit-based spinlock stubs
- blkdev.h: block device structures and operations
- buffer_head.h: buffer head management with state functions
- crc32c.h: CRC32C checksum stub
- fs.h: filesystem structures (super_block, inode operations)
- journal-head.h: journal buffer head structure
- mutex.h: mutex stubs

Updates to existing headers:
- compat.h: add rcu_head callback structure
- jbd2.h: add wait.h and init.h includes for types
- sched.h: add current task stub
- workqueue.h: fix flush_work macro warning

These provide the minimal Linux kernel interfaces needed for
ext4 code to compile in U-Boot's single-threaded environment.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
205d4bc100 ext4l: Extract timer declarations into their own file
Create include/linux/timer.h and include/linux/workqueue.h with stub
definitions for kernel timer and workqueue support. U-Boot doesn't use
these subsystems.

timer.h:
- struct timer_list
- setup_timer(), del_timer(), del_timer_sync()
- timer_setup(), mod_timer(), timer_pending()

workqueue.h:
- struct work_struct, struct delayed_work
- INIT_WORK(), schedule_work()
- queue_work(), cancel_work_sync()
- alloc_workqueue(), destroy_workqueue()

Update compat.h to include these headers and remove duplicate
definitions.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-17 14:01:22 +00:00