PERFORCE change 111455 for review

Marko Zec zec at FreeBSD.org
Mon Dec 11 05:09:00 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=111455

Change 111455 by zec at 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),


More information about the p4-projects mailing list