X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Fmkfs_lustre.c;h=21f7d19d5f5ad1570b128339de93c3658413e92b;hp=a7f09f953bb3161adc2f04f93e972f858feea847;hb=f992b0fb3fc6ec1cfc53944d7df7bd5b496ac9cb;hpb=af79b4e7e89c6c5f455a0526f1598dae217db2e5;ds=sidebyside diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index a7f09f9..21f7d19 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -177,6 +177,7 @@ void set_defaults(struct mkfs_opts *mop) mop->mo_ldd.ldd_svindex = INDEX_UNASSIGNED; mop->mo_stripe_count = 1; + mop->mo_pool_vdevs = NULL; } static inline void badopt(const char *opt, char *type) @@ -479,16 +480,20 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, } }//while - /* Last arg is device */ - if (optind != argc - 1) { - fatal(); - fprintf(stderr, "Bad argument: %s\n", argv[optind]); - return EINVAL; - } - - /* single argument: */ - if (argc == 2) - ++print_only; + if (optind == argc) { + /* The user didn't specify device name */ + fatal(); + fprintf(stderr, "Not enough arguments - device name or " + "pool/dataset name not specified.\n"); + return EINVAL; + } else { + /* The device or pool/filesystem name */ + strscpy(mop->mo_device, argv[optind], sizeof(mop->mo_device)); + + /* Followed by optional vdevs */ + if (optind < argc - 1) + mop->mo_pool_vdevs = (char **) &argv[optind + 1]; + } return 0; }