Factor out the code shared between NFS client and server into its own
module. With r203732 it became apparent that creating the sysctl nodes twice causes at least a warning, however the whole code shouldn't be present twice in the first place. Discussed with: rmacklem
This commit is contained in:
parent
7ff08436fc
commit
b06b8fe3a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=203968
8
sys/modules/nfs_common/Makefile
Normal file
8
sys/modules/nfs_common/Makefile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# $FreeBSD$
|
||||||
|
|
||||||
|
.PATH: ${.CURDIR}/../../nfs
|
||||||
|
|
||||||
|
KMOD= nfs_common
|
||||||
|
SRCS= nfs_common.c opt_nfs.h vnode_if.h
|
||||||
|
|
||||||
|
.include <bsd.kmod.mk>
|
@ -1,11 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../nfs ${.CURDIR}/../../rpc
|
.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../rpc
|
||||||
|
|
||||||
KMOD= nfsclient
|
KMOD= nfsclient
|
||||||
SRCS= vnode_if.h \
|
SRCS= vnode_if.h \
|
||||||
nfs_bio.c nfs_lock.c nfs_node.c nfs_subs.c nfs_nfsiod.c \
|
nfs_bio.c nfs_lock.c nfs_node.c nfs_subs.c nfs_nfsiod.c \
|
||||||
nfs_vfsops.c nfs_vnops.c nfs_common.c nfs_krpc.c \
|
nfs_vfsops.c nfs_vnops.c nfs_krpc.c \
|
||||||
opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h
|
opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h
|
||||||
SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h
|
SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs
|
.PATH: ${.CURDIR}/../../nfsserver
|
||||||
KMOD= nfsserver
|
KMOD= nfsserver
|
||||||
SRCS= vnode_if.h \
|
SRCS= vnode_if.h \
|
||||||
nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c nfs_common.c \
|
nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \
|
||||||
opt_mac.h \
|
opt_mac.h \
|
||||||
opt_kgssapi.h \
|
opt_kgssapi.h \
|
||||||
opt_nfs.h
|
opt_nfs.h
|
||||||
|
@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
|
#include <sys/module.h>
|
||||||
#include <sys/sysent.h>
|
#include <sys/sysent.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
@ -79,15 +80,15 @@ nfstype nfsv3_type[9] = {
|
|||||||
static void *nfsm_dissect_xx_sub(int s, struct mbuf **md, caddr_t *dpos,
|
static void *nfsm_dissect_xx_sub(int s, struct mbuf **md, caddr_t *dpos,
|
||||||
int how);
|
int how);
|
||||||
|
|
||||||
SYSCTL_DECL(_vfs_nfs);
|
SYSCTL_NODE(_vfs, OID_AUTO, nfs_common, CTLFLAG_RD, 0, "NFS common support");
|
||||||
|
|
||||||
static int nfs_realign_test;
|
static int nfs_realign_test;
|
||||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RD, &nfs_realign_test,
|
SYSCTL_INT(_vfs_nfs_common, OID_AUTO, realign_test, CTLFLAG_RD,
|
||||||
0, "Number of realign tests done");
|
&nfs_realign_test, 0, "Number of realign tests done");
|
||||||
|
|
||||||
static int nfs_realign_count;
|
static int nfs_realign_count;
|
||||||
SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RD, &nfs_realign_count,
|
SYSCTL_INT(_vfs_nfs_common, OID_AUTO, realign_count, CTLFLAG_RD,
|
||||||
0, "Number of mbuf realignments done");
|
&nfs_realign_count, 0, "Number of mbuf realignments done");
|
||||||
|
|
||||||
u_quad_t
|
u_quad_t
|
||||||
nfs_curusec(void)
|
nfs_curusec(void)
|
||||||
@ -404,3 +405,12 @@ nfs_realign(struct mbuf **pm, int how)
|
|||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static moduledata_t nfs_common_mod = {
|
||||||
|
"nfs_common",
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_MODULE(nfs_common, nfs_common_mod, SI_SUB_VFS, SI_ORDER_ANY);
|
||||||
|
MODULE_VERSION(nfs_common, 1);
|
||||||
|
@ -147,6 +147,7 @@ MODULE_DEPEND(nfs, krpc, 1, 1, 1);
|
|||||||
#ifdef KGSSAPI
|
#ifdef KGSSAPI
|
||||||
MODULE_DEPEND(nfs, kgssapi, 1, 1, 1);
|
MODULE_DEPEND(nfs, kgssapi, 1, 1, 1);
|
||||||
#endif
|
#endif
|
||||||
|
MODULE_DEPEND(nfs, nfs_common, 1, 1, 1);
|
||||||
|
|
||||||
static struct nfs_rpcops nfs_rpcops = {
|
static struct nfs_rpcops nfs_rpcops = {
|
||||||
nfs_readrpc,
|
nfs_readrpc,
|
||||||
|
@ -560,6 +560,7 @@ DECLARE_MODULE(nfsserver, nfsserver_mod, SI_SUB_VFS, SI_ORDER_ANY);
|
|||||||
MODULE_VERSION(nfsserver, 1);
|
MODULE_VERSION(nfsserver, 1);
|
||||||
MODULE_DEPEND(nfsserver, nfssvc, 1, 1, 1);
|
MODULE_DEPEND(nfsserver, nfssvc, 1, 1, 1);
|
||||||
MODULE_DEPEND(nfsserver, krpc, 1, 1, 1);
|
MODULE_DEPEND(nfsserver, krpc, 1, 1, 1);
|
||||||
|
MODULE_DEPEND(nfsserver, nfs_common, 1, 1, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up nameidata for a lookup() call and do it.
|
* Set up nameidata for a lookup() call and do it.
|
||||||
|
Loading…
Reference in New Issue
Block a user