From owner-p4-projects@FreeBSD.ORG Mon Apr 2 13:48:18 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 117C716A407; Mon, 2 Apr 2007 13:48:18 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8B0916A404 for ; Mon, 2 Apr 2007 13:48:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 991DF13C457 for ; Mon, 2 Apr 2007 13:48:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l32DmHhT052432 for ; Mon, 2 Apr 2007 13:48:17 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l32DmHDV052429 for perforce@freebsd.org; Mon, 2 Apr 2007 13:48:17 GMT (envelope-from jhb@freebsd.org) Date: Mon, 2 Apr 2007 13:48:17 GMT Message-Id: <200704021348.l32DmHDV052429@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 117185 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2007 13:48:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=117185 Change 117185 by jhb@jhb_mutex on 2007/04/02 13:47:39 Merge in MAKE_SYSENT() macro from jhb_lock. Affected files ... .. //depot/projects/smpng/sys/nfsserver/nfs_srvsubs.c#38 integrate .. //depot/projects/smpng/sys/sys/sysent.h#24 integrate Differences ... ==== //depot/projects/smpng/sys/nfsserver/nfs_srvsubs.c#38 (text+ko) ==== @@ -100,11 +100,7 @@ static int nfssvc_offset = SYS_nfssvc; static struct sysent nfssvc_prev_sysent; -static struct sysent nfssvc_sysent = { - sizeof(struct nfssvc_args) / sizeof(register_t), - (sy_call_t *)&nfssvc, - AUE_NFS_SVC -}; +MAKE_SYSENT(nfssvc); struct mtx nfsd_mtx; @@ -527,6 +523,7 @@ static int nfsrv_modevent(module_t mod, int type, void *data) { + static int registered; int error = 0; NET_LOCK_GIANT(); @@ -559,8 +556,11 @@ NFSD_UNLOCK(); nfsrv_timer(0); - (void)syscall_register(&nfssvc_offset, &nfssvc_sysent, + error = syscall_register(&nfssvc_offset, &nfssvc_sysent, &nfssvc_prev_sysent); + if (error) + break; + registered = 1; break; case MOD_UNLOAD: @@ -569,8 +569,10 @@ break; } + if (registered) + syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent); callout_drain(&nfsrv_callout); - syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent); + nfsrv_destroycache(); /* Free the server request cache */ nfsrv_destroycache(); /* Free the server request cache */ mtx_destroy(&nfsd_mtx); break; ==== //depot/projects/smpng/sys/sys/sysent.h#24 (text+ko) ==== @@ -119,6 +119,14 @@ struct sysent old_sysent; /* old sysent */ }; +#define MAKE_SYSENT(syscallname) \ +static struct sysent syscallname##_sysent = { \ + (sizeof(struct syscallname ## _args ) \ + / sizeof(register_t)), \ + (sy_call_t *)& syscallname, \ + SYS_AUE_##syscallname \ +} + #define SYSCALL_MODULE(name, offset, new_sysent, evh, arg) \ static struct syscall_module_data name##_syscall_mod = { \ evh, arg, offset, new_sysent, { 0, NULL, AUE_NULL } \ @@ -133,12 +141,7 @@ #define SYSCALL_MODULE_HELPER(syscallname) \ static int syscallname##_syscall = SYS_##syscallname; \ -static struct sysent syscallname##_sysent = { \ - (sizeof(struct syscallname ## _args ) \ - / sizeof(register_t)), \ - (sy_call_t *)& syscallname, \ - SYS_AUE_##syscallname \ -}; \ +MAKE_SYSENT(syscallname); \ SYSCALL_MODULE(syscallname, \ & syscallname##_syscall, & syscallname##_sysent, \ NULL, NULL);