From patchwork Mon Jan 19 21:48:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1659 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=1768859349; bh=nUuC8wA0Gmml1NRQ8V7s0j2cWOgvLmbAM9n/tjA+7L4=; 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=GkKCYpTSXFZimxAKPAMuYZFizN4RG1/vTOyEUIHINSB03Xc1l05OtVo2+PJx6mAHv QlrkqHB++1mMU9OUR6wLeoJMcoit0RK+kK8wXv3+YykO7GP29TgBZLXYyfGsSgIuig bNE7VQlwSJkyEDtSo1xXszlBW+rSuiw9Ze8Dhy63eJpm4k6+VjzZuftkHnDLxcn3qH VKv8YFlK1hl+EAos/jnRyZWcsmmXnrcR9ekE3xPKWZBVxFTNDOWZdftGV/XR9jI96X /TGZvDW2jdQG/DWkllgIw85dkTBbyf8Jxr1nuZAmra2rq9gBtXfG3UWHpghLCFr9x3 CSOijcSz+vvoA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EE55169533 for ; Mon, 19 Jan 2026 14:49:09 -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 YWLO6KqzGRJ3 for ; Mon, 19 Jan 2026 14:49:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859349; bh=nUuC8wA0Gmml1NRQ8V7s0j2cWOgvLmbAM9n/tjA+7L4=; 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=GkKCYpTSXFZimxAKPAMuYZFizN4RG1/vTOyEUIHINSB03Xc1l05OtVo2+PJx6mAHv QlrkqHB++1mMU9OUR6wLeoJMcoit0RK+kK8wXv3+YykO7GP29TgBZLXYyfGsSgIuig bNE7VQlwSJkyEDtSo1xXszlBW+rSuiw9Ze8Dhy63eJpm4k6+VjzZuftkHnDLxcn3qH VKv8YFlK1hl+EAos/jnRyZWcsmmXnrcR9ekE3xPKWZBVxFTNDOWZdftGV/XR9jI96X /TGZvDW2jdQG/DWkllgIw85dkTBbyf8Jxr1nuZAmra2rq9gBtXfG3UWHpghLCFr9x3 CSOijcSz+vvoA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD29569525 for ; Mon, 19 Jan 2026 14:49:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859349; bh=cjOhMe3e6euACnA2VWmPMn0KMhmjeZ3ZdeZIVkoBaoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n04JLnY82YYW1YUKZKJ926/mHGePoVZN2cvRRxGq8jOWV/NJKeR+UALxmB0M/03GW JsN1/VjpDhLuOL6Tq7TvboChMbteKUs29ptqBlDnus6dFf1xuG/sYpEi8zubZw/5ji noNyZqXerL/UfrJNNyBhS26xMTp57xxSNujEj3L1egObU+/kxkUS/mxx4jGU/a+r3g 73gY/hrJX4MPUmenPGlA1VE0L/d1UiQSMOHbj9/8JgciqSYeanko/Rr8OO2nsqNALm pYwpz18x1gzmzkbpDXiYvNR1y7blMDDok3aIvKiYq4Z6xuYBiEthFIV0UO/4PuYLzI r736Sj7bJxKUQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1785469525; Mon, 19 Jan 2026 14:49:09 -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 5P3aXPJ0TtiK; Mon, 19 Jan 2026 14:49:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768859345; bh=YdRom0zwN6chuWVRmmiPoORY7TmKQTy1tdPnwpsjndA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7Qc6hKZP6dUrELc9+0HtdPbLP1PObhhl1Rd8s7Zwr97Y4OwU2RBtJrPZOryXvVvU 6DCzW7pMROCCtEheZU/z0unvigcPkPoXdze1Kp199eS4FzFwMGI0JTUKVr8DOiixBm Qwi+Cwj3ZzKarz4fvaE6s/A6eUUxvyl1eQ1YD2rp0D3eHhpTNF25S1PL1sFv7l8V4h 28I028g71qcXdGR/FBZN4cuGDaaRDz+1vKuiXqd8QdzrTZ0NH4oJQnQ/WTM36u/f4x 7tY0yrKW50rxzTI6q8E4sawJh9BfQq3SGc0UYP2DUGZHq4qzgNCFZM+h5AduKnt7eA Oo3q5WEF6OThw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B2F636951A; Mon, 19 Jan 2026 14:49:04 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 19 Jan 2026 14:48:27 -0700 Message-ID: <20260119214846.3087611-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260119214846.3087611-1-sjg@u-boot.org> References: <20260119214846.3087611-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TVIZJUJVURGMYQVM6YHZRYY3QJPZN4KT X-Message-ID-Hash: TVIZJUJVURGMYQVM6YHZRYY3QJPZN4KT 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 02/16] ext4l: Add linux/fs/super_types.h for struct super_block 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 Create include/linux/fs/super_types.h with the struct super_block definition and sb_rdonly() helper, matching the Linux kernel location. This allows other headers like linux/fs.h to access the full struct definition rather than just a forward declaration. Remove the duplicate definitions from ext4_uboot.h. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 41 ++------------------ include/linux/fs.h | 2 +- include/linux/fs/super_types.h | 68 ++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 39 deletions(-) create mode 100644 include/linux/fs/super_types.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 8daf01779c5..d6b7acc66b3 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -194,8 +194,7 @@ extern struct user_namespace init_user_ns; /* might_sleep - stub */ #define might_sleep() do { } while (0) -/* sb_rdonly - check if filesystem is mounted read-only */ -#define sb_rdonly(sb) ((sb)->s_flags & SB_RDONLY) +/* sb_rdonly is in linux/super.h */ /* Trace stubs are now in ext4_trace.h */ @@ -328,10 +327,7 @@ void iput(struct inode *inode); /* SB_FREEZE_* constants are in linux/fs.h */ -/* sb_writers stub */ -struct sb_writers { - int frozen; -}; +/* sb_writers is in linux/super.h */ /* mapping_large_folio_support is in linux/pagemap.h */ @@ -424,38 +420,7 @@ struct fstrim_range { /* uuid_t is now in linux/uuid.h */ -/* Forward declarations for super_block */ -struct super_operations; -struct export_operations; -struct xattr_handler; - -/* super_block - minimal stub */ -struct super_block { - void *s_fs_info; - unsigned long s_blocksize; - unsigned char s_blocksize_bits; - unsigned long s_magic; - loff_t s_maxbytes; - unsigned long s_flags; - unsigned long s_iflags; /* Internal flags */ - struct rw_semaphore s_umount; - struct sb_writers s_writers; - struct block_device *s_bdev; - char s_id[32]; - struct dentry *s_root; - uuid_t s_uuid; - struct file_system_type *s_type; - s32 s_time_gran; /* Time granularity (ns) */ - time64_t s_time_min; /* Min supported time */ - time64_t s_time_max; /* Max supported time */ - const struct super_operations *s_op; - const struct export_operations *s_export_op; - const struct xattr_handler * const *s_xattr; - struct dentry *d_sb; /* Parent dentry - stub */ - - /* U-Boot: list of all inodes, for freeing on unmount */ - struct list_head s_inodes; -}; +/* super_block is now in linux/super.h */ /* Block device read-only check */ static inline int bdev_read_only(struct block_device *bdev) diff --git a/include/linux/fs.h b/include/linux/fs.h index 6d8b9b5c79b..f295086523a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -10,10 +10,10 @@ #include #include #include +#include /* Forward declarations */ struct inode; -struct super_block; struct buffer_head; struct file; struct folio; diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h new file mode 100644 index 00000000000..f3ed772ef40 --- /dev/null +++ b/include/linux/fs/super_types.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Superblock definitions + * + * Minimal version for U-Boot - based on Linux + */ +#ifndef _LINUX_FS_SUPER_TYPES_H +#define _LINUX_FS_SUPER_TYPES_H + +#include +#include +#include +#include +#include + +/* Forward declarations */ +struct block_device; +struct dentry; +struct file_system_type; +struct super_operations; +struct export_operations; +struct xattr_handler; + +/* sb_writers stub */ +struct sb_writers { + int frozen; +}; + +/* super_block - filesystem superblock */ +struct super_block { + void *s_fs_info; + unsigned long s_blocksize; + unsigned char s_blocksize_bits; + unsigned long s_magic; + loff_t s_maxbytes; + unsigned long s_flags; + unsigned long s_iflags; /* Internal flags */ + struct rw_semaphore s_umount; + struct sb_writers s_writers; + struct block_device *s_bdev; + char s_id[32]; + struct dentry *s_root; + uuid_t s_uuid; + struct file_system_type *s_type; + s32 s_time_gran; /* Time granularity (ns) */ + time64_t s_time_min; /* Min supported time */ + time64_t s_time_max; /* Max supported time */ + const struct super_operations *s_op; + const struct export_operations *s_export_op; + const struct xattr_handler * const *s_xattr; + struct dentry *d_sb; /* Parent dentry - stub */ + + /* U-Boot: list of all inodes, for freeing on unmount */ + struct list_head s_inodes; +}; + +/* Superblock flags - also defined in linux/fs.h */ +#ifndef SB_RDONLY +#define SB_RDONLY (1 << 0) /* Read-only mount */ +#endif + +/* sb_rdonly - check if filesystem is mounted read-only */ +static inline bool sb_rdonly(const struct super_block *sb) +{ + return sb->s_flags & SB_RDONLY; +} + +#endif /* _LINUX_FS_SUPER_TYPES_H */