Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Dec 2006 13:08:58 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 111455 for review
Message-ID:  <200612111308.kBBD8w8b066045@repoman.freebsd.org>

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

Change 111455 by zec@zec_tca51 on 2006/12/11 13:08:33

	Add an assert catching vnet modules that have exported an
	attach interface but have not set their initialization ordering
	priority flag.
	
	The first catch of the day is netgraph.  Additionally, fix a bug		where vnet_netgraph_iattach was recursively calling itself.

Affected files ...

.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#9 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_base.c#3 edit

Differences ...

==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#9 (text+ko) ====

@@ -85,12 +85,15 @@
 {
 	/*
 	 * XXX we support only statically assigned module IDs at the time.
-	 * In principle modules should be able to be dynamically assigned
-	 * an ID at registration time.
+	 * In principle modules should be able to get a dynamically
+	 * assigned ID at registration time.
 	 */
 	
-	VNET_ASSERT(modinfo->id > 0 || modinfo->id < VNET_MOD_MAX)
-	VNET_ASSERT(vnet_modules[modinfo->id].modinfo == NULL)
+	VNET_ASSERT(modinfo->id > 0 || modinfo->id < VNET_MOD_MAX);
+	VNET_ASSERT(vnet_modules[modinfo->id].modinfo == NULL);
+	VNET_ASSERT(modinfo->i_attach == NULL || (modinfo->i_attach &&
+		    ((modinfo->flags & VNET_MFLAG_ORDER_1ST) ||
+		     (modinfo->flags & VNET_MFLAG_ORDER_2ND))));
 
 	vnet_modules[modinfo->id].modinfo = modinfo;
 	TAILQ_INSERT_TAIL(&vnet_modlink_head,

==== //depot/projects/vimage/src/sys/netgraph/ng_base.c#3 (text+ko) ====

@@ -243,6 +243,7 @@
 
 static struct vnet_modinfo vnet_netgraph_modinfo = {
         .id             = VNET_MOD_NETGRAPH,
+	.flags		= VNET_MFLAG_ORDER_2ND,
         .name           = "netgraph",
         .symmap         = NULL,
         .i_attach       = vnet_netgraph_iattach,
@@ -3131,7 +3132,6 @@
 	struct vnet_netgraph *vnet_netgraph;
  
 	if (curvnetb == &vnetb_0) {
-		vnet_mod_register(&vnet_netgraph_modinfo);
 		vnet_netgraph = &vnet_netgraph_0;
 	} else {
 		vnet_netgraph = malloc(sizeof(struct vnet_netgraph),



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