NFSD: Remove '#include "xdr.h"' from fs/nfsd/xdr3.h

Separate the dependencies between fs/nfsd/xdr3.h and fs/nfsd/xdr.h
so that NFSD's NFSv2 and NFSv3 implementations can be converted
independently to use xdrgen.

The only reason xdr3.h includes xdr.h is to pick up the definition
of struct nfsd_fhandle. xdr3.h does not name the structure itself;
its consumers nfs3proc.c and nfs3xdr.c do, reaching the definition
through xdr3.h. That structure wraps a single struct svc_fh, which
is defined in nfsfh.h, a header both xdr.h and xdr3.h already include
via vfs.h. Move struct nfsd_fhandle next to svc_fh in nfsfh.h so the
two XDR headers share one definition and xdr3.h no longer depends on
xdr.h. nfs2acl.c, which includes both headers, then sees that single
definition instead of a clashing pair.

Stripping xdr.h to its own dependencies also removes the
transitive route by which nfsxdr.c and nfs3xdr.c reached nfsd.h.
Both expand the nfserr_* and nfs_ok status-code macros that
nfsd.h defines, so each gains a direct #include of nfsd.h in
place of the one xdr.h used to supply.

As a clean-up, the #includes at the top of both header files are
made the same.

Acked-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260916162859.2051-7-cel@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
This commit is contained in:
Chuck Lever 2026-09-16 12:28:35 -04:00
parent ffbf5434ee
commit c9d6f6ba2d
5 changed files with 11 additions and 8 deletions

View File

@ -10,8 +10,8 @@
/* FIXME: nfsacl.h is a broken header */
#include <linux/nfsacl.h>
#include <linux/gfp.h>
#include <linux/nfs3.h>
#include "cache.h"
#include "xdr.h"
#include "xdr3.h"
#include "vfs.h"

View File

@ -10,6 +10,8 @@
#include <linux/namei.h>
#include <linux/nfs3.h>
#include <linux/sunrpc/svc_xprt.h>
#include "nfsd.h"
#include "xdr3.h"
#include "auth.h"
#include "netns.h"

View File

@ -111,6 +111,11 @@ typedef struct svc_fh {
struct kstat fh_post_attr; /* full attrs after operation */
u64 fh_post_change; /* nfsv4 change; see above */
} svc_fh;
struct nfsd_fhandle {
struct svc_fh fh;
};
#define NFSD4_FH_FOREIGN (1<<0)
#define SET_FH_FLAG(c, f) ((c)->fh_flags |= (f))
#define HAS_FH_FLAG(c, f) ((c)->fh_flags & (f))

View File

@ -5,13 +5,8 @@
#define _LINUX_NFSD_XDR_H
#include <linux/vfs.h>
#include "nfsd.h"
#include "nfsfh.h"
#include "vfs.h"
struct nfsd_fhandle {
struct svc_fh fh;
};
#include "vfs.h"
struct nfsd_sattrargs {
struct svc_fh fh;

View File

@ -8,7 +8,8 @@
#ifndef _LINUX_NFSD_XDR3_H
#define _LINUX_NFSD_XDR3_H
#include "xdr.h"
#include <linux/vfs.h>
#include "vfs.h"
struct nfsd3_sattrargs {