FBSD: Use syscall "helper" functions

syscall_register/syscall_deregister were effectively removed in
r329647. Use syscall_helper_register/syscall_helper_unregister
instead, which have existed since r205321 in FreeBSD 9.

Change-Id: I2d5e3101024a44c18395d7eb95c644df6005e0aa
Reviewed-on: https://gerrit.openafs.org/13858
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Tim Creech 2019-08-29 21:55:05 -04:00 committed by Benjamin Kaduk
parent 3bc541743b
commit 2add334454
2 changed files with 17 additions and 21 deletions

View File

@ -20,28 +20,26 @@ int afs_pbuf_freecnt = -1;
extern int Afs_xsetgroups(); extern int Afs_xsetgroups();
extern int afs_xioctl(); extern int afs_xioctl();
static struct sysent old_sysent; static struct syscall_helper_data afs_syscalls[] = {
{
static struct sysent afs_sysent = { .syscall_no = AFS_SYSCALL,
5, /* int sy_narg */ .new_sysent = {
(sy_call_t *) afs3_syscall, /* sy_call_t *sy_call */ .sy_narg = 5,
AUE_NULL, /* au_event_t sy_auevent */ .sy_call = (sy_call_t *)afs3_syscall,
NULL, /* systrace_args_funt_t sy_systrace_args_func */ .sy_auevent = AUE_NULL,
0, /* u_int32_t sy_entry */ },
0, /* u_int32_t sy_return */ },
0, /* u_int32_t sy_flags */ SYSCALL_INIT_LAST
0 /* u_int32_t sy_thrcnt */
}; };
static int static int
afs_init(struct vfsconf *vfc) afs_init(struct vfsconf *vfc)
{ {
int code; int code;
int offset = AFS_SYSCALL; #if defined(FBSD_SYSCALL_REGISTER_TAKES_FLAGS)
#if defined(FBSD_SYSCALL_REGISTER_FOUR_ARGS) code = syscall_helper_register(afs_syscalls, 0);
code = syscall_register(&offset, &afs_sysent, &old_sysent, 0);
#else #else
code = syscall_register(&offset, &afs_sysent, &old_sysent); code = syscall_helper_register(afs_syscalls);
#endif #endif
if (code) { if (code) {
printf("AFS_SYSCALL in use, error %i. aborting\n", code); printf("AFS_SYSCALL in use, error %i. aborting\n", code);
@ -55,12 +53,10 @@ afs_init(struct vfsconf *vfc)
static int static int
afs_uninit(struct vfsconf *vfc) afs_uninit(struct vfsconf *vfc)
{ {
int offset = AFS_SYSCALL;
if (afs_globalVFS) if (afs_globalVFS)
return EBUSY; return EBUSY;
syscall_deregister(&offset, &old_sysent);
return 0; return syscall_helper_unregister(afs_syscalls);
} }
static int static int

View File

@ -115,9 +115,9 @@ enum vcexcl { NONEXCL, EXCL };
#define FBSD_IFA_IFWITHNET_THREE_ARGS #define FBSD_IFA_IFWITHNET_THREE_ARGS
#endif #endif
/* r273707 added a flags argument to syscall_register() */ /* r273707 added a flags argument to syscall_register/syscall_helper_register */
#if __FreeBSD_version >= 1100041 #if __FreeBSD_version >= 1100041
#define FBSD_SYSCALL_REGISTER_FOUR_ARGS #define FBSD_SYSCALL_REGISTER_TAKES_FLAGS
#endif #endif
/* r285819 eliminated b_saveaddr from struct buf */ /* r285819 eliminated b_saveaddr from struct buf */