5 Commits

Author SHA1 Message Date
Simon Glass
c113b81eab jbd2: Add checkpoint.c to the build
Update checkpoint.c includes to use ext4_uboot.h compatibility layer.
Add jbd2/Makefile and include jbd2 in the build via fs/Makefile

Add necessary stubs and definitions:
- JBD2 trace stubs (trace_jbd2_checkpoint, etc.)
- mutex_lock_io, write_dirty_buffer, spin_needbreak stubs
- bd_dev field to struct block_device
- Temporary JBD2 function stubs until other jbd2 files are added

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-21 14:15:36 -07:00
Simon Glass
b45cae614c ext4l: Add file.c to build
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>
2025-12-21 11:36:34 +00:00
Simon Glass
e3f8042575 ext4l: Add inode.c to build
Add inode.c to the Makefile with minimal changes:
- Replace Linux kernel includes with ext4_uboot.h
- Add cast in ext4_inode_peek_iversion() to fix const qualifier warning
- Add __maybe_unused to variables in ext4_print_free_blocks()

Update ext4_uboot.h with additional stubs needed by inode.c:
- address_space_operations: add migrate_folio, swap_activate members,
  fix write_begin/write_end/writepages signatures
- Add buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio

Add stub functions in stub.c for inode.c dependencies:
- Inline data: ext4_try_to_write_inline_data, ext4_generic_write_inline_data,
  ext4_write_inline_data_end
- xattr: ext4_xattr_delete_inode, ext4_xattr_inode_array_free
- JBD2: jbd2_inode_cache, jbd2_journal_try_to_free_buffers,
  jbd2_journal_init_jbd_inode

Also add required stub headers:
- linux/mpage.h - multi-page I/O stub
- linux/rmap.h - reverse mapping stub
- linux/atomic.h - atomic operations stub

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
f04cd9dbc2 ext4l: Add extents.c compilation support
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>
2025-12-18 12:34:17 -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