[PATCH 1/4] nfs4.2: add nfs4_2.x to generate the UNCACHEABLE_FILE_DATA attribute
Mike Snitzer <[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
Introduce Documentation/sunrpc/xdr/nfs4_2.x for NFSv4.2 protocol extensions and define the UNCACHEABLE_FILE_DATA attribute (attr 87) there, verbatim from draft-ietf-nfsv4-uncacheable-files Section 7: typedef bool fattr4_uncacheable_file_data; const FATTR4_UNCACHEABLE_FILE_DATA = 87; This mirrors how the sibling NFSv4.2 attributes (FATTR4_OFFLINE=83, FATTR4_TIME_DELEG_*=84/85, FATTR4_OPEN_ARGUMENTS=86) are defined in Documentation/sunrpc/xdr/nfs4_1.x and generated by tools/net/sunrpc/xdrgen into <linux/sunrpc/xdrgen/nfs4_1.h>, which nfs4.h already includes. Wire the fs/nfsd "make xdrgen" target to generate the definitions header <linux/sunrpc/xdrgen/nfs4_2.h> and include it from <linux/nfs4.h>, so the generated FATTR4_UNCACHEABLE_FILE_DATA constant and the NFS4_fattr4_uncacheable_file_data_sz size macro are available to the NFSv4.2 client support that follows. No functional change. Signed-off-by: Mike Snitzer <[email protected]> Assisted-by: Claude:claude-opus-4-8 --- Documentation/sunrpc/xdr/nfs4_2.x | 52 ++++++++++++++++++++++++++++ fs/nfsd/Makefile | 5 ++- include/linux/nfs4.h | 1 + include/linux/sunrpc/xdrgen/nfs4_2.h | 19 ++++++++++ 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 Documentation/sunrpc/xdr/nfs4_2.x create mode 100644 include/linux/sunrpc/xdrgen/nfs4_2.h diff --git a/Documentation/sunrpc/xdr/nfs4_2.x b/Documentation/sunrpc/xdr/nfs4_2.x new file mode 100644 index 000000000000..d10a91d657b0 --- /dev/null +++ b/Documentation/sunrpc/xdr/nfs4_2.x @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2026 IETF Trust and the persons identified + * as the document authors. All rights reserved. + * + * The document authors are identified in RFC 7862 and + * draft-ietf-nfsv4-uncacheable-files. + * + * Redistribution and use in source and binary forms, with + * or without modification, are permitted provided that the + * following conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * - Neither the name of Internet Society, IETF or IETF + * Trust, nor the names of specific contributors, may be + * used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS + * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +pragma header nfs4; + +/* + * The following content was extracted from + * draft-ietf-nfsv4-uncacheable-files + */ + +typedef bool fattr4_uncacheable_file_data; + +const FATTR4_UNCACHEABLE_FILE_DATA = 87; diff --git a/fs/nfsd/Makefile b/fs/nfsd/Makefile index f0da4d69dc74..0ff198e102a3 100644 --- a/fs/nfsd/Makefile +++ b/fs/nfsd/Makefile @@ -37,11 +37,14 @@ nfsd-$(CONFIG_DEBUG_FS) += debugfs.o # .PHONY: xdrgen -xdrgen: ../../include/linux/sunrpc/xdrgen/nfs4_1.h nfs4xdr_gen.h nfs4xdr_gen.c +xdrgen: ../../include/linux/sunrpc/xdrgen/nfs4_1.h ../../include/linux/sunrpc/xdrgen/nfs4_2.h nfs4xdr_gen.h nfs4xdr_gen.c ../../include/linux/sunrpc/xdrgen/nfs4_1.h: ../../Documentation/sunrpc/xdr/nfs4_1.x ../../tools/net/sunrpc/xdrgen/xdrgen definitions $< > $@ +../../include/linux/sunrpc/xdrgen/nfs4_2.h: ../../Documentation/sunrpc/xdr/nfs4_2.x + ../../tools/net/sunrpc/xdrgen/xdrgen definitions $< > $@ + nfs4xdr_gen.h: ../../Documentation/sunrpc/xdr/nfs4_1.x ../../tools/net/sunrpc/xdrgen/xdrgen declarations $< > $@ diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 44e5e9fa12e1..34aa303354bc 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h @@ -18,6 +18,7 @@ #include <uapi/linux/nfs4.h> #include <linux/sunrpc/msg_prot.h> #include <linux/sunrpc/xdrgen/nfs4_1.h> +#include <linux/sunrpc/xdrgen/nfs4_2.h> enum nfs4_acl_whotype { NFS4_ACL_WHO_NAMED = 0, diff --git a/include/linux/sunrpc/xdrgen/nfs4_2.h b/include/linux/sunrpc/xdrgen/nfs4_2.h new file mode 100644 index 000000000000..9441f6cefbff --- /dev/null +++ b/include/linux/sunrpc/xdrgen/nfs4_2.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Generated by xdrgen. Manual edits will be lost. */ +/* XDR specification file: ../../Documentation/sunrpc/xdr/nfs4_2.x */ +/* XDR specification modification time: Fri Jun 12 10:44:36 2026 */ + +#ifndef _LINUX_XDRGEN_NFS4_2_DEF_H +#define _LINUX_XDRGEN_NFS4_2_DEF_H + +#include <linux/types.h> +#include <linux/sunrpc/xdrgen/_defs.h> + +typedef bool fattr4_uncacheable_file_data; + +enum { FATTR4_UNCACHEABLE_FILE_DATA = 87 }; + +#define NFS4_fattr4_uncacheable_file_data_sz \ + (XDR_bool) + +#endif /* _LINUX_XDRGEN_NFS4_2_DEF_H */ -- 2.47.3