PERFORCE change 167090 for review
Julian Elischer
julian at FreeBSD.org
Fri Aug 7 16:54:34 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167090
Change 167090 by julian at julian-mac on 2009/08/07 16:54:11
Better examples for shutdown
Affected files ...
.. //depot/projects/vimage/porting_to_vimage.txt#12 edit
Differences ...
==== //depot/projects/vimage/porting_to_vimage.txt#12 (text+ko) ====
@@ -1,4 +1,4 @@
-July 13 2008
+July 7 2009
Julian Elischer
===================
@@ -299,6 +299,22 @@
break;
case MOD_SHUTDOWN:
+ /*
+ * this is called once but you may want to shut down
+ * things in each jail.
+ */
+ {
+ VNET_ITERATOR_DECL(vnet_iter);
+ VNET_LIST_RLOCK();
+ VNET_FOREACH(vnet_iter) {
+ CURVNET_SET(vnet_iter);
+ mymod_vnet_uninit(NULL);
+ CURVNET_RESTORE();
+ }
+ VNET_LIST_RUNLOCK();
+ }
+ /* you may need to shutdown something global. */
+ mymod_destroy();
break;
default:
@@ -358,8 +374,6 @@
On system shutdown: [check/fix this ]
MODEVENT(shutdown)
- ? VNET_SYSUNINIT called for every jail/vnet
- ? SYSUNINIT
NOTICE that while the order of the SYSINIT and VNET_SYSINIT is reversed from
that of SYSUNINIT and VNET_SYSUNINIT, MODEVENTS do not follow
@@ -382,25 +396,7 @@
(but not the modevent).
Sometimes there is a need to iterate through the vnets.
-The following code should be used as a guide.
-
- VNET_ITERATOR_DECL(vnet_iter);
- [...]
-
- [...]
- VNET_LIST_RLOCK();
- VNET_FOREACH(vnet_iter) {
- CURVNET_SET(vnet_iter);
- [...]
- do work,
- including calling code that assumes we have curvnet set.
- [...]
- CURVNET_RESTORE();
- }
- VNET_LIST_RUNLOCK();
- [...]
-}
-
+See the modevent shutdown handler (above) for an example of how to do this.
finally:
The command to make a new jail with a new vnet:
More information about the p4-projects
mailing list