diff options
author | jhb <jhb@FreeBSD.org> | 2007-04-02 13:53:26 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-04-02 13:53:26 +0000 |
commit | 1ad11dc4f1125b6e8655ab7e123911f5a2c152ba (patch) | |
tree | c3eb704274d5952e90c05e45007954674e3d3208 /sys/nfsserver | |
parent | 6d9ee961ef98540193347377e83fbc165737a272 (diff) | |
download | FreeBSD-src-1ad11dc4f1125b6e8655ab7e123911f5a2c152ba.zip FreeBSD-src-1ad11dc4f1125b6e8655ab7e123911f5a2c152ba.tar.gz |
- Split out the part of SYSCALL_MODULE_HELPER() that builds a 'struct
sysent' for a new system call into a new MAKE_SYSENT() macro.
- Use MAKE_SYSENT() to build a full sysent for the nfssvc system call in
the NFS server and use syscall_register() and syscall_deregister() to
manage the nfssvc system call entry instead of manually frobbing the
sysent[] array.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r-- | sys/nfsserver/nfs_srvsubs.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index b064fb3..374bf26 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -98,8 +98,9 @@ int nfssvc_sockhead_flag; struct nfsd_head nfsd_head; int nfsd_head_flag; -static int nfs_prev_nfssvc_sy_narg; -static sy_call_t *nfs_prev_nfssvc_sy_call; +static int nfssvc_offset = SYS_nfssvc; +static struct sysent nfssvc_prev_sysent; +MAKE_SYSENT(nfssvc); struct mtx nfsd_mtx; @@ -522,6 +523,7 @@ static const short *nfsrv_v3errmap[] = { static int nfsrv_modevent(module_t mod, int type, void *data) { + static int registered; int error = 0; NET_LOCK_GIANT(); @@ -554,11 +556,11 @@ nfsrv_modevent(module_t mod, int type, void *data) NFSD_UNLOCK(); nfsrv_timer(0); - /* XXX: Should use SYSCALL_MODULE() */ - nfs_prev_nfssvc_sy_narg = sysent[SYS_nfssvc].sy_narg; - sysent[SYS_nfssvc].sy_narg = 2; - nfs_prev_nfssvc_sy_call = sysent[SYS_nfssvc].sy_call; - sysent[SYS_nfssvc].sy_call = (sy_call_t *)nfssvc; + error = syscall_register(&nfssvc_offset, &nfssvc_sysent, + &nfssvc_prev_sysent); + if (error) + break; + registered = 1; break; case MOD_UNLOAD: @@ -567,9 +569,10 @@ nfsrv_modevent(module_t mod, int type, void *data) break; } + if (registered) + syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent); callout_drain(&nfsrv_callout); - sysent[SYS_nfssvc].sy_narg = nfs_prev_nfssvc_sy_narg; - sysent[SYS_nfssvc].sy_call = nfs_prev_nfssvc_sy_call; + nfsrv_destroycache(); /* Free the server request cache */ nfsrv_destroycache(); /* Free the server request cache */ mtx_destroy(&nfsd_mtx); break; |