3224 zpool_do_split(int argc, char **argv)
3225 {
3226 char *srcpool, *newpool, *propval;
3227 char *mntopts = NULL;
3228 splitflags_t flags;
3229 int c, ret = 0;
3230 zpool_handle_t *zhp;
3231 nvlist_t *config, *props = NULL;
3232
3233 flags.dryrun = B_FALSE;
3234 flags.import = B_FALSE;
3235
3236 /* check options */
3237 while ((c = getopt(argc, argv, ":R:no:")) != -1) {
3238 switch (c) {
3239 case 'R':
3240 flags.import = B_TRUE;
3241 if (add_prop_list(
3242 zpool_prop_to_name(ZPOOL_PROP_ALTROOT), optarg,
3243 &props, B_TRUE) != 0) {
3244 if (props)
3245 nvlist_free(props);
3246 usage(B_FALSE);
3247 }
3248 break;
3249 case 'n':
3250 flags.dryrun = B_TRUE;
3251 break;
3252 case 'o':
3253 if ((propval = strchr(optarg, '=')) != NULL) {
3254 *propval = '\0';
3255 propval++;
3256 if (add_prop_list(optarg, propval,
3257 &props, B_TRUE) != 0) {
3258 if (props)
3259 nvlist_free(props);
3260 usage(B_FALSE);
3261 }
3262 } else {
3263 mntopts = optarg;
3264 }
3265 break;
3266 case ':':
3267 (void) fprintf(stderr, gettext("missing argument for "
3268 "'%c' option\n"), optopt);
3269 usage(B_FALSE);
3270 break;
3271 case '?':
3272 (void) fprintf(stderr, gettext("invalid option '%c'\n"),
3273 optopt);
3274 usage(B_FALSE);
3275 break;
3276 }
3277 }
3278
|
3224 zpool_do_split(int argc, char **argv)
3225 {
3226 char *srcpool, *newpool, *propval;
3227 char *mntopts = NULL;
3228 splitflags_t flags;
3229 int c, ret = 0;
3230 zpool_handle_t *zhp;
3231 nvlist_t *config, *props = NULL;
3232
3233 flags.dryrun = B_FALSE;
3234 flags.import = B_FALSE;
3235
3236 /* check options */
3237 while ((c = getopt(argc, argv, ":R:no:")) != -1) {
3238 switch (c) {
3239 case 'R':
3240 flags.import = B_TRUE;
3241 if (add_prop_list(
3242 zpool_prop_to_name(ZPOOL_PROP_ALTROOT), optarg,
3243 &props, B_TRUE) != 0) {
3244 nvlist_free(props);
3245 usage(B_FALSE);
3246 }
3247 break;
3248 case 'n':
3249 flags.dryrun = B_TRUE;
3250 break;
3251 case 'o':
3252 if ((propval = strchr(optarg, '=')) != NULL) {
3253 *propval = '\0';
3254 propval++;
3255 if (add_prop_list(optarg, propval,
3256 &props, B_TRUE) != 0) {
3257 nvlist_free(props);
3258 usage(B_FALSE);
3259 }
3260 } else {
3261 mntopts = optarg;
3262 }
3263 break;
3264 case ':':
3265 (void) fprintf(stderr, gettext("missing argument for "
3266 "'%c' option\n"), optopt);
3267 usage(B_FALSE);
3268 break;
3269 case '?':
3270 (void) fprintf(stderr, gettext("invalid option '%c'\n"),
3271 optopt);
3272 usage(B_FALSE);
3273 break;
3274 }
3275 }
3276
|