From owner-svn-src-all@freebsd.org Thu Feb 8 20:09:43 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E648CF003FF; Thu, 8 Feb 2018 20:09:42 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B52D7A850; Thu, 8 Feb 2018 20:09:42 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 862D91AB81; Thu, 8 Feb 2018 20:09:42 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w18K9gQW018966; Thu, 8 Feb 2018 20:09:42 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w18K9g0k018965; Thu, 8 Feb 2018 20:09:42 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201802082009.w18K9g0k018965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 8 Feb 2018 20:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329025 - head/sys/nfs X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/nfs X-SVN-Commit-Revision: 329025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2018 20:09:43 -0000 Author: brooks Date: Thu Feb 8 20:09:42 2018 New Revision: 329025 URL: https://svnweb.freebsd.org/changeset/base/329025 Log: 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 Modified: head/sys/nfs/nfs_nfssvc.c Modified: head/sys/nfs/nfs_nfssvc.c ============================================================================== --- head/sys/nfs/nfs_nfssvc.c Thu Feb 8 19:55:03 2018 (r329024) +++ head/sys/nfs/nfs_nfssvc.c Thu Feb 8 20:09:42 2018 (r329025) @@ -56,9 +56,10 @@ __FBSDID("$FreeBSD$"); #include -static int nfssvc_offset = SYS_nfssvc; -static struct sysent nfssvc_prev_sysent; -MAKE_SYSENT(nfssvc); +static struct syscall_helper_data nfssvc_syscalls[] = { + SYSCALL_INIT_HELPER(nfssvc), + SYSCALL_INIT_LAST +}; /* * 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 nfssvc_modevent(module_t mod, int type, void *data) { - static int registered; int error = 0; switch (type) { case MOD_LOAD: - error = syscall_register(&nfssvc_offset, &nfssvc_sysent, - &nfssvc_prev_sysent, SY_THR_STATIC_KLD); - if (error) - break; - registered = 1; + error = syscall_helper_register(nfssvc_syscalls, + SY_THR_STATIC_KLD); break; case MOD_UNLOAD: @@ -137,9 +134,7 @@ nfssvc_modevent(module_t mod, int type, void *data) error = EBUSY; break; } - if (registered) - syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent); - registered = 0; + syscall_helper_unregister(nfssvc_syscalls); break; default: error = EOPNOTSUPP;