- char *end;
-
- /* argv: lov_setup <LOV uuid> <stripe count> <stripe size>
- * <stripe offset> <pattern> [ <max tgt index> ]
- */
- if (argc <= 6)
- return CMD_HELP;
-
- if (strlen(argv[1]) > sizeof(desc.ld_uuid) - 1) {
- fprintf(stderr,
- "error: %s: LOV uuid '%s' longer than "LPSZ" chars\n",
- jt_cmdname(argv[0]), argv[1], sizeof(desc.ld_uuid) - 1);
- return -EINVAL;
- }
-
- memset(&desc, 0, sizeof(desc));
- obd_str2uuid(&desc.ld_uuid, argv[1]);
- desc.ld_default_stripe_count = strtoul(argv[2], &end, 0);
- if (*end) {
- fprintf(stderr, "error: %s: bad default stripe count '%s'\n",
- jt_cmdname(argv[0]), argv[2]);
- return CMD_HELP;
- }
-
- desc.ld_default_stripe_size = strtoull(argv[3], &end, 0);
- if (*end) {
- fprintf(stderr, "error: %s: bad default stripe size '%s'\n",
- jt_cmdname(argv[0]), argv[3]);
- return CMD_HELP;
- }
- if (desc.ld_default_stripe_size < 4096) {
- fprintf(stderr,
- "error: %s: default stripe size "LPU64" too small\n",
- jt_cmdname(argv[0]), desc.ld_default_stripe_size);
- return -EINVAL;
- } else if ((long)desc.ld_default_stripe_size <
- desc.ld_default_stripe_size) {
- fprintf(stderr,
- "error: %s: default stripe size "LPU64" too large\n",
- jt_cmdname(argv[0]), desc.ld_default_stripe_size);
- return -EINVAL;
- }
- desc.ld_default_stripe_offset = strtoull(argv[4], &end, 0);
- if (*end) {
- fprintf(stderr, "error: %s: bad default stripe offset '%s'\n",
- jt_cmdname(argv[0]), argv[4]);
- return CMD_HELP;
- }
- desc.ld_pattern = strtoul(argv[5], &end, 0);
- if (*end) {
- fprintf(stderr, "error: %s: bad stripe pattern '%s'\n",
- jt_cmdname(argv[0]), argv[5]);