Modernize nfssvc(2) registartion.
Use syscall_helper_register() to register syscalls and do it through the module interface rather than sysinit. This pattern is more common and easier to understand. Reviewed by: jhb Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14232
This commit is contained in:
parent
56b4f63142
commit
de55bbfc5b
@ -56,9 +56,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <nfs/nfssvc.h>
|
#include <nfs/nfssvc.h>
|
||||||
|
|
||||||
static int nfssvc_offset = SYS_nfssvc;
|
static struct syscall_helper_data nfssvc_syscalls[] = {
|
||||||
static struct sysent nfssvc_prev_sysent;
|
SYSCALL_INIT_HELPER(nfssvc),
|
||||||
MAKE_SYSENT(nfssvc);
|
SYSCALL_INIT_LAST
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This tiny module simply handles the nfssvc() system call. The other
|
* This tiny module simply handles the nfssvc() system call. The other
|
||||||
@ -119,16 +120,12 @@ sys_nfssvc(struct thread *td, struct nfssvc_args *uap)
|
|||||||
static int
|
static int
|
||||||
nfssvc_modevent(module_t mod, int type, void *data)
|
nfssvc_modevent(module_t mod, int type, void *data)
|
||||||
{
|
{
|
||||||
static int registered;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MOD_LOAD:
|
case MOD_LOAD:
|
||||||
error = syscall_register(&nfssvc_offset, &nfssvc_sysent,
|
error = syscall_helper_register(nfssvc_syscalls,
|
||||||
&nfssvc_prev_sysent, SY_THR_STATIC_KLD);
|
SY_THR_STATIC_KLD);
|
||||||
if (error)
|
|
||||||
break;
|
|
||||||
registered = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MOD_UNLOAD:
|
case MOD_UNLOAD:
|
||||||
@ -137,9 +134,7 @@ nfssvc_modevent(module_t mod, int type, void *data)
|
|||||||
error = EBUSY;
|
error = EBUSY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (registered)
|
syscall_helper_unregister(nfssvc_syscalls);
|
||||||
syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent);
|
|
||||||
registered = 0;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = EOPNOTSUPP;
|
error = EOPNOTSUPP;
|
||||||
|
Loading…
Reference in New Issue
Block a user