From patchwork Wed Jan 21 22:08:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1730 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=1769033366; bh=YRgNrqZTkmaCSjNTOHHVAgk75JCk0UoTrO6wVBcqzSA=; 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=YS9kPPV16fNNpGXbs4u2KfkBCTgmNfnN7Q8NUfOdVk4LwQb29y/yPWetNUTkNLWhP iFPa0w2gn9EseJ4XEPhfs9FTu5fBmVi1ZUbRszZVYxJJcGLGHOgpEp5v8qD98sRPYl Zi3eLNMTS/1kG5/0Si172gujt4i1fBRoIqr0+gbTV3M1ellBuDnqzw+fqCCCHDro84 HzQGyfvBgczCsJd1/GUhAO1lIZNHc2Ule4ZAhWZsvGuuDE8Htd2Y5/U1E7twwjgh4K ncNIdAdQZ58VRE2S8Erail2B9PE3D73mxeopGx974bJXR8zZahCLZk95Pyejn3Q0K5 2W9CdmauBdpMw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D044C695FF for ; Wed, 21 Jan 2026 15:09:26 -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 AccMciD2KKQQ for ; Wed, 21 Jan 2026 15:09:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033366; bh=YRgNrqZTkmaCSjNTOHHVAgk75JCk0UoTrO6wVBcqzSA=; 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=YS9kPPV16fNNpGXbs4u2KfkBCTgmNfnN7Q8NUfOdVk4LwQb29y/yPWetNUTkNLWhP iFPa0w2gn9EseJ4XEPhfs9FTu5fBmVi1ZUbRszZVYxJJcGLGHOgpEp5v8qD98sRPYl Zi3eLNMTS/1kG5/0Si172gujt4i1fBRoIqr0+gbTV3M1ellBuDnqzw+fqCCCHDro84 HzQGyfvBgczCsJd1/GUhAO1lIZNHc2Ule4ZAhWZsvGuuDE8Htd2Y5/U1E7twwjgh4K ncNIdAdQZ58VRE2S8Erail2B9PE3D73mxeopGx974bJXR8zZahCLZk95Pyejn3Q0K5 2W9CdmauBdpMw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BF0C4695FB for ; Wed, 21 Jan 2026 15:09:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033364; bh=tPIcluNXZRDzXmvBfNwNNfqzWoMWaTPSAtH3ZS+tYDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8+SB5ytYtKq1xrCkWdGVIT9NmKaR1xzyScyWZUi142YBqYWfz3YMumhhGG9/KhSR 3Dji1HWIfe5rJewL39hiPlbS5g50o6wgBa7WH6QkWg1w7UPkd7lb7qOnNeVzxk0s9T nKDNpQmYVpJRU5HP0M6n7KloZHuTEp1eeCAg/lshuNGFuO+oURB7lWqBLzmcW8WD+V sDvHoGmhFEc8nHYKC4eNSu4/57EThGAEeUjIL82ySdNv0yuo7a/c5aiFPIYQa1bbhQ mfVSvHrS6J5TOjEYO+q/JWgy20+JLETQMI3qyYu6vuxCt1vMssOvPd/JGp+PptB/GD QPXpfctcvbCaw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D3001695F7; Wed, 21 Jan 2026 15:09:24 -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 9Btz0_kaKyLF; Wed, 21 Jan 2026 15:09:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033359; bh=BiI2x4FNxTDaLon358FuNNJ0VKFXfymiHdq8WsnrjpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qxoeokdLNg64C/fR25UPYiVjSW4ywbzsRkhgXKKcS0GKc2SgGplCAiEljVdoeCpqj jfbeDUTIxdgvj99mMcAJO8rImCrs4GDG9uwmmFLKjL4rwym4CYO4TceSTll/jGlGTo APqWhYceT625dTeiw7ROl/rFsSZwKNXXLD8Z0E1ff9FKFEXtf4qeH5iwWre3aGzfLj skgQCCuU74x5fiYmiXyJ+2eTrjg7J9vpdYUTQ5UztODjn5ut+4t5XKigU8zrM0ACLD lBMlP5pk15RmkE0q9S5L/8v6dza71vhKn7z3C+Q3FM0sZCnTYtx4kQbvRk328aJbif GedIDgzvAKPiw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C1F1B695FB; Wed, 21 Jan 2026 15:09:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 15:08:17 -0700 Message-ID: <20260121220857.2137568-5-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: H3AIPGKZGPXZL6IXTJBAPOBEOJY3N324 X-Message-ID-Hash: H3AIPGKZGPXZL6IXTJBAPOBEOJY3N324 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 04/33] ext4l: Move file_operations and inode_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 file_operations and inode_operations structure definitions from ext4_uboot.h to include/linux/fs.h where they belong according to Linux kernel conventions. Add necessary forward declarations for types used by these structures (delayed_call, fiemap_extent_info, file_kattr, posix_acl, mnt_idmap, kstat). Co-developed-by: Claude (Anthropic) Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 48 --------------------------------- include/linux/fs.h | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 48 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5d62c49663c..fb5c7cc8872 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -524,18 +524,6 @@ ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, /* struct_size - use linux/overflow.h */ #include -/* 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 *); -}; - -/* delayed_call - use linux/delayed_call.h */ #include #define kfree_link kfree @@ -546,42 +534,6 @@ static inline void nd_terminate_link(void *name, loff_t len, int maxlen) ((char *)name)[min_t(loff_t, len, maxlen)] = '\0'; } -/* inode_operations - for file and directory operations */ -struct inode_operations { - /* Symlink operations */ - const char *(*get_link)(struct dentry *, struct inode *, - struct delayed_call *); - /* Common operations */ - int (*getattr)(struct mnt_idmap *, const struct path *, - struct kstat *, u32, unsigned int); - ssize_t (*listxattr)(struct dentry *, char *, size_t); - int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64, u64); - int (*setattr)(struct mnt_idmap *, struct dentry *, struct iattr *); - struct posix_acl *(*get_inode_acl)(struct inode *, int, bool); - int (*set_acl)(struct mnt_idmap *, struct dentry *, - struct posix_acl *, int); - int (*fileattr_get)(struct dentry *, struct file_kattr *); - int (*fileattr_set)(struct mnt_idmap *, struct dentry *, - struct file_kattr *); - /* Directory operations */ - struct dentry *(*lookup)(struct inode *, struct dentry *, unsigned int); - int (*create)(struct mnt_idmap *, struct inode *, struct dentry *, - umode_t, bool); - int (*link)(struct dentry *, struct inode *, struct dentry *); - int (*unlink)(struct inode *, struct dentry *); - int (*symlink)(struct mnt_idmap *, struct inode *, struct dentry *, - const char *); - struct dentry *(*mkdir)(struct mnt_idmap *, struct inode *, - struct dentry *, umode_t); - int (*rmdir)(struct inode *, struct dentry *); - int (*mknod)(struct mnt_idmap *, struct inode *, struct dentry *, - umode_t, dev_t); - int (*rename)(struct mnt_idmap *, struct inode *, struct dentry *, - struct inode *, struct dentry *, unsigned int); - int (*tmpfile)(struct mnt_idmap *, struct inode *, struct file *, - umode_t); -}; - /* file open helper */ #define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) diff --git a/include/linux/fs.h b/include/linux/fs.h index aac88e7c68c..3f82a027931 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -402,4 +402,67 @@ struct fstrim_range { u64 minlen; }; +/* Forward declarations for file/inode operations */ +struct delayed_call; +struct fiemap_extent_info; +struct file_kattr; +struct posix_acl; +struct mnt_idmap; +struct kstat; + +/** + * struct file_operations - filesystem file operations + * + * Methods for file I/O and directory iteration. + */ +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 *); +}; + +/** + * struct inode_operations - filesystem inode operations + * + * Methods for inode manipulation, including symlinks and directories. + */ +struct inode_operations { + /* Symlink operations */ + const char *(*get_link)(struct dentry *, struct inode *, + struct delayed_call *); + /* Common operations */ + int (*getattr)(struct mnt_idmap *, const struct path *, + struct kstat *, u32, unsigned int); + ssize_t (*listxattr)(struct dentry *, char *, size_t); + int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64, u64); + int (*setattr)(struct mnt_idmap *, struct dentry *, struct iattr *); + struct posix_acl *(*get_inode_acl)(struct inode *, int, bool); + int (*set_acl)(struct mnt_idmap *, struct dentry *, + struct posix_acl *, int); + int (*fileattr_get)(struct dentry *, struct file_kattr *); + int (*fileattr_set)(struct mnt_idmap *, struct dentry *, + struct file_kattr *); + /* Directory operations */ + struct dentry *(*lookup)(struct inode *, struct dentry *, unsigned int); + int (*create)(struct mnt_idmap *, struct inode *, struct dentry *, + umode_t, bool); + int (*link)(struct dentry *, struct inode *, struct dentry *); + int (*unlink)(struct inode *, struct dentry *); + int (*symlink)(struct mnt_idmap *, struct inode *, struct dentry *, + const char *); + struct dentry *(*mkdir)(struct mnt_idmap *, struct inode *, + struct dentry *, umode_t); + int (*rmdir)(struct inode *, struct dentry *); + int (*mknod)(struct mnt_idmap *, struct inode *, struct dentry *, + umode_t, dev_t); + int (*rename)(struct mnt_idmap *, struct inode *, struct dentry *, + struct inode *, struct dentry *, unsigned int); + int (*tmpfile)(struct mnt_idmap *, struct inode *, struct file *, + umode_t); +}; + #endif /* _LINUX_FS_H */