From patchwork Sun Jan 18 20:37: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: 1584 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=1768768741; bh=IY5Vj1VkKus/HhCb4pglnAcUHyCl+jvgMLCgNMejdGA=; 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=ugXgkvxjSOWobf5j7H3es0yOwVKkcqBedOqfCb82PSo/8/+rHsCHs0KgcATsLitg+ 8xabUIjMl+vIcI5GgQktZrzSud3ZESrF/gPUUStZBzZ3EkU0j9cTlH/waRYvrFaZTU bYC+j3pRvzuubLkShAZM1DWJpR0+15/Rog6hOXA7GQLDMlCTf2/g3ZLVUWkJ4RaVrn bsWtvm1eKLwhGcqufDt2P9ahiM9qp0o0eHKg8+OtLfC4SZ/bqzZt5PqYadHhNKo7w7 lW5KPHehp/DIJ2WPWqD2mDAJtkWqnWhoPfCKtcFnuYPJIoFHeJtiTALl+QJygq5IKm Ydh9Grc+gePHw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0E0C069487 for ; Sun, 18 Jan 2026 13:39:01 -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 fUUp0lastHxT for ; Sun, 18 Jan 2026 13:39:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768740; bh=IY5Vj1VkKus/HhCb4pglnAcUHyCl+jvgMLCgNMejdGA=; 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=OBTxjj5sfzA0jgmcNzMiqNpsttitFHWfpP64VNkv/DEGzl1tNS8GKMFgmjjNPWqWL eIMKXC+pRRNuwOwxsHGAsJqh6zT2P3+F9s4ZvoQTn5/LtSfsfGe7WnogAUoaB4PvQs 1PLbX3CRAZ3Ai/j3ZWin7QpaPVSq0e1bqL5CurFi8aSDH7h9TovSm8oeZoea4dKJgp q7S8feuSaowEHxspWbo7E6AC4G3mxDOoAYUF8kZ3WPrJtxD8F4gARa3dXAe0t6XQld CuWveVUhcyY71OtmpLRNXW76WajPvdI9JM6nraZmVTj3+0Hhwjyph4ISxn08Iq86If 9noo1bAnOY1pg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D80B46919C for ; Sun, 18 Jan 2026 13:39:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768737; bh=I1cDlLQ+yRSMhLHt7DSbBH9mnEZYbbMXEUID7xrqY6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MZ291TQ8KWSYPVkfl3MTvzet2mDUJ7rJFma24vRr0M2q5SkSwDroqNCCbpTy4xkL9 nx4iRCNeezyvFh2xHN7bBWEGs6nfLBEfyEC1TbOekDq6VxDnSUHPB6/rmu/O7IfWDD nzGRti/ojj4g4U+vW4QQqJbvtp547PpRwfqOhDWF+QHWsyRHoy669WVmRcVC0vN75t 5DyXZHUIoJ4SKvBcX50QoLJD1WGNrwyKPna5eaaMy3cOyHR/38wzcCDNh3RtnFSiyq hkC1gScuzEXhb9zPDq/t2nLe2QUnCGB9PqSQCLozRP6uZ/Uhr4K+k+OqL9qFz3ATpl y/vt0r8BLHJ/g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DCAC969487; Sun, 18 Jan 2026 13:38:57 -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 WKIvCFPrQk1s; Sun, 18 Jan 2026 13:38:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768732; bh=wERFdBeyE3ue9naFCnM//aCs1jGbEj3grmMgEO/tJqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiPiwF5Q85I4vT+l1drI91pLycL9bgO7xMbFLjedpie2nyLAjQdQWqUMiqhg7+Bhj kTCy5D6DEpIbl/O2T00AxszYlRcXaqN5D5TMqwh7jCJH3JKXAMF2xijCwJYYOjYXiH 4ooAAeBLS30G7WKLbTjSXjETlFcE0C2+/llKFyQvgQa8MhCvy+8ENkSL+/pOwJF/Av Xw6OhxvI/ryMXR3eBSzSSydUtV0H9F0Wn2s3KQa9pnLKceJaFAw5N11v/zxw3fvYVZ 40SyyyiBlqB6NYYqBeSimoD8fhO7TVv2JSUjFGlKI8qjQzO6lQQIGmHFf5d9xY/yaV JD5tq55S/PqnA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6CFE069382; Sun, 18 Jan 2026 13:38:52 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:27 -0700 Message-ID: <20260118133734.5.c5c8169071840a982d4d49530e8c4f4927c9b209@changeid> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118203739.1974323-1-sjg@u-boot.org> References: <20260118203739.1974323-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IRXS4MC3EXXBPQBAJVSL7ABWATKTB2DC X-Message-ID-Hash: IRXS4MC3EXXBPQBAJVSL7ABWATKTB2DC 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 05/12] linux: Add exportfs.h header with NFS export operations 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 linux/exportfs.h with struct fid, export_operations, and generic file handle encoder/decoder declarations for NFS export support. Update ext4_uboot.h to use the new header instead of duplicating these definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 38 ++------------------ include/linux/exportfs.h | 78 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 35 deletions(-) create mode 100644 include/linux/exportfs.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index f686364a761..b6744894169 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1259,34 +1259,8 @@ struct super_operations { struct dentry *(*get_dquots)(struct inode *); }; -/* export_operations for NFS */ -struct export_operations { - int (*encode_fh)(struct inode *, __u32 *, int *, struct inode *); - struct dentry *(*fh_to_dentry)(struct super_block *, struct fid *, int, int); - struct dentry *(*fh_to_parent)(struct super_block *, struct fid *, int, int); - struct dentry *(*get_parent)(struct dentry *); - int (*commit_metadata)(struct inode *); -}; - -/* Generic file handle encoder for NFS exports - stub */ -static inline int generic_encode_ino32_fh(struct inode *inode, __u32 *fh, - int *max_len, struct inode *parent) -{ - return 0; -} - -/* fid for export_operations */ -struct fid { - union { - struct { - u32 ino; - u32 gen; - u32 parent_ino; - u32 parent_gen; - } i32; - __u32 raw[0]; - }; -}; +/* export_operations and fid - use linux/exportfs.h */ +#include /* uuid_to_fsid - convert UUID to fsid */ static inline __kernel_fsid_t uuid_to_fsid(const u8 *uuid) @@ -1433,13 +1407,7 @@ int inode_generic_drop(struct inode *inode); /* fsverity stubs (fscrypt macros are in ext4_fscrypt.h) */ #define fsverity_cleanup_inode(i) do { } while (0) -/* NFS export helpers - declarations for stub.c */ -struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, - int fh_len, int fh_type, - struct inode *(*get_inode)(struct super_block *, u64, u32)); -struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, - int fh_len, int fh_type, - struct inode *(*get_inode)(struct super_block *, u64, u32)); +/* NFS export helpers are now in linux/exportfs.h */ /* Path operations */ #define path_put(p) do { } while (0) diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h new file mode 100644 index 00000000000..d42b9f63d15 --- /dev/null +++ b/include/linux/exportfs.h @@ -0,0 +1,78 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * NFS export operations for U-Boot + * + * Based on Linux exportfs.h - filesystem export support for NFS. + */ +#ifndef _LINUX_EXPORTFS_H +#define _LINUX_EXPORTFS_H + +#include + +struct super_block; +struct dentry; +struct inode; + +/** + * struct fid - NFS file handle + * + * Flexible file handle for NFS export. + */ +struct fid { + union { + struct { + u32 ino; + u32 gen; + u32 parent_ino; + u32 parent_gen; + } i32; + __u32 raw[0]; + }; +}; + +/** + * struct export_operations - NFS export operations + * @encode_fh: encode file handle + * @fh_to_dentry: decode file handle to dentry + * @fh_to_parent: decode file handle to parent dentry + * @get_parent: get parent directory + * @commit_metadata: commit metadata changes + * + * Operations for NFS export support. + */ +struct export_operations { + int (*encode_fh)(struct inode *, __u32 *, int *, struct inode *); + struct dentry *(*fh_to_dentry)(struct super_block *, struct fid *, + int, int); + struct dentry *(*fh_to_parent)(struct super_block *, struct fid *, + int, int); + struct dentry *(*get_parent)(struct dentry *); + int (*commit_metadata)(struct inode *); +}; + +/** + * generic_encode_ino32_fh() - generic file handle encoder + * @inode: inode to encode + * @fh: file handle buffer + * @max_len: maximum length of buffer + * @parent: parent inode (may be NULL) + * + * U-Boot stub - returns 0. + */ +static inline int generic_encode_ino32_fh(struct inode *inode, __u32 *fh, + int *max_len, struct inode *parent) +{ + return 0; +} + +/* NFS export helpers - stubs for U-Boot */ +struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, + u64, u32)); +struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, + u64, u32)); + +#endif /* _LINUX_EXPORTFS_H */