From patchwork Wed Jan 21 22:08:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1735 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=1769033389; bh=A40PyQOvyoQI0awypSaWqrtk4Tt+YEas5uyQ2Z0mPOk=; 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=uibjvM4UumNywQPD7xw4TmyR8pkoDVbXgXRZBDX3cfu2I7/ckeFigUgSQ+1+ltTA+ 4p/2G1s+BwEhrXlva9ukgKTfzNYhA7TLYxzn2TiYrKUPLFKwMVhJC1m9jnXji7GRBJ ZXapkR34cvhA9NEIVf2zI++/80HFWOdKXkiIE9R6TBTQfw56JpE8oWKEebg/Mi+Fvo txYwh2TY+/oFDgBYOIr13ryxN3BWXA9fkEEdRiC1Jv0p1si+ObidF/yOnHAu45mSi/ cY/koqrZrdeyEelxt+UgtaCP474Kp5tedNxqvaVcaEwgFjcC45SsuMsEewfclaoPDa dJoSScM8Spt8Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 65C9269601 for ; Wed, 21 Jan 2026 15:09:49 -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 6mT-9XtSDODr for ; Wed, 21 Jan 2026 15:09:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033389; bh=A40PyQOvyoQI0awypSaWqrtk4Tt+YEas5uyQ2Z0mPOk=; 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=uibjvM4UumNywQPD7xw4TmyR8pkoDVbXgXRZBDX3cfu2I7/ckeFigUgSQ+1+ltTA+ 4p/2G1s+BwEhrXlva9ukgKTfzNYhA7TLYxzn2TiYrKUPLFKwMVhJC1m9jnXji7GRBJ ZXapkR34cvhA9NEIVf2zI++/80HFWOdKXkiIE9R6TBTQfw56JpE8oWKEebg/Mi+Fvo txYwh2TY+/oFDgBYOIr13ryxN3BWXA9fkEEdRiC1Jv0p1si+ObidF/yOnHAu45mSi/ cY/koqrZrdeyEelxt+UgtaCP474Kp5tedNxqvaVcaEwgFjcC45SsuMsEewfclaoPDa dJoSScM8Spt8Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 55FDF695FB for ; Wed, 21 Jan 2026 15:09:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033386; bh=piS4okq7QgG6fKDyW4KgwycRf5bbKD3JHCkxnZytkkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LALkAJyrtmu08R7QPDEJUBcI7OG+AkqxTSXQzFWB+LWJvnhTuAsiWO1IiGnyzUXbA JL5qiYfACQU9vNZZ2gyvi14by1Zd4JAXeAdAhFcq2JIBZ/7dtFs3tYpTLnIGMiXbuB PVq3Oj1ujbI68GA/BbyfjYv1kwHF57/NjmyTlbqKotZy2neM8lm/gwzr/hiY+MoHfI NnpyM8z5hjAjXSCe5ar0U6lHPfq/qMYjgMoin135a0jaVeDc0jCW+g5s0zq5i6aA6i C4Nrq+LEXulcFsutd3GLQ8YKNT+zZmZT5EGChLDTeouWDaCKbyHF/UhPHtq7uWVxvu h9ceVDRJ4S1zA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5D71B695F2; Wed, 21 Jan 2026 15:09:46 -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 HKOwF2BQRPp0; Wed, 21 Jan 2026 15:09:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033382; bh=BNfJNQeWnVBIpewHCyL4A1/Yf9enzYr/6af+jGiKhQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUF/e7L2BOm1w6hkOjIQuxFeidk6+3x9Psudk0CFSXnZbgkkZ5L7xyjXfj9KvanSe 5aZ/m6I55dGB365K4HFRrJw/LMlzqFua4FUrGdihYJ6AUHKTM7Ss26gE+9KbAg1/Iv uakDrUL9pgoldNdmsyEKvLrm/UEsMsozczSf4e2SYvZEiN3O7dW6lZupJaVFb/72Tc jxYqlQgbRn6AzutCUezlhVRgqv5b7fsl43oTxmnGsb4bccaSkSL+l/KPQOjuBHIuU5 +KnrQ5hsSVoGQSX1PN4bKQiugFsTKxBy+a4K8Sp6zMvMXsjGAFqz6SzS3qRncdTp3z GSqJkPMxrIQYA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D7BE9695FD; Wed, 21 Jan 2026 15:09:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 15:08:22 -0700 Message-ID: <20260121220857.2137568-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260121220857.2137568-1-sjg@u-boot.org> References: <20260121220857.2137568-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QCJ2Y3YJVRE25HBYEG735H2JFHIDZCCA X-Message-ID-Hash: QCJ2Y3YJVRE25HBYEG735H2JFHIDZCCA 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/33] ext4l: Move generic VFS operations to linux/fs.h 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 Move the generic VFS operation stubs from ext4_uboot.h to include/linux/fs.h where they belong. This includes: - generic_file_read_iter(), generic_write_checks() - generic_perform_write(), generic_write_sync() - generic_atomic_write_valid() - generic_buffers_fsync_noflush() - generic_fillattr(), generic_fill_statx_atomic_writes() - generic_file_llseek_size() - generic_ci_validate_strict_name() - generic_read_dir(), generic_check_addressable() Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 21 +-------------------- include/linux/fs.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index d3ad76f2618..35626a95cf8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -224,18 +224,10 @@ struct dx_hash_info { #define file_modified(file) ({ (void)(file); 0; }) #define file_accessed(file) do { (void)(file); } while (0) -/* Generic file operations - stubs for file.c */ -#define generic_file_read_iter(iocb, to) ({ (void)(iocb); (void)(to); 0L; }) -#define generic_write_checks(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) -#define generic_perform_write(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) -#define generic_write_sync(iocb, count) ({ (void)(iocb); (count); }) -#define generic_atomic_write_valid(iocb, from) ({ (void)(iocb); (void)(from); 0; }) #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) -#define generic_ci_validate_strict_name(d, n) ({ (void)(d); (void)(n); 1; }) - #include /* Memory retry wait */ @@ -284,7 +276,6 @@ struct dx_hash_info { /* Sync operations - stubs */ #define sync_mapping_buffers(m) ({ (void)(m); 0; }) #define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; }) -#define generic_buffers_fsync_noflush(f, s, e, d) ({ (void)(f); (void)(s); (void)(e); (void)(d); 0; }) #define file_write_and_wait_range(f, s, e) ({ (void)(f); (void)(s); (void)(e); 0; }) #define file_check_and_advance_wb_err(f) ({ (void)(f); 0; }) @@ -311,8 +302,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); #define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) #define setattr_copy(m, i, a) do { } while (0) #define posix_acl_chmod(m, i, mo) ({ (void)(m); (void)(i); (void)(mo); 0; }) -#define generic_fillattr(m, req, i, s) do { } while (0) -#define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) /* File operations */ #define file_update_time(f) do { } while (0) @@ -332,13 +321,6 @@ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); /* FSTR_INIT - fscrypt_str initializer (fscrypt_str defined in ext4_fscrypt.h) */ #define FSTR_INIT(n, l) { .name = (n), .len = (l) } -/* 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 - use linux/overflow.h */ #include @@ -472,8 +454,7 @@ void free_page(unsigned long addr); void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); -/* Block device size - declarations for stub.c */ -int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); +/* Block device size - declaration for stub.c */ unsigned int bdev_max_discard_sectors(struct block_device *bdev); #include diff --git a/include/linux/fs.h b/include/linux/fs.h index f50a081b32b..3fa54146f44 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -638,4 +638,37 @@ struct inode_operations { umode_t); }; +/* + * Generic VFS operations - stubs for U-Boot + */ + +/* Generic file I/O operations */ +#define generic_file_read_iter(iocb, to) ({ (void)(iocb); (void)(to); 0L; }) +#define generic_write_checks(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) +#define generic_perform_write(iocb, from) ({ (void)(iocb); (void)(from); 0L; }) +#define generic_write_sync(iocb, count) ({ (void)(iocb); (count); }) +#define generic_atomic_write_valid(iocb, from) ({ (void)(iocb); (void)(from); 0; }) + +/* Generic fsync operation */ +#define generic_buffers_fsync_noflush(f, s, e, d) \ + ({ (void)(f); (void)(s); (void)(e); (void)(d); 0; }) + +/* Generic attribute operations */ +#define generic_fillattr(m, req, i, s) do { } while (0) +#define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) + +/* Generic seek operation */ +#define generic_file_llseek_size(f, o, w, m, e) \ + ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) + +/* Case-insensitive name validation - not supported */ +#define generic_ci_validate_strict_name(d, n) ({ (void)(d); (void)(n); 1; }) + +/* Generic directory read - implemented in ext4l/stub.c */ +ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, + loff_t *ppos); + +/* Block addressability check - implemented in ext4l/stub.c */ +int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); + #endif /* _LINUX_FS_H */