From 2add334454019b4a8fd979fb16da686cf93b56c6 Mon Sep 17 00:00:00 2001 From: Tim Creech Date: Thu, 29 Aug 2019 21:55:05 -0400 Subject: [PATCH] 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 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/FBSD/osi_vfsops.c | 34 +++++++++++++++------------------ src/config/param.generic_fbsd.h | 4 ++-- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index b40cc73a4b..f160e7bad0 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -20,28 +20,26 @@ int afs_pbuf_freecnt = -1; extern int Afs_xsetgroups(); extern int afs_xioctl(); -static struct sysent old_sysent; - -static struct sysent afs_sysent = { - 5, /* int sy_narg */ - (sy_call_t *) afs3_syscall, /* sy_call_t *sy_call */ - AUE_NULL, /* au_event_t sy_auevent */ - NULL, /* systrace_args_funt_t sy_systrace_args_func */ - 0, /* u_int32_t sy_entry */ - 0, /* u_int32_t sy_return */ - 0, /* u_int32_t sy_flags */ - 0 /* u_int32_t sy_thrcnt */ +static struct syscall_helper_data afs_syscalls[] = { + { + .syscall_no = AFS_SYSCALL, + .new_sysent = { + .sy_narg = 5, + .sy_call = (sy_call_t *)afs3_syscall, + .sy_auevent = AUE_NULL, + }, + }, + SYSCALL_INIT_LAST }; static int afs_init(struct vfsconf *vfc) { int code; - int offset = AFS_SYSCALL; -#if defined(FBSD_SYSCALL_REGISTER_FOUR_ARGS) - code = syscall_register(&offset, &afs_sysent, &old_sysent, 0); +#if defined(FBSD_SYSCALL_REGISTER_TAKES_FLAGS) + code = syscall_helper_register(afs_syscalls, 0); #else - code = syscall_register(&offset, &afs_sysent, &old_sysent); + code = syscall_helper_register(afs_syscalls); #endif if (code) { printf("AFS_SYSCALL in use, error %i. aborting\n", code); @@ -55,12 +53,10 @@ afs_init(struct vfsconf *vfc) static int afs_uninit(struct vfsconf *vfc) { - int offset = AFS_SYSCALL; - if (afs_globalVFS) return EBUSY; - syscall_deregister(&offset, &old_sysent); - return 0; + + return syscall_helper_unregister(afs_syscalls); } static int diff --git a/src/config/param.generic_fbsd.h b/src/config/param.generic_fbsd.h index f100f4f992..e09158b952 100644 --- a/src/config/param.generic_fbsd.h +++ b/src/config/param.generic_fbsd.h @@ -115,9 +115,9 @@ enum vcexcl { NONEXCL, EXCL }; #define FBSD_IFA_IFWITHNET_THREE_ARGS #endif -/* r273707 added a flags argument to syscall_register() */ +/* r273707 added a flags argument to syscall_register/syscall_helper_register */ #if __FreeBSD_version >= 1100041 -#define FBSD_SYSCALL_REGISTER_FOUR_ARGS +#define FBSD_SYSCALL_REGISTER_TAKES_FLAGS #endif /* r285819 eliminated b_saveaddr from struct buf */