Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2003 15:33:00 -0700 (PDT)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 38151 for review
Message-ID:  <200309162233.h8GMX0ZF048724@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=38151

Change 38151 by sam@sam_ebb on 2003/09/16 15:32:18

	cleanup module unload: must hold lock to call bridge_off;
	remove bogus distinction between building as a module and
	a static kernel component

Affected files ...

.. //depot/projects/netperf/sys/net/bridge.c#7 edit

Differences ...

==== //depot/projects/netperf/sys/net/bridge.c#7 (text+ko) ====

@@ -1213,7 +1213,6 @@
     return 0 ;
 }
 
-#ifdef KLD_MODULE
 static void
 bdgdestroy(void)
 {
@@ -1222,17 +1221,15 @@
     bdgtakeifaces_ptr = NULL;
 
     callout_stop(&bdg_callout);
+    BDG_LOCK();
     bridge_off();
 
-    if (clusters)
-	free(clusters, M_IFADDR);
     if (ifp2sc) {
 	free(ifp2sc, M_IFADDR);
 	ifp2sc = NULL;
     }
     BDG_LOCK_DESTROY();
 }
-#endif /* KLD_MODULE */
 
 /*
  * initialization code, both for static and dynamic loading.
@@ -1240,28 +1237,22 @@
 static int
 bridge_modevent(module_t mod, int type, void *unused)
 {
-	int err = 0 ;
+	int err;
 
 	switch (type) {
 	case MOD_LOAD:
-		if (BDG_LOADED) {
+		if (BDG_LOADED)
 			err = EEXIST;
-			break ;
-		}
-		err = bdginit();
+		else
+			err = bdginit();
 		break;
 	case MOD_UNLOAD:
-#if !defined(KLD_MODULE)
-		printf("bridge statically compiled, cannot unload\n");
-		err = EINVAL ;
-#else
-		/* XXX lock */
 		do_bridge = 0;
 		bdgdestroy();
-#endif
+		err = 0;
 		break;
 	default:
-		err = EINVAL ;
+		err = EINVAL;
 		break;
 	}
 	return err;



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