From patchwork Wed Jan 21 22:08:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1744 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=1769033422; bh=e4XmTu7iCBj+GYM6jfbf2DCj6FEaeHgr72DOk0Kbo10=; 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=nVNR4o2VmULSkTulC6KTDXThJ4zk7g9xac3v+nq7CF2MN/c+jS3XBN/lXB0mxdUQz XQux4eiPl2nvMrMx2Zyc47FeNj7Y++P4x4EFuBfovKHA9e/1v3rbca9y3BBmig4fzv eV2UBRUwoiXJ3qOKMh1PRIBdQ2h0XtvKDAtdX+0E7cG7LMimvaFmYTUTQlY+ioLzlK oi4prMeOU9euYdShpq2DzCxFBsW4+/CMTUsQDHS2DPgVdRHQDMQ/BVZghiHSEkbUT2 A73Ios34URjhn9ln2tG2bUHDB/S3134C/zkfAvFIkwWRce4iU7x58LwK+lXoLz9opK s4VRtPz0bHLSw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ED4F569616 for ; Wed, 21 Jan 2026 15:10:22 -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 OtSIdbnmV1fs for ; Wed, 21 Jan 2026 15:10:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033421; bh=e4XmTu7iCBj+GYM6jfbf2DCj6FEaeHgr72DOk0Kbo10=; 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=ET4fA+Xe9ba9cYlb6CpKgmduqfXXjvd6bGYTinSqJAb5p8fLtI1pf3OtzDPnFxpTL itUxQxX8ylYmZ47LdK8J0T0c9Pf84yDlLgH23vFsDEuv4lMWfkxG2t49HeDzBQMS4n mldPlwNhmNMC5kU5X5LI8YzxhXADUqp7mbD8NoHHC7DpKaJ93Pm9RxAhM/7onnSa+h zxB4+1pOwPu2W69XvHXnXSlem585I3MLAOG5Mr/cQ2nbURoqraKfh2Gvx69qHgaWOf vrdN5HWnAqA+qZgksswFzcud/QjkDVK97cGmNHjQxs+/ufCwWshrjR5o8GWzoFqVRu fv+ogi9go5lqA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EEFF369605 for ; Wed, 21 Jan 2026 15:10:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033419; bh=wTwKYkZ4YLSyVFl06t/qGOg3iUltH245/Gc1pQJNwN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngzaII454lf+SLO9mNEuwEIVV+du/BZ8aS5/RxBP3ELqB5Pd+PX8mGsqPNa1PS4Jp y6Z4f/Lk+7o4Acub78Yxd5Lcm8malpPNHzSQvw+19rAbG5L/c14taQXBOsXaRc1n69 Agan9yWFeQqSD6sxuluQzIXXBHmQmTODWK7xkgZyvGg76RNNbWaBoajnbfwOpvGuJW XDBUwfhJlhkzyomUA0uIBbHozsf0IpP9NOEPi97AB7J9vcybigdzH1YEsw4l1GtsjS J6Fclt29scai9WF8LCBbrhhZMR8CpUVd9AUaDnwd5z8Z/lSBJTKhtcgD4Fpfa6XVdq YbfeB1+/VQg0Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F16BA695F2; Wed, 21 Jan 2026 15:10:19 -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 Y7osEvtk9xbx; Wed, 21 Jan 2026 15:10:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033415; bh=MM2jvJj2zlzaTXcxrF3sDAu8ex/+OAavuvA+I6Jh9ww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gCxgo5pfQV936YMGqcHMPgJxV+DovyKU8lEEYncVBRGJpyLFLxiSpY9uspzGlayjt VK0vpSeb++f8uDBxwYfIIpe8AVlyxgnjZ6LRPqVbQs+0u4IJOFwY2JLeCiy/AB9Vnj lqt2qYr1TpDA7cjHmY17WkMw54E9eQpb0kMwECWdvwn1SWby7ORi3A6jXPneImQp6w rBi87Oz5JOlzqNmmth7JKVbl2zdpsd0tvZT1xnWGKyFRiWzhcnVSR7zrKmI9sQba42 KnLy+ykxM8pi4MdGEzuoSZhcUAR35Ihl2cYl9nndejxHY03PdNerNVzp8bvL9OWwZD tYxlfYn6QNTuA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A4C7A695F7; Wed, 21 Jan 2026 15:10:15 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 15:08:31 -0700 Message-ID: <20260121220857.2137568-19-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: OKEBOIYPGD6MUGZYYQYE65NAZBH4DWUN X-Message-ID-Hash: OKEBOIYPGD6MUGZYYQYE65NAZBH4DWUN 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 18/33] ext4l: Move inode and filesystem helpers 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 inode lifecycle functions (new_inode, iget_locked, iput), block mapping (bmap), and simple filesystem helpers (simple_open, simple_get_link) from ext4_uboot.h to linux/fs.h where they belong. Also replace the list_sort and sort stub macros with proper includes of linux/list_sort.h and linux/sort.h. This reduces ext4_uboot.h from 492 to 466 lines. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 30 +++--------------------------- include/linux/fs.h | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 14b3d075dd4..1228ced8e6c 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -117,9 +117,6 @@ #include #include -/* Inode operations - iget_locked and new_inode are in interface.c */ -extern struct inode *new_inode(struct super_block *sb); - /* Forward declarations for xattr functions */ struct super_block; struct buffer_head; @@ -134,8 +131,6 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, #include #include -void iput(struct inode *inode); - #include #include #include @@ -226,9 +221,6 @@ struct path; /* UID/GID bit helpers - use linux/highuid.h */ #include -/* Inode allocation/state operations */ -extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); - /* Attribute operations */ #define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) #define setattr_copy(m, i, a) do { } while (0) @@ -261,17 +253,6 @@ static inline void nd_terminate_link(void *name, loff_t len, int maxlen) ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; } -/* file open helper */ -#define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) - -/* simple_get_link - for fast symlinks stored in inode */ -static inline const char *simple_get_link(struct dentry *dentry, - struct inode *inode, - struct delayed_call *callback) -{ - return inode->i_link; -} - /* * Additional stubs for super.c */ @@ -436,9 +417,6 @@ void ext4l_print_msgs(void); struct blk_desc *ext4l_get_blk_dev(void); struct disk_partition *ext4l_get_partition(void); -/* JBD2 journal.c stubs */ -int bmap(struct inode *inode, sector_t *block); - #include /* Memory allocation for journal.c */ @@ -483,10 +461,8 @@ int ext4_update_overhead(struct super_block *sb, bool force); /* fsmap is now in linux/fsmap.h */ #include -/* list_sort and sort stubs for fsmap.c - not used in U-Boot */ -#define list_sort(priv, head, cmp) \ - do { (void)(priv); (void)(head); (void)(cmp); } while (0) -#define sort(base, num, size, cmp, swap) \ - do { (void)(base); (void)(num); (void)(size); (void)(cmp); (void)(swap); } while (0) +/* list_sort and sort for fsmap.c */ +#include +#include #endif /* __EXT4_UBOOT_H__ */ diff --git a/include/linux/fs.h b/include/linux/fs.h index c8006d668b5..07fe8c5e711 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -557,11 +557,29 @@ enum { #define unlock_two_nondirectories(i1, i2) \ do { (void)(i1); (void)(i2); } while (0) -/* Inode allocation - implemented in ext4l/stub.c */ +/* Inode allocation and lifecycle - implemented in ext4l */ struct kmem_cache; void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, gfp_t gfp); int inode_generic_drop(struct inode *inode); +struct inode *new_inode(struct super_block *sb); +struct inode *iget_locked(struct super_block *sb, unsigned long ino); +void iput(struct inode *inode); + +/* Block mapping - implemented in ext4l/stub.c */ +int bmap(struct inode *inode, sector_t *block); + +/* Simple filesystem helpers */ +#define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) + +/* simple_get_link - for fast symlinks stored in inode */ +struct delayed_call; +static inline const char *simple_get_link(struct dentry *dentry, + struct inode *inode, + struct delayed_call *callback) +{ + return inode->i_link; +} /** * get_block_t - block mapping callback type