Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Apr 2007 13:48:17 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 117185 for review
Message-ID:  <200704021348.l32DmHDV052429@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704021348.l32DmHDV052429>