PERFORCE change 149518 for review
Julian Elischer
julian at FreeBSD.org
Wed Sep 10 07:50:20 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=149518
Change 149518 by julian at julian_trafmon1 on 2008/09/10 07:49:56
Show how to iterate through vnets
Affected files ...
.. //depot/projects/vimage/porting_to_vimage.txt#8 edit
Differences ...
==== //depot/projects/vimage/porting_to_vimage.txt#8 (text+ko) ====
@@ -338,6 +338,35 @@
[...]
}
+/*
+ * A function which on entry has no idea of which vnet it is on
+ * and needs to look at them all for some reason.
+ * NOTE! if this code is running in a thread that
+ * does nothing else, or otherwise doesn't care about which
+ * vnet it is on then the steps that save and restore the previous vnet
+ * need not be done. (Marked with /* XXX */)
+ */
+void
+foo_tick(void)
+{
+ VNET_ITERATOR_DECL(vnet_iter);
+ [...]
+
+ [...]
+ VNET_LIST_REF();
+ VNET_FOREACH(vnet_iter) {
+ CURVNET_SET(vnet_iter);
+ INIT_VNET_NET(vnet_iter);
+ [...]
+ do work,
+ including calling code that assumes we have curvnet set.
+ [...]
+ CURVNET_RESTORE(); /* XXX */
+ }
+ VNET_LIST_UNREF();
+ [...]
+}
+
#if (defined(VIMAGE) || defined(FUTURE))
static int vnet_foo_iattach(const void *unused)
{
More information about the p4-projects
mailing list