Print this page

        

*** 78,88 **** #include <sys/systeminfo.h> #include <libdladm.h> #include <libinetutil.h> #include <pwd.h> #include <inet/ip.h> - #include <uuid/uuid.h> #include <libzonecfg.h> #include "zonecfg.h" #if !defined(TEXT_DOMAIN) /* should be defined by cc -D */ --- 78,87 ----
*** 126,136 **** #define SHELP_HELP "help [commands] [syntax] [usage] [<command-name>]" #define SHELP_INFO "info [<resource-type> [property-name=property-value]*]" #define SHELP_REMOVE "remove [-F] <resource-type> " \ "[ <property-name>=<property-value> ]*\n" \ "\t(global scope)\n" \ ! "remove [-F] <property-name> <property-value>\n" \ "\t(resource scope)" #define SHELP_REVERT "revert [-F]" #define SHELP_SELECT "select <resource-type> { <property-name>=" \ "<property-value> }" #define SHELP_SET "set <property-name>=<property-value>" --- 125,135 ---- #define SHELP_HELP "help [commands] [syntax] [usage] [<command-name>]" #define SHELP_INFO "info [<resource-type> [property-name=property-value]*]" #define SHELP_REMOVE "remove [-F] <resource-type> " \ "[ <property-name>=<property-value> ]*\n" \ "\t(global scope)\n" \ ! "remove <property-name> <property-value>\n" \ "\t(resource scope)" #define SHELP_REVERT "revert [-F]" #define SHELP_SELECT "select <resource-type> { <property-name>=" \ "<property-value> }" #define SHELP_SET "set <property-name>=<property-value>"
*** 187,198 **** "capped-cpu", "hostid", "admin", "fs-allowed", ALIAS_MAXPROCS, - ALIAS_ZFSPRI, - "uuid", NULL }; /* These *must* match the order of the PT_ define's from zonecfg.h */ char *prop_types[] = { --- 186,195 ----
*** 241,251 **** ALIAS_ZFSPRI, "mac-addr", "vlan-id", "global-nic", "property", - "uuid", NULL }; /* These *must* match the order of the PROP_VAL_ define's from zonecfg.h */ static char *prop_val_types[] = { --- 238,247 ----
*** 307,317 **** "clear " ALIAS_MAXSHMIDS, "clear " ALIAS_MAXMSGIDS, "clear " ALIAS_MAXSEMIDS, "clear " ALIAS_SHARES, "clear " ALIAS_MAXPROCS, - "clear " ALIAS_ZFSPRI, NULL }; static const char *remove_cmds[] = { "remove fs ", --- 303,312 ----
*** 358,369 **** "set " ALIAS_MAXSEMIDS "=", "set " ALIAS_SHARES "=", "set hostid=", "set fs-allowed=", "set " ALIAS_MAXPROCS "=", - "set " ALIAS_ZFSPRI "=", - "set uuid=", NULL }; static const char *info_cmds[] = { "info fs ", --- 353,362 ----
*** 392,402 **** "info cpu-shares", "info hostid", "info admin", "info fs-allowed", "info max-processes", - "info uuid", NULL }; static const char *fs_res_scope_cmds[] = { "add options ", --- 385,394 ----
*** 549,566 **** static zone_dochandle_t handle; /* used all over the place */ static char zone[ZONENAME_MAX]; static char revert_zone[ZONENAME_MAX]; - static char new_uuid[UUID_PRINTABLE_STRING_LENGTH]; /* global brand operations */ static brand_handle_t brand; /* set in modifying functions, checked in read_input() */ static boolean_t need_to_commit = B_FALSE; - static boolean_t is_create = B_FALSE; boolean_t saw_error; /* set in yacc parser, checked in read_input() */ boolean_t newline_terminated; --- 541,556 ----
*** 998,1009 **** return (-1); } static FILE * ! pager_open(void) ! { FILE *newfp; char *pager, *space; pager = getenv("PAGER"); if (pager == NULL || *pager == '\0') --- 988,998 ---- return (-1); } static FILE * ! pager_open(void) { FILE *newfp; char *pager, *space; pager = getenv("PAGER"); if (pager == NULL || *pager == '\0')
*** 1025,1036 **** } return (NULL); } static void ! pager_close(FILE *fp) ! { int status; status = pclose(fp); if (status == -1) zerr(gettext("PAGER close failed (%s)."), --- 1014,1024 ---- } return (NULL); } static void ! pager_close(FILE *fp) { int status; status = pclose(fp); if (status == -1) zerr(gettext("PAGER close failed (%s)."),
*** 1281,1297 **** gettext("(to exit the zonecfg utility)")); } if (flags & HELP_USAGE) { (void) fprintf(fp, "%s:\t%s %s\n", gettext("usage"), execname, cmd_to_str(CMD_HELP)); ! (void) fprintf(fp, "\t%s {-z <zone>|-u <uuid>}\t\t\t(%s)\n", execname, gettext("interactive")); ! (void) fprintf(fp, "\t%s {-z <zone>|-u <uuid>} <command>\n", execname); - (void) fprintf(fp, - "\t%s {-z <zone>|-u <uuid>} -f <command-file>\n", - execname); } if (flags & HELP_SUBCMDS) { (void) fprintf(fp, "%s:\n\n", gettext("Commands")); for (i = 0; i <= CMD_MAX; i++) { (void) fprintf(fp, "%s\n", helptab[i].short_usage); --- 1269,1283 ---- gettext("(to exit the zonecfg utility)")); } if (flags & HELP_USAGE) { (void) fprintf(fp, "%s:\t%s %s\n", gettext("usage"), execname, cmd_to_str(CMD_HELP)); ! (void) fprintf(fp, "\t%s -z <zone>\t\t\t(%s)\n", execname, gettext("interactive")); ! (void) fprintf(fp, "\t%s -z <zone> <command>\n", execname); ! (void) fprintf(fp, "\t%s -z <zone> -f <command-file>\n", execname); } if (flags & HELP_SUBCMDS) { (void) fprintf(fp, "%s:\n\n", gettext("Commands")); for (i = 0; i <= CMD_MAX; i++) { (void) fprintf(fp, "%s\n", helptab[i].short_usage);
*** 1375,1388 **** pt_to_str(PT_MAXMSGIDS)); (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"), pt_to_str(PT_MAXSEMIDS)); (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"), pt_to_str(PT_SHARES)); - (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"), - pt_to_str(PT_UUID)); - (void) fprintf(fp, "\t%s\t%s\n", gettext("(global)"), - pt_to_str(PT_ZFSPRI)); (void) fprintf(fp, "\t%s\t\t%s, %s, %s, %s, %s\n", rt_to_str(RT_FS), pt_to_str(PT_DIR), pt_to_str(PT_SPECIAL), pt_to_str(PT_RAW), pt_to_str(PT_TYPE), pt_to_str(PT_OPTIONS)); (void) fprintf(fp, "\t%s\t\t%s, %s, %s, %s, %s, %s, %s %s\n", --- 1361,1370 ----
*** 1715,1733 **** char attach_path[MAXPATHLEN]; zone_dochandle_t tmphandle; boolean_t force = B_FALSE; boolean_t attach = B_FALSE; boolean_t arg_err = B_FALSE; - uuid_t uuid; assert(cmd != NULL); /* This is the default if no arguments are given. */ (void) strlcpy(zone_template, "SUNWdefault", sizeof (zone_template)); optind = 0; ! while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?a:bFt:X")) != EOF) { switch (arg) { case '?': if (optopt == '?') longer_usage(CMD_CREATE); --- 1697,1714 ---- char attach_path[MAXPATHLEN]; zone_dochandle_t tmphandle; boolean_t force = B_FALSE; boolean_t attach = B_FALSE; boolean_t arg_err = B_FALSE; assert(cmd != NULL); /* This is the default if no arguments are given. */ (void) strlcpy(zone_template, "SUNWdefault", sizeof (zone_template)); optind = 0; ! while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "?a:bFt:")) != EOF) { switch (arg) { case '?': if (optopt == '?') longer_usage(CMD_CREATE);
*** 1813,1830 **** zone_perror(zone_template, err, B_TRUE); return; } need_to_commit = B_TRUE; - is_create = B_TRUE; zonecfg_fini_handle(handle); handle = tmphandle; got_handle = B_TRUE; - - /* Allocate a new uuid for this new zone */ - uuid_generate(uuid); - uuid_unparse(uuid, new_uuid); } /* * This malloc()'s memory, which must be freed by the caller. */ --- 1794,1806 ----
*** 1881,1891 **** char fsallowedp[ZONE_FS_ALLOWED_MAX]; char *limitpriv; FILE *of; boolean_t autoboot; zone_iptype_t iptype; - uuid_t uuid; boolean_t need_to_close = B_FALSE; boolean_t arg_err = B_FALSE; assert(cmd != NULL); --- 1857,1866 ----
*** 1992,2009 **** sizeof (fsallowedp)) == Z_OK) { (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET), pt_to_str(PT_FS_ALLOWED), fsallowedp); } - if (zonecfg_get_uuid(zone, uuid) == Z_OK && !uuid_is_null(uuid)) { - char suuid[UUID_PRINTABLE_STRING_LENGTH]; - - uuid_unparse(uuid, suuid); - (void) fprintf(of, "%s %s=%s\n", cmd_to_str(CMD_SET), - pt_to_str(PT_UUID), suuid); - } - if ((err = zonecfg_setfsent(handle)) != Z_OK) { zone_perror(zone, err, B_FALSE); goto done; } while (zonecfg_getfsent(handle, &fstab) == Z_OK) { --- 1967,1976 ----
*** 2467,2499 **** if (seen_name) { zerr(gettext("%s already specified"), pt_to_str(PT_NAME)); goto bad; } ! if (strlcpy(np->zone_res_attr_name, cp->cp_value, ! sizeof (np->zone_res_attr_name)) >= ! sizeof (np->zone_res_attr_name)) { ! zerr(gettext("Input for %s is too long"), ! pt_to_str(PT_NAME)); ! goto bad; ! } seen_name = B_TRUE; break; case PT_VALUE: if (seen_value) { zerr(gettext("%s already specified"), pt_to_str(PT_VALUE)); goto bad; } ! if (strlcpy(np->zone_res_attr_value, cp->cp_value, ! sizeof (np->zone_res_attr_value)) >= ! sizeof (np->zone_res_attr_value)) { ! zerr(gettext("Input for %s is too long"), ! pt_to_str(PT_VALUE)); ! goto bad; ! } ! seen_value = B_TRUE; break; default: zone_perror(pt_to_str(PT_NPROP), Z_NO_PROPERTY_TYPE, B_TRUE); --- 2434,2455 ---- if (seen_name) { zerr(gettext("%s already specified"), pt_to_str(PT_NAME)); goto bad; } ! (void) strlcpy(np->zone_res_attr_name, cp->cp_value, ! sizeof (np->zone_res_attr_name)); seen_name = B_TRUE; break; case PT_VALUE: if (seen_value) { zerr(gettext("%s already specified"), pt_to_str(PT_VALUE)); goto bad; } ! (void) strlcpy(np->zone_res_attr_value, cp->cp_value, ! sizeof (np->zone_res_attr_value)); seen_value = B_TRUE; break; default: zone_perror(pt_to_str(PT_NPROP), Z_NO_PROPERTY_TYPE, B_TRUE);
*** 2665,2684 **** static boolean_t gz_invalid_rt_property(int type) { return (global_zone && (type == RT_ZONENAME || type == RT_ZONEPATH || ! type == RT_AUTOBOOT || type == RT_LIMITPRIV || type == RT_UUID || type == RT_BOOTARGS || type == RT_BRAND || type == RT_SCHED || type == RT_IPTYPE || type == RT_HOSTID || type == RT_FS_ALLOWED)); } static boolean_t gz_invalid_property(int type) { return (global_zone && (type == PT_ZONENAME || type == PT_ZONEPATH || ! type == PT_AUTOBOOT || type == PT_LIMITPRIV || type == PT_UUID || type == PT_BOOTARGS || type == PT_BRAND || type == PT_SCHED || type == PT_IPTYPE || type == PT_HOSTID || type == PT_FS_ALLOWED)); } void --- 2621,2640 ---- static boolean_t gz_invalid_rt_property(int type) { return (global_zone && (type == RT_ZONENAME || type == RT_ZONEPATH || ! type == RT_AUTOBOOT || type == RT_LIMITPRIV || type == RT_BOOTARGS || type == RT_BRAND || type == RT_SCHED || type == RT_IPTYPE || type == RT_HOSTID || type == RT_FS_ALLOWED)); } static boolean_t gz_invalid_property(int type) { return (global_zone && (type == PT_ZONENAME || type == PT_ZONEPATH || ! type == PT_AUTOBOOT || type == PT_LIMITPRIV || type == PT_BOOTARGS || type == PT_BRAND || type == PT_SCHED || type == PT_IPTYPE || type == PT_HOSTID || type == PT_FS_ALLOWED)); } void
*** 2892,2927 **** if (fill_in_only) return (Z_OK); return (zonecfg_lookup_filesystem(handle, fstab)); } - /* - * Turn an addr that looks like f:2:0:44:5:6C into 0f:02:00:44:05:6c - * We're expecting a dst of at least MAXMACADDRLEN size here. - */ - static void - normalize_mac_addr(char *dst, const char *src, int len) - { - char *p, *e, *sep = ""; - long n; - char buf[MAXMACADDRLEN], tmp[4]; - - *dst = '\0'; - (void) strlcpy(buf, src, sizeof (buf)); - p = strtok(buf, ":"); - while (p != NULL) { - n = strtol(p, &e, 16); - if (*e != NULL || n > 0xff) - return; - (void) snprintf(tmp, sizeof (tmp), "%s%02x", sep, n); - (void) strlcat(dst, tmp, len); - - sep = ":"; - p = strtok(NULL, ":"); - } - } - static int fill_in_nwiftab(cmd_t *cmd, struct zone_nwiftab *nwiftab, boolean_t fill_in_only) { int err, i; --- 2848,2857 ----
*** 2952,2962 **** (void) strlcpy(nwiftab->zone_nwif_physical, pp->pv_simple, sizeof (nwiftab->zone_nwif_physical)); break; case PT_MAC: ! normalize_mac_addr(nwiftab->zone_nwif_mac, pp->pv_simple, sizeof (nwiftab->zone_nwif_mac)); break; case PT_VLANID: (void) strlcpy(nwiftab->zone_nwif_vlan_id, --- 2882,2892 ---- (void) strlcpy(nwiftab->zone_nwif_physical, pp->pv_simple, sizeof (nwiftab->zone_nwif_physical)); break; case PT_MAC: ! (void) strlcpy(nwiftab->zone_nwif_mac, pp->pv_simple, sizeof (nwiftab->zone_nwif_mac)); break; case PT_VLANID: (void) strlcpy(nwiftab->zone_nwif_vlan_id,
*** 3216,3227 **** num = zonecfg_num_resources(handle, rsrc); if (num == 0) { - if (force) - return (B_TRUE); z_cmd_rt_perror(CMD_REMOVE, cmd->cmd_res_type, Z_NO_ENTRY, B_TRUE); return (B_FALSE); } if (num > 1 && !force) { --- 3146,3155 ----
*** 3246,3274 **** } return (B_TRUE); } static void ! remove_fs(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified fs removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_fstab fstab; if ((err = fill_in_fstab(cmd, &fstab, B_FALSE)) != Z_OK) { - if (!force) z_cmd_rt_perror(CMD_REMOVE, RT_FS, err, B_TRUE); return; } ! if ((err = zonecfg_delete_filesystem(handle, &fstab)) != Z_OK) { ! if (!force) z_cmd_rt_perror(CMD_REMOVE, RT_FS, err, B_TRUE); ! } else { need_to_commit = B_TRUE; - } zonecfg_free_fs_option_list(fstab.zone_fs_options); return; } /* --- 3174,3199 ---- } return (B_TRUE); } static void ! remove_fs(cmd_t *cmd) { int err; /* traditional, qualified fs removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_fstab fstab; if ((err = fill_in_fstab(cmd, &fstab, B_FALSE)) != Z_OK) { z_cmd_rt_perror(CMD_REMOVE, RT_FS, err, B_TRUE); return; } ! if ((err = zonecfg_delete_filesystem(handle, &fstab)) != Z_OK) z_cmd_rt_perror(CMD_REMOVE, RT_FS, err, B_TRUE); ! else need_to_commit = B_TRUE; zonecfg_free_fs_option_list(fstab.zone_fs_options); return; } /*
*** 3283,3313 **** else need_to_commit = B_TRUE; } static void ! remove_net(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified net removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_nwiftab nwiftab; if ((err = fill_in_nwiftab(cmd, &nwiftab, B_FALSE)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_NET, err, ! B_TRUE); return; } ! if ((err = zonecfg_delete_nwif(handle, &nwiftab)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_NET, err, ! B_TRUE); ! } else { need_to_commit = B_TRUE; - } return; } /* * unqualified net removal. remove all nets but prompt if more --- 3208,3233 ---- else need_to_commit = B_TRUE; } static void ! remove_net(cmd_t *cmd) { int err; /* traditional, qualified net removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_nwiftab nwiftab; if ((err = fill_in_nwiftab(cmd, &nwiftab, B_FALSE)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_NET, err, B_TRUE); return; } ! if ((err = zonecfg_delete_nwif(handle, &nwiftab)) != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_NET, err, B_TRUE); ! else need_to_commit = B_TRUE; return; } /* * unqualified net removal. remove all nets but prompt if more
*** 3321,3351 **** else need_to_commit = B_TRUE; } static void ! remove_device(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified device removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_devtab devtab; if ((err = fill_in_devtab(cmd, &devtab, B_FALSE)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_DEVICE, err, ! B_TRUE); return; } ! if ((err = zonecfg_delete_dev(handle, &devtab)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_DEVICE, err, ! B_TRUE); ! } else { need_to_commit = B_TRUE; - } return; } /* * unqualified device removal. remove all devices but prompt if more --- 3241,3266 ---- else need_to_commit = B_TRUE; } static void ! remove_device(cmd_t *cmd) { int err; /* traditional, qualified device removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_devtab devtab; if ((err = fill_in_devtab(cmd, &devtab, B_FALSE)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_DEVICE, err, B_TRUE); return; } ! if ((err = zonecfg_delete_dev(handle, &devtab)) != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_DEVICE, err, B_TRUE); ! else need_to_commit = B_TRUE; return; } /* * unqualified device removal. remove all devices but prompt if more
*** 3359,3389 **** else need_to_commit = B_TRUE; } static void ! remove_attr(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified attr removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_attrtab attrtab; if ((err = fill_in_attrtab(cmd, &attrtab, B_FALSE)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_ATTR, err, ! B_TRUE); return; } ! if ((err = zonecfg_delete_attr(handle, &attrtab)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_ATTR, err, ! B_TRUE); ! } else { need_to_commit = B_TRUE; - } return; } /* * unqualified attr removal. remove all attrs but prompt if more --- 3274,3299 ---- else need_to_commit = B_TRUE; } static void ! remove_attr(cmd_t *cmd) { int err; /* traditional, qualified attr removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_attrtab attrtab; if ((err = fill_in_attrtab(cmd, &attrtab, B_FALSE)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_ATTR, err, B_TRUE); return; } ! if ((err = zonecfg_delete_attr(handle, &attrtab)) != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_ATTR, err, B_TRUE); ! else need_to_commit = B_TRUE; return; } /* * unqualified attr removal. remove all attrs but prompt if more
*** 3397,3427 **** else need_to_commit = B_TRUE; } static void ! remove_dataset(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified dataset removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_dstab dstab; if ((err = fill_in_dstab(cmd, &dstab, B_FALSE)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_DATASET, err, ! B_TRUE); return; } ! if ((err = zonecfg_delete_ds(handle, &dstab)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_DATASET, err, ! B_TRUE); ! } else { need_to_commit = B_TRUE; - } return; } /* * unqualified dataset removal. remove all datasets but prompt if more --- 3307,3332 ---- else need_to_commit = B_TRUE; } static void ! remove_dataset(cmd_t *cmd) { int err; /* traditional, qualified dataset removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_dstab dstab; if ((err = fill_in_dstab(cmd, &dstab, B_FALSE)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_DATASET, err, B_TRUE); return; } ! if ((err = zonecfg_delete_ds(handle, &dstab)) != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_DATASET, err, B_TRUE); ! else need_to_commit = B_TRUE; return; } /* * unqualified dataset removal. remove all datasets but prompt if more
*** 3435,3465 **** else need_to_commit = B_TRUE; } static void ! remove_rctl(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified rctl removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_rctltab rctltab; if ((err = fill_in_rctltab(cmd, &rctltab, B_FALSE)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_RCTL, err, ! B_TRUE); return; } ! if ((err = zonecfg_delete_rctl(handle, &rctltab)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_RCTL, err, ! B_TRUE); ! } else { need_to_commit = B_TRUE; - } zonecfg_free_rctl_value_list(rctltab.zone_rctl_valptr); return; } /* --- 3340,3365 ---- else need_to_commit = B_TRUE; } static void ! remove_rctl(cmd_t *cmd) { int err; /* traditional, qualified rctl removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_rctltab rctltab; if ((err = fill_in_rctltab(cmd, &rctltab, B_FALSE)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_RCTL, err, B_TRUE); return; } ! if ((err = zonecfg_delete_rctl(handle, &rctltab)) != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_RCTL, err, B_TRUE); ! else need_to_commit = B_TRUE; zonecfg_free_rctl_value_list(rctltab.zone_rctl_valptr); return; } /*
*** 3474,3527 **** else need_to_commit = B_TRUE; } static void ! remove_pset(boolean_t force) { int err; struct zone_psettab psettab; if ((err = zonecfg_lookup_pset(handle, &psettab)) != Z_OK) { - if (!force) z_cmd_rt_perror(CMD_REMOVE, RT_DCPU, err, B_TRUE); return; } ! if ((err = zonecfg_delete_pset(handle)) != Z_OK) { ! if (!force) z_cmd_rt_perror(CMD_REMOVE, RT_DCPU, err, B_TRUE); ! } else { need_to_commit = B_TRUE; - } } static void ! remove_pcap(boolean_t force) { int err; uint64_t tmp; if (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &tmp) != Z_OK) { ! if (!force) { ! zerr("%s %s: %s", cmd_to_str(CMD_REMOVE), ! rt_to_str(RT_PCAP), zonecfg_strerror(Z_NO_RESOURCE_TYPE)); saw_error = B_TRUE; - } return; } ! if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_CPUCAP)) != Z_OK) { ! if (!force) z_cmd_rt_perror(CMD_REMOVE, RT_PCAP, err, B_TRUE); ! } else { need_to_commit = B_TRUE; - } } static void ! remove_mcap(boolean_t force) { int err, res1, res2, res3; uint64_t tmp; boolean_t revert = B_FALSE; --- 3374,3419 ---- else need_to_commit = B_TRUE; } static void ! remove_pset() { int err; struct zone_psettab psettab; if ((err = zonecfg_lookup_pset(handle, &psettab)) != Z_OK) { z_cmd_rt_perror(CMD_REMOVE, RT_DCPU, err, B_TRUE); return; } ! if ((err = zonecfg_delete_pset(handle)) != Z_OK) z_cmd_rt_perror(CMD_REMOVE, RT_DCPU, err, B_TRUE); ! else need_to_commit = B_TRUE; } static void ! remove_pcap() { int err; uint64_t tmp; if (zonecfg_get_aliased_rctl(handle, ALIAS_CPUCAP, &tmp) != Z_OK) { ! zerr("%s %s: %s", cmd_to_str(CMD_REMOVE), rt_to_str(RT_PCAP), zonecfg_strerror(Z_NO_RESOURCE_TYPE)); saw_error = B_TRUE; return; } ! if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_CPUCAP)) != Z_OK) z_cmd_rt_perror(CMD_REMOVE, RT_PCAP, err, B_TRUE); ! else need_to_commit = B_TRUE; } static void ! remove_mcap() { int err, res1, res2, res3; uint64_t tmp; boolean_t revert = B_FALSE;
*** 3529,3579 **** res2 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &tmp); res3 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM, &tmp); /* if none of these exist, there is no resource to remove */ if (res1 != Z_OK && res2 != Z_OK && res3 != Z_OK) { ! if (!force) { ! zerr("%s %s: %s", cmd_to_str(CMD_REMOVE), ! rt_to_str(RT_MCAP), zonecfg_strerror(Z_NO_RESOURCE_TYPE)); saw_error = B_TRUE; - } return; } if (res1 == Z_OK) { if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXPHYSMEM)) != Z_OK) { ! if (!force) { ! z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, ! B_TRUE); revert = B_TRUE; - } } else { need_to_commit = B_TRUE; } } if (res2 == Z_OK) { if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXSWAP)) != Z_OK) { ! if (!force) { ! z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, ! B_TRUE); revert = B_TRUE; - } } else { need_to_commit = B_TRUE; } } if (res3 == Z_OK) { if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM)) != Z_OK) { ! if (!force) { ! z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, ! B_TRUE); revert = B_TRUE; - } } else { need_to_commit = B_TRUE; } } --- 3421,3459 ---- res2 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXSWAP, &tmp); res3 = zonecfg_get_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM, &tmp); /* if none of these exist, there is no resource to remove */ if (res1 != Z_OK && res2 != Z_OK && res3 != Z_OK) { ! zerr("%s %s: %s", cmd_to_str(CMD_REMOVE), rt_to_str(RT_MCAP), zonecfg_strerror(Z_NO_RESOURCE_TYPE)); saw_error = B_TRUE; return; } if (res1 == Z_OK) { if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXPHYSMEM)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, B_TRUE); revert = B_TRUE; } else { need_to_commit = B_TRUE; } } if (res2 == Z_OK) { if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXSWAP)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, B_TRUE); revert = B_TRUE; } else { need_to_commit = B_TRUE; } } if (res3 == Z_OK) { if ((err = zonecfg_rm_aliased_rctl(handle, ALIAS_MAXLOCKEDMEM)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_MCAP, err, B_TRUE); revert = B_TRUE; } else { need_to_commit = B_TRUE; } }
*** 3580,3634 **** if (revert) need_to_commit = B_FALSE; } static void ! remove_admin(cmd_t *cmd, boolean_t force) { int err; /* traditional, qualified attr removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_admintab admintab; if ((err = fill_in_admintab(cmd, &admintab, B_FALSE)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_ADMIN, err, ! B_TRUE); return; } if ((err = zonecfg_delete_admin(handle, &admintab, ! zone)) != Z_OK) { ! if (!force) ! z_cmd_rt_perror(CMD_REMOVE, RT_ADMIN, err, ! B_TRUE); ! } else { need_to_commit = B_TRUE; - } return; ! } ! /* * unqualified admin removal. ! * remove all admins but prompt if more than one. */ if (!prompt_remove_resource(cmd, "admin")) return; ! if ((err = zonecfg_delete_admins(handle, zone)) != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_ADMIN, err, B_TRUE); else need_to_commit = B_TRUE; } static void remove_resource(cmd_t *cmd) { int type; int arg; boolean_t arg_err = B_FALSE; - boolean_t force = B_FALSE; if ((type = cmd->cmd_res_type) == RT_UNKNOWN) { long_usage(CMD_REMOVE, B_TRUE); return; } --- 3460,3514 ---- if (revert) need_to_commit = B_FALSE; } static void ! remove_admin(cmd_t *cmd) { int err; /* traditional, qualified attr removal */ if (cmd->cmd_prop_nv_pairs > 0) { struct zone_admintab admintab; if ((err = fill_in_admintab(cmd, &admintab, B_FALSE)) != Z_OK) { ! z_cmd_rt_perror(CMD_REMOVE, RT_ADMIN, ! err, B_TRUE); return; } if ((err = zonecfg_delete_admin(handle, &admintab, ! zone)) ! != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_ADMIN, ! err, B_TRUE); ! else need_to_commit = B_TRUE; return; ! } else { /* * unqualified admin removal. ! * remove all admins but prompt if more ! * than one. */ if (!prompt_remove_resource(cmd, "admin")) return; ! if ((err = zonecfg_delete_admins(handle, zone)) ! != Z_OK) ! z_cmd_rt_perror(CMD_REMOVE, RT_ADMIN, ! err, B_TRUE); else need_to_commit = B_TRUE; + } } static void remove_resource(cmd_t *cmd) { int type; int arg; boolean_t arg_err = B_FALSE; if ((type = cmd->cmd_res_type) == RT_UNKNOWN) { long_usage(CMD_REMOVE, B_TRUE); return; }
*** 3639,3649 **** case '?': longer_usage(CMD_REMOVE); arg_err = B_TRUE; break; case 'F': - force = B_TRUE; break; default: short_usage(CMD_REMOVE); arg_err = B_TRUE; break; --- 3519,3528 ----
*** 3655,3692 **** if (initialize(B_TRUE) != Z_OK) return; switch (type) { case RT_FS: ! remove_fs(cmd, force); return; case RT_NET: ! remove_net(cmd, force); return; case RT_DEVICE: ! remove_device(cmd, force); return; case RT_RCTL: ! remove_rctl(cmd, force); return; case RT_ATTR: ! remove_attr(cmd, force); return; case RT_DATASET: ! remove_dataset(cmd, force); return; case RT_DCPU: ! remove_pset(force); return; case RT_PCAP: ! remove_pcap(force); return; case RT_MCAP: ! remove_mcap(force); return; case RT_ADMIN: ! remove_admin(cmd, force); return; default: zone_perror(rt_to_str(type), Z_NO_RESOURCE_TYPE, B_TRUE); long_usage(CMD_REMOVE, B_TRUE); usage(B_FALSE, HELP_RESOURCES); --- 3534,3571 ---- if (initialize(B_TRUE) != Z_OK) return; switch (type) { case RT_FS: ! remove_fs(cmd); return; case RT_NET: ! remove_net(cmd); return; case RT_DEVICE: ! remove_device(cmd); return; case RT_RCTL: ! remove_rctl(cmd); return; case RT_ATTR: ! remove_attr(cmd); return; case RT_DATASET: ! remove_dataset(cmd); return; case RT_DCPU: ! remove_pset(); return; case RT_PCAP: ! remove_pcap(); return; case RT_MCAP: ! remove_mcap(); return; case RT_ADMIN: ! remove_admin(cmd); return; default: zone_perror(rt_to_str(type), Z_NO_RESOURCE_TYPE, B_TRUE); long_usage(CMD_REMOVE, B_TRUE); usage(B_FALSE, HELP_RESOURCES);
*** 3701,3730 **** int err, res_type, prop_type; property_value_ptr_t pp; struct zone_rctlvaltab *rctlvaltab; struct zone_res_attrtab *np; complex_property_ptr_t cx; - int arg; - boolean_t force = B_FALSE; - boolean_t arg_err = B_FALSE; - optind = 0; - while ((arg = getopt(cmd->cmd_argc, cmd->cmd_argv, "F")) != EOF) { - switch (arg) { - case 'F': - force = B_TRUE; - break; - default: - arg_err = B_TRUE; - break; - } - } - if (arg_err) { - saw_error = B_TRUE; - return; - } - res_type = resource_scope; prop_type = cmd->cmd_prop_name[0]; if (res_type == RT_UNKNOWN || prop_type == PT_UNKNOWN) { long_usage(CMD_REMOVE, B_TRUE); return; --- 3580,3590 ----
*** 3761,3771 **** return; } prop_id = pp->pv_simple; err = zonecfg_remove_fs_option(&in_progress_fstab, prop_id); ! if (err != Z_OK && !force) zone_perror(pt_to_str(prop_type), err, B_TRUE); } else { list_property_ptr_t list; for (list = pp->pv_list; list != NULL; --- 3621,3631 ---- return; } prop_id = pp->pv_simple; err = zonecfg_remove_fs_option(&in_progress_fstab, prop_id); ! if (err != Z_OK) zone_perror(pt_to_str(prop_type), err, B_TRUE); } else { list_property_ptr_t list; for (list = pp->pv_list; list != NULL;
*** 3773,3783 **** prop_id = list->lp_simple; if (prop_id == NULL) break; err = zonecfg_remove_fs_option( &in_progress_fstab, prop_id); ! if (err != Z_OK && !force) zone_perror(pt_to_str(prop_type), err, B_TRUE); } } return; --- 3633,3643 ---- prop_id = list->lp_simple; if (prop_id == NULL) break; err = zonecfg_remove_fs_option( &in_progress_fstab, prop_id); ! if (err != Z_OK) zone_perror(pt_to_str(prop_type), err, B_TRUE); } } return;
*** 3826,3836 **** &(in_progress_nwiftab.zone_nwif_attrp), np); } else { /* RT_DEVICE */ err = zonecfg_remove_res_attr( &(in_progress_devtab.zone_dev_attrp), np); } ! if (err != Z_OK && !force) zone_perror(pt_to_str(prop_type), err, B_TRUE); return; case RT_RCTL: if (prop_type != PT_VALUE) { zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE, --- 3686,3696 ---- &(in_progress_nwiftab.zone_nwif_attrp), np); } else { /* RT_DEVICE */ err = zonecfg_remove_res_attr( &(in_progress_devtab.zone_dev_attrp), np); } ! if (err != Z_OK) zone_perror(pt_to_str(prop_type), err, B_TRUE); return; case RT_RCTL: if (prop_type != PT_VALUE) { zone_perror(pt_to_str(prop_type), Z_NO_PROPERTY_TYPE,
*** 3877,3887 **** } } rctlvaltab->zone_rctlval_next = NULL; err = zonecfg_remove_rctl_value(&in_progress_rctltab, rctlvaltab); ! if (err != Z_OK && !force) zone_perror(pt_to_str(prop_type), err, B_TRUE); zonecfg_free_rctl_value_list(rctlvaltab); return; default: zone_perror(rt_to_str(res_type), Z_NO_RESOURCE_TYPE, B_TRUE); --- 3737,3747 ---- } } rctlvaltab->zone_rctlval_next = NULL; err = zonecfg_remove_rctl_value(&in_progress_rctltab, rctlvaltab); ! if (err != Z_OK) zone_perror(pt_to_str(prop_type), err, B_TRUE); zonecfg_free_rctl_value_list(rctlvaltab); return; default: zone_perror(rt_to_str(res_type), Z_NO_RESOURCE_TYPE, B_TRUE);
*** 4002,4013 **** switch (type) { case PT_ZONENAME: /* FALLTHRU */ case PT_ZONEPATH: /* FALLTHRU */ - case PT_UUID: - /* FALLTHRU */ case PT_BRAND: zone_perror(pt_to_str(type), Z_CLEAR_DISALLOW, B_TRUE); return; case PT_AUTOBOOT: /* false is default; we'll treat as equivalent to clearing */ --- 3862,3871 ----
*** 4066,4078 **** remove_aliased_rctl(PT_MAXSEMIDS, ALIAS_MAXSEMIDS); return; case PT_SHARES: remove_aliased_rctl(PT_SHARES, ALIAS_SHARES); return; - case PT_ZFSPRI: - remove_aliased_rctl(PT_ZFSPRI, ALIAS_ZFSPRI); - return; case PT_HOSTID: if ((err = zonecfg_set_hostid(handle, NULL)) != Z_OK) z_cmd_rt_perror(CMD_CLEAR, RT_HOSTID, err, B_TRUE); else need_to_commit = B_TRUE; --- 3924,3933 ----
*** 4559,4572 **** res_type = RT_SHARES; } else if (prop_type == PT_HOSTID) { res_type = RT_HOSTID; } else if (prop_type == PT_FS_ALLOWED) { res_type = RT_FS_ALLOWED; - } else if (prop_type == PT_ZFSPRI) { - res_type = RT_ZFSPRI; - } else if (prop_type == PT_UUID) { - res_type = RT_UUID; } else { zerr(gettext("Cannot set a resource-specific property " "from the global scope.")); saw_error = B_TRUE; return; --- 4414,4423 ----
*** 4770,4782 **** set_aliased_rctl(ALIAS_MAXSEMIDS, prop_type, prop_id); return; case RT_SHARES: set_aliased_rctl(ALIAS_SHARES, prop_type, prop_id); return; - case RT_ZFSPRI: - set_aliased_rctl(ALIAS_ZFSPRI, prop_type, prop_id); - return; case RT_HOSTID: if ((err = zonecfg_set_hostid(handle, prop_id)) != Z_OK) { if (err == Z_TOO_BIG) { zerr(gettext("hostid string is too large: %s"), prop_id); --- 4621,4630 ----
*** 4786,4804 **** } return; } need_to_commit = B_TRUE; return; - case RT_UUID: - /* - * We can't set here. We have to wait until commit since the - * uuid will be updating the index file and we may not have - * created the zone yet. - */ - (void) strlcpy(new_uuid, prop_id, sizeof (new_uuid)); - need_to_commit = B_TRUE; - return; case RT_FS_ALLOWED: if ((err = zonecfg_set_fs_allowed(handle, prop_id)) != Z_OK) zone_perror(zone, err, B_TRUE); else need_to_commit = B_TRUE; --- 4634,4643 ----
*** 4870,4880 **** (void) strlcpy(in_progress_nwiftab.zone_nwif_physical, prop_id, sizeof (in_progress_nwiftab.zone_nwif_physical)); break; case PT_MAC: ! normalize_mac_addr(in_progress_nwiftab.zone_nwif_mac, prop_id, sizeof (in_progress_nwiftab.zone_nwif_mac)); break; case PT_VLANID: (void) strlcpy(in_progress_nwiftab.zone_nwif_vlan_id, --- 4709,4719 ---- (void) strlcpy(in_progress_nwiftab.zone_nwif_physical, prop_id, sizeof (in_progress_nwiftab.zone_nwif_physical)); break; case PT_MAC: ! (void) strlcpy(in_progress_nwiftab.zone_nwif_mac, prop_id, sizeof (in_progress_nwiftab.zone_nwif_mac)); break; case PT_VLANID: (void) strlcpy(in_progress_nwiftab.zone_nwif_vlan_id,
*** 5395,5421 **** zone_perror(zone, err, B_TRUE); } } static void - info_uuid(FILE *fp) - { - uuid_t uuid; - char suuid[UUID_PRINTABLE_STRING_LENGTH]; - - if (new_uuid[0] != '\0') { - (void) fprintf(fp, "%s: %s\n", pt_to_str(PT_UUID), new_uuid); - } else if (zonecfg_get_uuid(zone, uuid) == Z_OK && - !uuid_is_null(uuid)) { - uuid_unparse(uuid, suuid); - (void) fprintf(fp, "%s: %s\n", pt_to_str(PT_UUID), suuid); - } else { - (void) fprintf(fp, "%s:\n", pt_to_str(PT_UUID)); - } - } - - static void info_fs_allowed(zone_dochandle_t handle, FILE *fp) { char fsallowedp[ZONE_FS_ALLOWED_MAX]; int err; --- 5234,5243 ----
*** 5921,5931 **** int type; int res1, res2, res3; uint64_t swap_limit; uint64_t locked_limit; uint64_t phys_limit; - struct stat statbuf; assert(cmd != NULL); if (initialize(B_TRUE) != Z_OK) return; --- 5743,5752 ----
*** 6011,6030 **** info_limitpriv(handle, fp); info_sched(handle, fp); info_iptype(handle, fp); info_hostid(handle, fp); info_fs_allowed(handle, fp); - info_uuid(fp); } info_aliased_rctl(handle, fp, ALIAS_MAXLWPS); info_aliased_rctl(handle, fp, ALIAS_MAXPROCS); info_aliased_rctl(handle, fp, ALIAS_MAXSHMMEM); info_aliased_rctl(handle, fp, ALIAS_MAXSHMIDS); info_aliased_rctl(handle, fp, ALIAS_MAXMSGIDS); info_aliased_rctl(handle, fp, ALIAS_MAXSEMIDS); info_aliased_rctl(handle, fp, ALIAS_SHARES); - info_aliased_rctl(handle, fp, ALIAS_ZFSPRI); if (!global_zone) { info_fs(handle, fp, cmd); info_net(handle, fp, cmd); info_dev(handle, fp, cmd); } --- 5832,5849 ----
*** 6084,6096 **** info_aliased_rctl(handle, fp, ALIAS_MAXSEMIDS); break; case RT_SHARES: info_aliased_rctl(handle, fp, ALIAS_SHARES); break; - case RT_ZFSPRI: - info_aliased_rctl(handle, fp, ALIAS_ZFSPRI); - break; case RT_FS: info_fs(handle, fp, cmd); break; case RT_NET: info_net(handle, fp, cmd); --- 5903,5912 ----
*** 6117,6129 **** info_mcap(handle, fp); break; case RT_HOSTID: info_hostid(handle, fp); break; - case RT_UUID: - info_uuid(fp); - break; case RT_ADMIN: info_auth(handle, fp, cmd); break; case RT_FS_ALLOWED: info_fs_allowed(handle, fp); --- 5933,5942 ----
*** 6611,6638 **** if ((ret_val = zonecfg_save(handle)) == Z_OK) { need_to_commit = B_FALSE; (void) strlcpy(revert_zone, zone, sizeof (revert_zone)); - - if (is_create) { - zonecfg_notify_create(handle); - is_create = B_FALSE; } - } - - /* - * Commit a new uuid at this point since we now know the - * zone index entry will exist. - */ - if (new_uuid[0] != '\0') { - if ((err = zonecfg_set_uuid(zone, zonepath, - new_uuid)) != Z_OK) - zone_perror(zone, err, B_FALSE); - else - new_uuid[0] = '\0'; - } } else { zerr(gettext("Zone %s failed to verify"), zone); } } if (ret_val != Z_OK) --- 6424,6434 ----
*** 7678,7691 **** } int main(int argc, char *argv[]) { ! int err, arg, uflag = 0, zflag = 0; struct stat st; - uuid_t uuidin; - char zonename[ZONENAME_MAX + 1]; /* This must be before anything goes to stdout. */ setbuf(stdout, NULL); saw_error = B_FALSE; --- 7474,7485 ---- } int main(int argc, char *argv[]) { ! int err, arg; struct stat st; /* This must be before anything goes to stdout. */ setbuf(stdout, NULL); saw_error = B_FALSE;
*** 7708,7718 **** if (strcmp(argv[1], cmd_to_str(CMD_HELP)) == 0) { (void) one_command_at_a_time(argc - 1, &(argv[1])); exit(Z_OK); } ! while ((arg = getopt(argc, argv, "?f:R:z:u:")) != EOF) { switch (arg) { case '?': if (optopt == '?') usage(B_TRUE, HELP_USAGE | HELP_SUBCMDS); else --- 7502,7512 ---- if (strcmp(argv[1], cmd_to_str(CMD_HELP)) == 0) { (void) one_command_at_a_time(argc - 1, &(argv[1])); exit(Z_OK); } ! while ((arg = getopt(argc, argv, "?f:R:z:")) != EOF) { switch (arg) { case '?': if (optopt == '?') usage(B_TRUE, HELP_USAGE | HELP_SUBCMDS); else
*** 7735,7759 **** optarg); exit(Z_USAGE); } zonecfg_set_root(optarg); break; - case 'u': - if (uuid_parse((char *)optarg, uuidin) == -1) - return (Z_INVALID_PROPERTY); - - if (zonecfg_get_name_by_uuid(uuidin, zonename, - ZONENAME_MAX) != Z_OK) { - zone_perror(optarg, Z_BOGUS_ZONE_NAME, B_TRUE); - usage(B_FALSE, HELP_SYNTAX); - exit(Z_USAGE); - } - - (void) strlcpy(zone, zonename, sizeof (zone)); - (void) strlcpy(revert_zone, zonename, sizeof (zone)); - uflag = 1; - break; case 'z': if (strcmp(optarg, GLOBAL_ZONENAME) == 0) { global_zone = B_TRUE; } else if (zonecfg_validate_zonename(optarg) != Z_OK) { zone_perror(optarg, Z_BOGUS_ZONE_NAME, B_TRUE); --- 7529,7538 ----
*** 7760,7778 **** usage(B_FALSE, HELP_SYNTAX); exit(Z_USAGE); } (void) strlcpy(zone, optarg, sizeof (zone)); (void) strlcpy(revert_zone, optarg, sizeof (zone)); - zflag = 1; break; default: usage(B_FALSE, HELP_USAGE); exit(Z_USAGE); } } ! if (optind > argc || strcmp(zone, "") == 0 || (uflag && zflag)) { usage(B_FALSE, HELP_USAGE); exit(Z_USAGE); } if ((err = zonecfg_access(zone, W_OK)) == Z_OK) { --- 7539,7556 ---- usage(B_FALSE, HELP_SYNTAX); exit(Z_USAGE); } (void) strlcpy(zone, optarg, sizeof (zone)); (void) strlcpy(revert_zone, optarg, sizeof (zone)); break; default: usage(B_FALSE, HELP_USAGE); exit(Z_USAGE); } } ! if (optind > argc || strcmp(zone, "") == 0) { usage(B_FALSE, HELP_USAGE); exit(Z_USAGE); } if ((err = zonecfg_access(zone, W_OK)) == Z_OK) {