diff options
-rw-r--r-- | sys/conf/files | 1 | ||||
-rw-r--r-- | sys/modules/Makefile | 1 | ||||
-rw-r--r-- | sys/modules/nfssvc/Makefile | 9 | ||||
-rw-r--r-- | sys/nfsserver/nfs.h | 16 | ||||
-rw-r--r-- | sys/nfsserver/nfs_srvkrpc.c | 18 | ||||
-rw-r--r-- | sys/nfsserver/nfs_srvsubs.c | 17 | ||||
-rw-r--r-- | sys/nfsserver/nfs_syscalls.c | 20 |
7 files changed, 33 insertions, 49 deletions
diff --git a/sys/conf/files b/sys/conf/files index e2fe0f0..b7d30e0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2469,6 +2469,7 @@ nfsserver/nfs_srvsock.c optional nfsserver nfsserver/nfs_srvcache.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver nfsserver/nfs_syscalls.c optional nfsserver +nfs/nfs_nfssvc.c optional nfsserver nlm/nlm_advlock.c optional nfslockd nfsclient nlm/nlm_prot_clnt.c optional nfslockd nlm/nlm_prot_impl.c optional nfslockd diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 4329717..969f704 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -187,6 +187,7 @@ SUBDIR= ${_3dfx} \ nfsclient \ nfslockd \ nfsserver \ + nfssvc \ nge \ nmdm \ ${_nsp} \ diff --git a/sys/modules/nfssvc/Makefile b/sys/modules/nfssvc/Makefile new file mode 100644 index 0000000..0073d13 --- /dev/null +++ b/sys/modules/nfssvc/Makefile @@ -0,0 +1,9 @@ + +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../nfs +KMOD= nfssvc +SRCS= nfs_nfssvc.c \ + opt_nfs.h + +.include <bsd.kmod.mk> diff --git a/sys/nfsserver/nfs.h b/sys/nfsserver/nfs.h index 2709377..b47ffea 100644 --- a/sys/nfsserver/nfs.h +++ b/sys/nfsserver/nfs.h @@ -40,6 +40,8 @@ #include "opt_nfs.h" #endif +#include <nfs/nfssvc.h> + /* * Tunable constants for nfs */ @@ -116,13 +118,6 @@ struct nfsd_nfsd_args { #endif /* - * Flags for nfssvc() system call. - */ -#define NFSSVC_OLDNFSD 0x004 -#define NFSSVC_ADDSOCK 0x008 -#define NFSSVC_NFSD 0x010 - -/* * vfs.nfsrv sysctl(3) identifiers */ #define NFS_NFSRVSTATS 1 /* struct: struct nfsrvstats */ @@ -447,6 +442,13 @@ int nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct mbuf **mrq); int nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct mbuf **mrq); +/* + * #ifdef _SYS_SYSPROTO_H_ so that it is only defined when sysproto.h + * has been included, so that "struct nfssvc_args" is defined. + */ +#ifdef _SYS_SYSPROTO_H_ +int nfssvc_nfsserver(struct thread *, struct nfssvc_args *); +#endif #endif /* _KERNEL */ #endif diff --git a/sys/nfsserver/nfs_srvkrpc.c b/sys/nfsserver/nfs_srvkrpc.c index c6896ff..77bdec8 100644 --- a/sys/nfsserver/nfs_srvkrpc.c +++ b/sys/nfsserver/nfs_srvkrpc.c @@ -151,6 +151,9 @@ int32_t (*nfsrv3_procs[NFS_NPROCS])(struct nfsrv_descript *nd, /* * NFS server system calls */ +/* + * This is now called from nfssvc() in nfs/nfs_nfssvc.c. + */ /* * Nfs server psuedo system call for the nfsd's @@ -163,25 +166,14 @@ int32_t (*nfsrv3_procs[NFS_NPROCS])(struct nfsrv_descript *nd, * - sockaddr with no IPv4-mapped addresses * - mask for both INET and INET6 families if there is IPv4-mapped overlap */ -#ifndef _SYS_SYSPROTO_H_ -struct nfssvc_args { - int flag; - caddr_t argp; -}; -#endif int -nfssvc(struct thread *td, struct nfssvc_args *uap) +nfssvc_nfsserver(struct thread *td, struct nfssvc_args *uap) { struct file *fp; struct nfsd_addsock_args addsockarg; struct nfsd_nfsd_args nfsdarg; int error; - KASSERT(!mtx_owned(&Giant), ("nfssvc(): called with Giant")); - - error = priv_check(td, PRIV_NFS_DAEMON); - if (error) - return (error); if (uap->flag & NFSSVC_ADDSOCK) { error = copyin(uap->argp, (caddr_t)&addsockarg, sizeof(addsockarg)); @@ -208,8 +200,6 @@ nfssvc(struct thread *td, struct nfssvc_args *uap) } else { error = ENXIO; } - if (error == EINTR || error == ERESTART) - error = 0; return (error); } diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index 00e5216..d154463 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -100,10 +100,6 @@ struct nfsd_head nfsd_head; int nfsd_head_flag; #endif -static int nfssvc_offset = SYS_nfssvc; -static struct sysent nfssvc_prev_sysent; -MAKE_SYSENT(nfssvc); - struct mtx nfsd_mtx; /* @@ -519,13 +515,14 @@ static const short *nfsrv_v3errmap[] = { nfsv3err_commit, }; +extern int (*nfsd_call_nfsserver)(struct thread *, struct nfssvc_args *); + /* * Called once to initialize data structures... */ static int nfsrv_modevent(module_t mod, int type, void *data) { - static int registered; int error = 0; switch (type) { @@ -560,11 +557,7 @@ nfsrv_modevent(module_t mod, int type, void *data) NFSD_UNLOCK(); #endif - error = syscall_register(&nfssvc_offset, &nfssvc_sysent, - &nfssvc_prev_sysent); - if (error) - break; - registered = 1; + nfsd_call_nfsserver = nfssvc_nfsserver; break; case MOD_UNLOAD: @@ -573,8 +566,7 @@ nfsrv_modevent(module_t mod, int type, void *data) break; } - if (registered) - syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent); + nfsd_call_nfsserver = NULL; callout_drain(&nfsrv_callout); #ifdef NFS_LEGACYRPC nfsrv_destroycache(); /* Free the server request cache */ @@ -596,6 +588,7 @@ DECLARE_MODULE(nfsserver, nfsserver_mod, SI_SUB_VFS, SI_ORDER_ANY); /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfsserver, 1); +MODULE_DEPEND(nfsserver, nfssvc, 1, 1, 1); #ifndef NFS_LEGACYRPC MODULE_DEPEND(nfsserver, krpc, 1, 1, 1); #endif diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c index 326d623..59a30a3 100644 --- a/sys/nfsserver/nfs_syscalls.c +++ b/sys/nfsserver/nfs_syscalls.c @@ -113,6 +113,9 @@ extern u_long sb_max_adj; */ /* + * This is now called from nfssvc() in nfs/nfs_nfssvc.c. + */ +/* * Nfs server psuedo system call for the nfsd's * Based on the flag value it either: * - adds a socket to the selection list @@ -123,27 +126,14 @@ extern u_long sb_max_adj; * - sockaddr with no IPv4-mapped addresses * - mask for both INET and INET6 families if there is IPv4-mapped overlap */ -#ifndef _SYS_SYSPROTO_H_ -struct nfssvc_args { - int flag; - caddr_t argp; -}; -#endif int -nfssvc(struct thread *td, struct nfssvc_args *uap) +nfssvc_nfsserver(struct thread *td, struct nfssvc_args *uap) { struct file *fp; struct sockaddr *nam; struct nfsd_addsock_args nfsdarg; int error; - KASSERT(!mtx_owned(&Giant), ("nfssvc(): called with Giant")); - - AUDIT_ARG(cmd, uap->flag); - - error = priv_check(td, PRIV_NFS_DAEMON); - if (error) - return (error); NFSD_LOCK(); while (nfssvc_sockhead_flag & SLP_INIT) { nfssvc_sockhead_flag |= SLP_WANTINIT; @@ -181,8 +171,6 @@ nfssvc(struct thread *td, struct nfssvc_args *uap) } else { error = ENXIO; } - if (error == EINTR || error == ERESTART) - error = 0; return (error); } |