Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lockd: Move xdr.h from include/linux/lockd/ to fs/lockd/

The lockd subsystem unnecessarily exposes internal NLM XDR type
definitions through the global include path. These definitions
are not used by any code outside fs/lockd/, making them
inappropriate for include/linux/lockd/.

Moving xdr.h to fs/lockd/ narrows the API surface and clarifies
that these types are internal implementation details. The
comment in linux/lockd/bind.h stating xdr.h was needed for
"xdr-encoded error codes" is stale: no lockd API consumers use
those codes.

Forward declarations for struct nfs_fh and struct file_lock are
added to bind.h because their definitions were previously pulled
in transitively through xdr.h. Additionally, nfs3proc.c and
proc.c need explicit includes of filelock.h for FL_CLOSE and
for accessing struct file_lock members, respectively.

Built and tested with lockd client/server operations. No
functional change.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+8 -9
+1 -1
fs/lockd/lockd.h
··· 15 15 #include <linux/refcount.h> 16 16 #include <linux/utsname.h> 17 17 #include <linux/lockd/bind.h> 18 - #include <linux/lockd/xdr.h> 18 + #include "xdr.h" 19 19 #include <linux/sunrpc/debug.h> 20 20 #include <linux/sunrpc/svc.h> 21 21
+1
fs/nfs/nfs3proc.c
··· 16 16 #include <linux/nfs3.h> 17 17 #include <linux/nfs_fs.h> 18 18 #include <linux/nfs_page.h> 19 + #include <linux/filelock.h> 19 20 #include <linux/lockd/bind.h> 20 21 #include <linux/nfs_mount.h> 21 22 #include <linux/freezer.h>
+1
fs/nfs/proc.c
··· 41 41 #include <linux/nfs2.h> 42 42 #include <linux/nfs_fs.h> 43 43 #include <linux/nfs_page.h> 44 + #include <linux/filelock.h> 44 45 #include <linux/lockd/bind.h> 45 46 #include <linux/freezer.h> 46 47 #include "internal.h"
+2 -3
include/linux/lockd/bind.h
··· 11 11 #define LINUX_LOCKD_BIND_H 12 12 13 13 #include <linux/lockd/nlm.h> 14 - /* need xdr-encoded error codes too, so... */ 15 - #include <linux/lockd/xdr.h> 16 14 17 - /* Dummy declarations */ 15 + struct file_lock; 16 + struct nfs_fh; 18 17 struct svc_rqst; 19 18 struct rpc_task; 20 19 struct rpc_clnt;
+3 -5
include/linux/lockd/xdr.h fs/lockd/xdr.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /* 3 - * linux/include/linux/lockd/xdr.h 4 - * 5 3 * XDR types for the NLM protocol 6 4 * 7 5 * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de> 8 6 */ 9 7 10 - #ifndef LOCKD_XDR_H 11 - #define LOCKD_XDR_H 8 + #ifndef _LOCKD_XDR_H 9 + #define _LOCKD_XDR_H 12 10 13 11 #include <linux/fs.h> 14 12 #include <linux/filelock.h> ··· 108 110 bool nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 109 111 bool nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 110 112 111 - #endif /* LOCKD_XDR_H */ 113 + #endif /* _LOCKD_XDR_H */