[Concept,02/12] linux: uio: Add kiocb struct and IOCB_* flags

Message ID 20260118133734.2.861096498c0facf7fca51f6e79e6cd37a9c5e73d@changeid
State New
Headers
Series ext4l: Continue reducing ext4_uboot.h size with more headers |

Commit Message

Simon Glass Jan. 18, 2026, 8:37 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Add the kernel I/O control block (kiocb) structure and associated flags
to uio.h, and update ext4_uboot.h to use the header instead of
duplicating these definitions.

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/uio.h   | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 17 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 80a1c5c6bc9..937c819a3f0 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -164,23 +164,8 @@  typedef struct { unsigned int val; } kprojid_t;
 
 /* 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
+/* kiocb, iov_iter - use linux/uio.h */
+#include <linux/uio.h>
 
 /* __counted_by attribute - not available in U-Boot */
 #define __counted_by(x)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index cb050705597..e347d318c60 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -63,4 +63,23 @@  static inline size_t iov_iter_alignment(const struct iov_iter *i)
 	return 0;  /* Stub - assume aligned */
 }
 
+/**
+ * struct kiocb - kernel I/O control block
+ * @ki_flags: I/O flags
+ * @ki_filp: file pointer
+ * @ki_pos: file position
+ *
+ * U-Boot stub for asynchronous I/O control.
+ */
+struct kiocb {
+	int ki_flags;
+	struct file *ki_filp;
+	loff_t ki_pos;
+};
+
+/* kiocb flags */
+#define IOCB_DIRECT		0x0001
+#define IOCB_NOWAIT		0x0002
+#define IOCB_ATOMIC		0x0004
+
 #endif /* __LINUX_UIO_H */