Print this page
14019 Allow more control over zone init exit actions
Portions contributed by: Joshua M. Clulow <jmc@joyent.com>
Portions contributed by: Andy Fiddaman <andy@omnios.org>
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
Approved by: Robert Mustacchi <rm@fingolfin.org>

@@ -61,10 +61,12 @@
 #define DTD_ELEM_LOGIN_CMD      ((const xmlChar *) "login_cmd")
 #define DTD_ELEM_FORCELOGIN_CMD ((const xmlChar *) "forcedlogin_cmd")
 #define DTD_ELEM_MODNAME        ((const xmlChar *) "modname")
 #define DTD_ELEM_MOUNT          ((const xmlChar *) "mount")
 #define DTD_ELEM_RESTARTINIT    ((const xmlChar *) "restartinit")
+#define DTD_ELEM_RESTARTINIT0   ((const xmlChar *) "restartinit0")
+#define DTD_ELEM_RESTARTINITREBOOT      ((const xmlChar *) "restartinitreboot")
 #define DTD_ELEM_POSTATTACH     ((const xmlChar *) "postattach")
 #define DTD_ELEM_POSTCLONE      ((const xmlChar *) "postclone")
 #define DTD_ELEM_POSTINSTALL    ((const xmlChar *) "postinstall")
 #define DTD_ELEM_POSTSNAP       ((const xmlChar *) "postsnap")
 #define DTD_ELEM_POSTSTATECHG   ((const xmlChar *) "poststatechange")

@@ -528,25 +530,44 @@
         struct brand_handle *bhp = (struct brand_handle *)bh;
         return (brand_get_value(bhp, NULL, NULL, NULL, NULL,
             buf, len, DTD_ELEM_INITNAME, B_FALSE, B_FALSE));
 }
 
-boolean_t
-brand_restartinit(brand_handle_t bh)
+static boolean_t
+i_brand_restartinit(brand_handle_t bh, const xmlChar *tagname, boolean_t deflt)
 {
         struct brand_handle *bhp = (struct brand_handle *)bh;
         char val[80];
 
         if (brand_get_value(bhp, NULL, NULL, NULL, NULL,
-            val, sizeof (val), DTD_ELEM_RESTARTINIT, B_FALSE, B_FALSE) != 0)
-                return (B_TRUE);
+            val, sizeof (val), tagname, B_FALSE, B_FALSE) != 0) {
+                return (deflt);
+        }
 
         if (strcmp(val, "false") == 0)
                 return (B_FALSE);
         return (B_TRUE);
 }
 
+boolean_t
+brand_restartinit(brand_handle_t bh)
+{
+        return (i_brand_restartinit(bh, DTD_ELEM_RESTARTINIT, B_TRUE));
+}
+
+boolean_t
+brand_restartinit0(brand_handle_t bh)
+{
+        return (i_brand_restartinit(bh, DTD_ELEM_RESTARTINIT0, B_FALSE));
+}
+
+boolean_t
+brand_restartinitreboot(brand_handle_t bh)
+{
+        return (i_brand_restartinit(bh, DTD_ELEM_RESTARTINITREBOOT, B_FALSE));
+}
+
 int
 brand_get_login_cmd(brand_handle_t bh, const char *username,
     char *buf, size_t len)
 {
         struct brand_handle *bhp = (struct brand_handle *)bh;