From patchwork Sat Dec 20 23:23:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1002 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273083; bh=xe876T9jpX4WvVdRhMX7PuOKM4VKWDTsY8ANiySOdM0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=p3yZm2gXFP4qDl4UcJo++aOQQvhbFBBXPDvNJy5hsS64gmvTeW9anXrIxXq07qXvq /TiBxfUVyzQshnXB5JeGRBvHkmWrYZuvTF2m+wQv2dHFSc38vpLNRfkF66IFXAuyno MXPxv1TSwHsZN1llqjNf4yO8hvZhJQalPwIDWEIBKG2mYO2O5aw5wDki5NCJlKrpgl bzYo8UK/gXgmtrtwqCosnZdbeZ/d3vQXTfbDoofiImKPX8eF39PbQZSx1hKCTa0UcD vpSWhTee3vGiswj2fv6JueJkOSJf7D3S74D6yFP1vPVCxG7yT2tNNVo/WQxiC2T9kh MTbCvUyV2Ovsg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 97A5564C60 for ; Sat, 20 Dec 2025 16:24:43 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3AagqUcJIOAA for ; Sat, 20 Dec 2025 16:24:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273083; bh=xe876T9jpX4WvVdRhMX7PuOKM4VKWDTsY8ANiySOdM0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=p3yZm2gXFP4qDl4UcJo++aOQQvhbFBBXPDvNJy5hsS64gmvTeW9anXrIxXq07qXvq /TiBxfUVyzQshnXB5JeGRBvHkmWrYZuvTF2m+wQv2dHFSc38vpLNRfkF66IFXAuyno MXPxv1TSwHsZN1llqjNf4yO8hvZhJQalPwIDWEIBKG2mYO2O5aw5wDki5NCJlKrpgl bzYo8UK/gXgmtrtwqCosnZdbeZ/d3vQXTfbDoofiImKPX8eF39PbQZSx1hKCTa0UcD vpSWhTee3vGiswj2fv6JueJkOSJf7D3S74D6yFP1vPVCxG7yT2tNNVo/WQxiC2T9kh MTbCvUyV2Ovsg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 863D764C46 for ; Sat, 20 Dec 2025 16:24:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273081; bh=JPCAhVeJj84KSHi3dnX/PTDwYNm7tA9f7TeR8rQ+hqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzlxvvUs+LnqGkJOMBp+u8ZySIwZAyKSo6/zA7rCSSKgyTJQzDLycMaglwOkVJXF4 1fwYGmcLA4Te6w13cnDesBEJhHYJZY/XAzX4RnfWqSYJnmC6iCAUr5xCoH5zAPSO0k ElvkuOfCcJmt/DLvLZ0x6+paO1gEsvNnpRKT+ngv+E4utveoVzxSk+FEKSInNg/P3X tknwzkLjAXP8fuq76Ag7RLhc0mEU1B/fRznhuarUasQMIvGhP+BrXHgbHYH4On1sAN DBz31KYd87t8nfgpKr44YrMgIR06UjAqnOKy8EfbX1WXJs9kxCXk7NtywyU7/6NPJB ew5xcAgrRMV1w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 888AC64C56; Sat, 20 Dec 2025 16:24:41 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id h7cihC2AsbZs; Sat, 20 Dec 2025 16:24:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273080; bh=BG1tNiIvky6qRp4tpKyYBzT2XIJ988ECIs34FNkqiRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OOSOhQX8ZebEgeC67x1erEJ02atSsGxaM3Pjj8Sm+wlj7FrE2R/nkASMAETtROW48 sEjaouh/Zog6GRND3D3eaRyL/svrUdenTXZUXvTmyOyh2/FXemKfvuzHDOtBNuNvKa HTE81OYMDo/4sSzOCjx5JmvH4Q8nwTkn+xhHTSBDHQiNvCLdszYhb8t5jh62raKQK7 W8e661nqUZb0bDU+6wV5EJq50eSWdW012iso+03vI3QtKHEQ2hPEKh8CxBN2rcxqDE ZzsrWKcN6OMGxJwAPb+WJewaMV3uLFeUui6WXpuLT6FlZgtYMG7RmkoF3lsGBRqWI0 3HWCSwFCFzwpA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2C6DC64C29; Sat, 20 Dec 2025 16:24:40 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:49 -0700 Message-ID: <20251220232355.845414-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QOGMDOZ3WRL4X3TF3KARZPC5SANFTXOD X-Message-ID-Hash: QOGMDOZ3WRL4X3TF3KARZPC5SANFTXOD X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/10] ext4l: Add dir.c to build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/dir.c | 6 +----- fs/ext4l/ext4_uboot.h | 49 +++++++++++++++++++++++++++++++++++++++++++ fs/ext4l/stub.c | 48 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 98 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index f9c0f77b8ed..28d483a7810 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -5,7 +5,7 @@ obj-y := interface.o stub.o -obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \ +obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ extents_status.o hash.o ialloc.o \ indirect.o inode.o \ xattr_hurd.o xattr_trusted.o \ diff --git a/fs/ext4l/dir.c b/fs/ext4l/dir.c index d4164c507a9..9c4b853defa 100644 --- a/fs/ext4l/dir.c +++ b/fs/ext4l/dir.c @@ -22,11 +22,7 @@ * */ -#include -#include -#include -#include -#include +#include "ext4_uboot.h" #include "ext4.h" #include "xattr.h" diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 3f11fb47544..5380b7ed701 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1402,4 +1402,53 @@ static inline unsigned int i_gid_read(const struct inode *inode) #define truncate_inode_pages_final(m) do { } while (0) #define truncate_pagecache_range(i, s, e) do { } while (0) +/* + * Additional stubs for dir.c + */ + +/* fscrypt_str - encrypted filename string */ +#define FSTR_INIT(n, l) { .name = (n), .len = (l) } + +/* fscrypt directory operations */ +#define fscrypt_prepare_readdir(i) ({ (void)(i); 0; }) +#define fscrypt_fname_alloc_buffer(len, buf) ({ (void)(len); (void)(buf); 0; }) +#define fscrypt_fname_free_buffer(buf) do { (void)(buf); } while (0) +#define fscrypt_fname_disk_to_usr(i, h1, h2, d, u) ({ (void)(i); (void)(h1); (void)(h2); (void)(d); (void)(u); 0; }) + +/* Readahead operations */ +#define ra_has_index(ra, idx) ({ (void)(ra); (void)(idx); 0; }) +#define page_cache_sync_readahead(m, ra, f, i, n) do { } while (0) + +/* Inode version operations */ +#define inode_eq_iversion(i, v) ({ (void)(i); (void)(v); 1; }) +#define inode_query_iversion(i) ({ (void)(i); 0ULL; }) + +/* Directory context operations */ +#define dir_emit(ctx, name, len, ino, type) ({ (void)(ctx); (void)(name); (void)(len); (void)(ino); (void)(type); 1; }) +#define dir_relax_shared(i) ({ (void)(i); 1; }) + +/* File llseek */ +#define generic_file_llseek_size(f, o, w, m, e) ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) + +/* generic_read_dir - stub function (needs to be a real function for struct init) */ +ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, + loff_t *ppos); + +/* struct_size helper */ +#define struct_size(p, member, count) (sizeof(*(p)) + sizeof((p)->member[0]) * (count)) + +/* file_operations - extended for dir.c */ +struct file_operations { + int (*open)(struct inode *, struct file *); + loff_t (*llseek)(struct file *, loff_t, int); + ssize_t (*read)(struct file *, char *, size_t, loff_t *); + int (*iterate_shared)(struct file *, struct dir_context *); + long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); + int (*fsync)(struct file *, loff_t, loff_t, int); + int (*release)(struct inode *, struct file *); +}; + +/* file open helper */ +#define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 2c9c460f0e7..13d2ce7b54b 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -520,7 +520,7 @@ int ext4_find_inline_data_nolock(struct inode *inode) char ext4_file_inode_operations; char ext4_file_operations; char ext4_dir_inode_operations; -char ext4_dir_operations; +/* ext4_dir_operations is now in dir.c */ char ext4_special_inode_operations; char ext4_symlink_inode_operations; char ext4_fast_symlink_inode_operations; @@ -580,3 +580,49 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio) void jbd2_journal_init_jbd_inode(void *jinode, struct inode *inode) { } + +/* + * Stubs for dir.c + */ +ssize_t generic_read_dir(struct file *f, char *buf, size_t count, loff_t *ppos) +{ + return -EISDIR; +} + +void __ext4_error_file(struct file *file, const char *func, unsigned int line, + unsigned long long block, const char *fmt, ...) +{ +} + +loff_t ext4_llseek(struct file *file, loff_t offset, int whence) +{ + return 0; +} + +int ext4_htree_fill_tree(struct file *dir_file, unsigned long long pos, + unsigned long long start_hash, + unsigned long long start_minor_hash, + unsigned long long *next_hash) +{ + return 0; +} + +int ext4_read_inline_dir(struct file *file, void *ctx, void *f_pos) +{ + return 0; +} + +int ext4_dirblock_csum_verify(struct inode *inode, struct buffer_head *bh) +{ + return 1; +} + +long ext4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return 0; +} + +int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) +{ + return 0; +}