[Concept,07/10] ext4l: Add kiocb, iov_iter structures and IOCB_* constants

Message ID 20251220232355.845414-8-sjg@u-boot.org
State New
Headers
Series ext4l: Add more ext4 files to the build (part D) |

Commit Message

Simon Glass Dec. 20, 2025, 11:23 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add infrastructure needed for file.c and other VFS-integrated files:

- Add struct kiocb (kernel I/O control block)
- Add struct iov_iter forward declaration
- Add IOCB_DIRECT, IOCB_NOWAIT, IOCB_ATOMIC constants
- Add iov_iter_truncate, iov_iter_count, iov_iter_alignment stubs
- Remove ext4_init_acl macro (provided by acl.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 | 23 +++++++++++++++++++----
 fs/ext4l/ialloc.c     |  1 +
 2 files changed, 20 insertions(+), 4 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 1d0c58c4f38..ea28d0fcc63 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -181,6 +181,24 @@  struct file_ra_state {
 
 /* struct file is defined in linux/fs.h */
 
+/* kiocb - kernel I/O control block */
+struct iov_iter;
+
+struct kiocb {
+	int ki_flags;
+	struct file *ki_filp;
+	loff_t ki_pos;
+};
+
+#define IOCB_DIRECT		0x0001
+#define IOCB_NOWAIT		0x0002
+#define IOCB_ATOMIC		0x0004
+
+/* iov_iter stubs */
+#define iov_iter_truncate(i, count)	do { } while (0)
+#define iov_iter_count(i)		0
+#define iov_iter_alignment(iter)	0
+
 /* __counted_by attribute - not available in U-Boot */
 #define __counted_by(x)
 
@@ -378,10 +396,7 @@  extern struct user_namespace init_user_ns;
 #define fscrypt_prepare_new_inode(dir, i, e)	({ (void)(dir); (void)(i); (void)(e); 0; })
 #define fscrypt_set_context(inode, handle)	({ (void)(inode); (void)(handle); 0; })
 
-/* ACL and security stubs - only if acl.h won't be included */
-#ifndef _FS_EXT4_ACL_H
-#define ext4_init_acl(h, i, d)			({ (void)(h); (void)(i); (void)(d); 0; })
-#endif
+/* ext4_init_acl is provided by acl.h */
 /* xattr stubs for files that don't include xattr.h */
 struct super_block;
 struct buffer_head;
diff --git a/fs/ext4l/ialloc.c b/fs/ext4l/ialloc.c
index d72204a5d02..5bbe8d6d359 100644
--- a/fs/ext4l/ialloc.c
+++ b/fs/ext4l/ialloc.c
@@ -17,6 +17,7 @@ 
 #include "ext4.h"
 #include "ext4_jbd2.h"
 #include "xattr.h"
+#include "acl.h"
 
 /*
  * ialloc.c contains the inodes allocation and deallocation routines