X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fmkfs_lustre.c;h=0af4faefe358bfdb638384096a2950fc3c6c8e0a;hb=091c8a93c184b2ff75a71ba665dbfcf38e435a6f;hp=070cb20379425c453a2a48f3e66688632fd21859;hpb=56e0d0bd401ba7dadb19e21dac624f6eb9cee3f7;p=fs%2Flustre-release.git diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 070cb20..0af4fae 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) @@ -292,6 +293,11 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, } i++; } + if (i == LDD_MT_LAST) { + fprintf(stderr, "%s: invalid backend filesystem" + " type %s\n", progname, optarg); + return 1; + } break; } case 'c': @@ -479,16 +485,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; } @@ -678,7 +688,7 @@ int main(int argc, char *const argv[]) } /* Format the backing filesystem */ - ret = make_lustre_backfs(&mop); + ret = osd_make_lustre(&mop); if (ret != 0) { fatal(); fprintf(stderr, "mkfs failed %d\n", ret); @@ -687,7 +697,7 @@ int main(int argc, char *const argv[]) #endif /* Write our config files */ - ret = write_local_files(&mop); + ret = osd_write_ldd(&mop); if (ret != 0) { fatal(); fprintf(stderr, "failed to write local files\n");