* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
static int lfs_swap_layouts(int argc, char **argv);
static int lfs_mv(int argc, char **argv);
-#define SETSTRIPE_USAGE(_cmd, _tgt) \
- "usage: "_cmd" [--stripe-count|-c <stripe_count>]\n"\
- " [--stripe-index|-i <start_ost_idx>]\n"\
- " [--stripe-size|-S <stripe_size>]\n"\
- " [--pool|-p <pool_name>]\n"\
- " [--block|-b] "_tgt"\n"\
- " [--ost-list|-o <ost_indices>]\n"\
- "\tstripe_size: Number of bytes on each OST (0 filesystem default)\n"\
- "\t Can be specified with k, m or g (in KB, MB and GB\n"\
- "\t respectively)\n"\
- "\tstart_ost_idx: OST index of first stripe (-1 default)\n"\
- "\tstripe_count: Number of OSTs to stripe over (0 default, -1 all)\n"\
- "\tpool_name: Name of OST pool to use (default none)\n"\
- "\tblock: Block file access during data migration\n"\
+/* Setstripe and migrate share mostly the same parameters */
+#define SSM_CMD_COMMON(cmd) \
+ "usage: "cmd" [--stripe-count|-c <stripe_count>]\n" \
+ " [--stripe-index|-i <start_ost_idx>]\n" \
+ " [--stripe-size|-S <stripe_size>]\n" \
+ " [--pool|-p <pool_name>]\n" \
+ " [--ost-list|-o <ost_indices>]\n"
+
+#define SSM_HELP_COMMON \
+ "\tstripe_size: Number of bytes on each OST (0 filesystem default)\n" \
+ "\t Can be specified with k, m or g (in KB, MB and GB\n" \
+ "\t respectively)\n" \
+ "\tstart_ost_idx: OST index of first stripe (-1 default)\n" \
+ "\tstripe_count: Number of OSTs to stripe over (0 default, -1 all)\n" \
+ "\tpool_name: Name of OST pool to use (default none)\n" \
"\tost_indices: List of OST indices, can be repeated multiple times\n"\
- "\t Indices be specified in a format of:\n"\
- "\t -o <ost_1>,<ost_i>-<ost_j>,<ost_n>\n"\
- "\t Or:\n"\
- "\t -o <ost_1> -o <ost_i>-<ost_j> -o <ost_n>\n"\
- "\t If --pool is set with --ost-list, then the OSTs\n"\
+ "\t Indices be specified in a format of:\n" \
+ "\t -o <ost_1>,<ost_i>-<ost_j>,<ost_n>\n" \
+ "\t Or:\n" \
+ "\t -o <ost_1> -o <ost_i>-<ost_j> -o <ost_n>\n" \
+ "\t If --pool is set with --ost-list, then the OSTs\n" \
"\t must be the members of the pool."
-/* all avaialable commands */
+#define SETSTRIPE_USAGE \
+ SSM_CMD_COMMON("setstripe") \
+ " <directory|filename>\n" \
+ SSM_HELP_COMMON
+
+#define MIGRATE_USAGE \
+ SSM_CMD_COMMON("migrate ") \
+ " [--block|-b]\n" \
+ " <filename>\n" \
+ SSM_HELP_COMMON \
+ "\n" \
+ "\tblock: Block file access during data migration\n" \
+
+/* all available commands */
command_t cmdlist[] = {
{"setstripe", lfs_setstripe, 0,
"Create a new file with a specific striping pattern or\n"
"delete the default striping pattern from an existing directory\n"
"usage: setstripe -d <directory> (to delete default striping)\n"\
" or\n"
- SETSTRIPE_USAGE("setstripe", "<directory|filename>")},
+ SETSTRIPE_USAGE},
{"getstripe", lfs_getstripe, 0,
"To list the striping info for a given file or files in a\n"
"directory or recursively for all files in a directory tree.\n"
{"swap_layouts", lfs_swap_layouts, 0, "Swap layouts between 2 files.\n"
"usage: swap_layouts <path1> <path2>"},
{"migrate", lfs_setstripe, 0, "migrate file from one OST layout to "
- "another (may be not safe with concurent writes).\n"
- SETSTRIPE_USAGE("migrate ", "<filename>")},
+ "another (may be not safe with concurrent writes).\n"
+ MIGRATE_USAGE},
{"mv", lfs_mv, 0,
"To move directories between MDTs.\n"
"usage: mv <directory|filename> [--mdt-index|-M] <mdt_index> "
{ 0, 0, 0, NULL }
};
-/* Generate a random id for the grouplock */
-static int random_group_id(int *gid)
-{
- int fd;
- int rc;
- size_t sz = sizeof(*gid);
-
- fd = open("/dev/urandom", O_RDONLY);
- if (fd < 0) {
- rc = -errno;
- fprintf(stderr, "cannot open /dev/urandom: %s\n",
- strerror(-rc));
- goto out;
- }
-
- rc = read(fd, gid, sz);
- if (rc < sz) {
- rc = -errno;
- fprintf(stderr, "cannot read %zu bytes from /dev/urandom: %s\n",
- sz, strerror(-rc));
- goto out;
- }
-
-out:
- if (fd >= 0)
- close(fd);
-
- return rc;
-}
-
#define MIGRATION_BLOCKS 1
static int lfs_migrate(char *name, __u64 migration_flags,
}
rc = llapi_file_get_stripe(name, lum);
- /* failure can come from may case and some may be not real error
+ /* failure can happen for many reasons and some may be not real errors
* (eg: no stripe)
- * in case of a real error, a later call will failed with a better
+ * in case of a real error, a later call will fail with better
* error management */
if (rc < 0)
bufsz = 1024*1024;
goto free;
}
- if (migration_flags & MIGRATION_BLOCKS) {
- rc = random_group_id(&gid);
- if (rc < 0) {
- fprintf(stderr, "%s: cannot get random group ID: %s\n",
- name, strerror(-rc));
- goto free;
- }
- }
-
/* search for file directory pathname */
if (strlen(name) > sizeof(parent)-1) {
rc = -E2BIG;
goto error;
}
+ do
+ gid = random();
+ while (gid == 0);
if (migration_flags & MIGRATION_BLOCKS) {
- /* take group lock to limit concurent access
+ /* take group lock to limit concurrent access
* this will be no more needed when exclusive access will
* be implemented (see LU-2919) */
/* group lock is taken after data version read because it
if (strcmp(argv[0], "migrate") == 0)
migrate_mode = true;
- optind = 0;
- while ((c = getopt_long(argc, argv, "c:di:o:p:s:S:",
+ while ((c = getopt_long(argc, argv, "bc:di:o:p:s:S:",
long_opts, NULL)) >= 0) {
switch (c) {
case 0:
return CMD_HELP;
}
+ if (pool_name_arg && strlen(pool_name_arg) > LOV_MAXPOOLNAME) {
+ fprintf(stderr,
+ "error: %s: pool name '%s' is too long (max is %d characters)\n",
+ argv[0], pool_name_arg, LOV_MAXPOOLNAME);
+ return CMD_HELP;
+ }
+
/* get the stripe size */
if (stripe_size_arg != NULL) {
result = llapi_parse_size(stripe_size_arg, &st_size,
if (result) {
fprintf(stderr, "error: %s: bad stripe size '%s'\n",
argv[0], stripe_size_arg);
- return result;
+ return CMD_HELP;
}
}
/* get the stripe offset */
time_t t;
struct find_param param = {
.fp_max_depth = -1,
- .quiet = 1,
+ .fp_quiet = 1,
};
struct option long_opts[] = {
{"atime", required_argument, 0, 'A'},
time(&t);
- optind = 0;
/* when getopt_long_only() hits '!' it returns 1, puts "!" in optarg */
while ((c = getopt_long_only(argc, argv,
"-A:c:C:D:g:G:i:L:m:M:n:O:Ppqrs:S:t:u:U:v",
break;
case 'c':
if (optarg[0] == '+') {
- param.stripecount_sign = -1;
+ param.fp_stripe_count_sign = -1;
optarg++;
} else if (optarg[0] == '-') {
- param.stripecount_sign = 1;
+ param.fp_stripe_count_sign = 1;
optarg++;
}
- param.stripecount = strtoul(optarg, &endptr, 0);
+ param.fp_stripe_count = strtoul(optarg, &endptr, 0);
if (*endptr != '\0') {
fprintf(stderr,"error: bad stripe_count '%s'\n",
optarg);
ret = -1;
goto err;
}
- param.check_stripecount = 1;
- param.exclude_stripecount = !!neg_opt;
+ param.fp_check_stripe_count = 1;
+ param.fp_exclude_stripe_count = !!neg_opt;
break;
case 'D':
param.fp_max_depth = strtol(optarg, 0, 0);
param.fp_check_gid = 1;
break;
case 'L':
- ret = name2layout(¶m.layout, optarg);
+ ret = name2layout(¶m.fp_layout, optarg);
if (ret)
goto err;
- param.exclude_layout = !!neg_opt;
- param.check_layout = 1;
+ param.fp_exclude_layout = !!neg_opt;
+ param.fp_check_layout = 1;
break;
case 'u':
case 'U':
}
/* we do check for empty pool because empty pool
* is used to find V1 lov attributes */
- strncpy(param.poolname, optarg, LOV_MAXPOOLNAME);
- param.poolname[LOV_MAXPOOLNAME] = '\0';
- param.exclude_pool = !!neg_opt;
- param.check_pool = 1;
+ strncpy(param.fp_poolname, optarg, LOV_MAXPOOLNAME);
+ param.fp_poolname[LOV_MAXPOOLNAME] = '\0';
+ param.fp_exclude_pool = !!neg_opt;
+ param.fp_check_pool = 1;
break;
case 'n':
- param.pattern = (char *)optarg;
- param.exclude_pattern = !!neg_opt;
+ param.fp_pattern = (char *)optarg;
+ param.fp_exclude_pattern = !!neg_opt;
break;
case 'm':
case 'i':
goto err;
}
- param.exclude_obd = !!neg_opt;
+ param.fp_exclude_obd = !!neg_opt;
token = buf;
while (token && *token) {
}
}
if (c == 'm') {
- param.exclude_mdt = !!neg_opt;
- param.num_alloc_mdts += len;
- tmp = realloc(param.mdtuuid,
- param.num_alloc_mdts *
- sizeof(*param.mdtuuid));
+ param.fp_exclude_mdt = !!neg_opt;
+ param.fp_num_alloc_mdts += len;
+ tmp = realloc(param.fp_mdt_uuid,
+ param.fp_num_alloc_mdts *
+ sizeof(*param.fp_mdt_uuid));
if (tmp == NULL) {
ret = -ENOMEM;
goto err_free;
}
- param.mdtuuid = tmp;
+ param.fp_mdt_uuid = tmp;
} else {
- param.exclude_obd = !!neg_opt;
- param.num_alloc_obds += len;
- tmp = realloc(param.obduuid,
- param.num_alloc_obds *
- sizeof(*param.obduuid));
+ param.fp_exclude_obd = !!neg_opt;
+ param.fp_num_alloc_obds += len;
+ tmp = realloc(param.fp_obd_uuid,
+ param.fp_num_alloc_obds *
+ sizeof(*param.fp_obd_uuid));
if (tmp == NULL) {
ret = -ENOMEM;
goto err_free;
}
- param.obduuid = tmp;
+ param.fp_obd_uuid = tmp;
}
for (token = buf; token && *token; token = next) {
struct obd_uuid *puuid;
if (c == 'm') {
puuid =
- ¶m.mdtuuid[param.num_mdts++];
+ ¶m.fp_mdt_uuid[param.fp_num_mdts++];
} else {
puuid =
- ¶m.obduuid[param.num_obds++];
+ ¶m.fp_obd_uuid[param.fp_num_obds++];
}
p = strchr(token, ',');
next = 0;
break;
}
case 'p':
- param.zeroend = 1;
+ param.fp_zero_end = 1;
break;
case 'P':
break;
case 's':
if (optarg[0] == '+') {
- param.size_sign = -1;
+ param.fp_size_sign = -1;
optarg++;
} else if (optarg[0] == '-') {
- param.size_sign = 1;
+ param.fp_size_sign = 1;
optarg++;
}
- ret = llapi_parse_size(optarg, ¶m.size,
- ¶m.size_units, 0);
+ ret = llapi_parse_size(optarg, ¶m.fp_size,
+ ¶m.fp_size_units, 0);
if (ret) {
fprintf(stderr, "error: bad file size '%s'\n",
optarg);
goto err;
}
- param.check_size = 1;
- param.exclude_size = !!neg_opt;
+ param.fp_check_size = 1;
+ param.fp_exclude_size = !!neg_opt;
break;
case 'S':
if (optarg[0] == '+') {
- param.stripesize_sign = -1;
+ param.fp_stripe_size_sign = -1;
optarg++;
} else if (optarg[0] == '-') {
- param.stripesize_sign = 1;
+ param.fp_stripe_size_sign = 1;
optarg++;
}
- ret = llapi_parse_size(optarg, ¶m.stripesize,
- ¶m.stripesize_units, 0);
+ ret = llapi_parse_size(optarg, ¶m.fp_stripe_size,
+ ¶m.fp_stripe_size_units, 0);
if (ret) {
fprintf(stderr, "error: bad stripe_size '%s'\n",
optarg);
goto err;
}
- param.check_stripesize = 1;
- param.exclude_stripesize = !!neg_opt;
+ param.fp_check_stripe_size = 1;
+ param.fp_exclude_stripe_size = !!neg_opt;
break;
case 't':
param.fp_exclude_type = !!neg_opt;
fprintf(stderr, "error: %s failed for %s.\n",
argv[0], argv[optind - 1]);
err:
- if (param.obduuid && param.num_alloc_obds)
- free(param.obduuid);
+ if (param.fp_obd_uuid && param.fp_num_alloc_obds)
+ free(param.fp_obd_uuid);
- if (param.mdtuuid && param.num_alloc_mdts)
- free(param.mdtuuid);
+ if (param.fp_mdt_uuid && param.fp_num_alloc_mdts)
+ free(param.fp_mdt_uuid);
return ret;
}
int c, rc;
param->fp_max_depth = 1;
- optind = 0;
while ((c = getopt_long(argc, argv, "cdDghiLMoO:pqrRsSv",
long_opts, NULL)) != -1) {
switch (c) {
case 'O':
- if (param->obduuid) {
+ if (param->fp_obd_uuid) {
fprintf(stderr,
"error: %s: only one obduuid allowed",
argv[0]);
return CMD_HELP;
}
- param->obduuid = (struct obd_uuid *)optarg;
+ param->fp_obd_uuid = (struct obd_uuid *)optarg;
break;
case 'q':
- param->quiet++;
+ param->fp_quiet++;
break;
case 'd':
param->fp_max_depth = 0;
break;
case 'D':
- param->get_default_lmv = 1;
+ param->fp_get_default_lmv = 1;
break;
case 'r':
- param->recursive = 1;
+ param->fp_recursive = 1;
break;
case 'v':
- param->verbose = VERBOSE_ALL | VERBOSE_DETAIL;
+ param->fp_verbose = VERBOSE_ALL | VERBOSE_DETAIL;
break;
case 'c':
#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 53, 0)
fprintf(stderr, "warning: '--count' deprecated,"
" use '--stripe-count' instead\n");
#endif
- if (!(param->verbose & VERBOSE_DETAIL)) {
- param->verbose |= VERBOSE_COUNT;
+ if (!(param->fp_verbose & VERBOSE_DETAIL)) {
+ param->fp_verbose |= VERBOSE_COUNT;
param->fp_max_depth = 0;
}
break;
#endif
#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 53, 0) */
case 'S':
- if (!(param->verbose & VERBOSE_DETAIL)) {
- param->verbose |= VERBOSE_SIZE;
+ if (!(param->fp_verbose & VERBOSE_DETAIL)) {
+ param->fp_verbose |= VERBOSE_SIZE;
param->fp_max_depth = 0;
}
break;
fprintf(stderr, "warning: '--index' deprecated"
", use '--stripe-index' instead\n");
#endif
- if (!(param->verbose & VERBOSE_DETAIL)) {
- param->verbose |= VERBOSE_OFFSET;
+ if (!(param->fp_verbose & VERBOSE_DETAIL)) {
+ param->fp_verbose |= VERBOSE_OFFSET;
param->fp_max_depth = 0;
}
break;
case 'p':
- if (!(param->verbose & VERBOSE_DETAIL)) {
- param->verbose |= VERBOSE_POOL;
+ if (!(param->fp_verbose & VERBOSE_DETAIL)) {
+ param->fp_verbose |= VERBOSE_POOL;
param->fp_max_depth = 0;
}
break;
case 'g':
- if (!(param->verbose & VERBOSE_DETAIL)) {
- param->verbose |= VERBOSE_GENERATION;
+ if (!(param->fp_verbose & VERBOSE_DETAIL)) {
+ param->fp_verbose |= VERBOSE_GENERATION;
param->fp_max_depth = 0;
}
break;
case 'L':
- if (!(param->verbose & VERBOSE_DETAIL)) {
- param->verbose |= VERBOSE_LAYOUT;
+ if (!(param->fp_verbose & VERBOSE_DETAIL)) {
+ param->fp_verbose |= VERBOSE_LAYOUT;
param->fp_max_depth = 0;
}
break;
case 'M':
- if (!(param->verbose & VERBOSE_DETAIL))
+ if (!(param->fp_verbose & VERBOSE_DETAIL))
param->fp_max_depth = 0;
- param->verbose |= VERBOSE_MDTINDEX;
+ param->fp_verbose |= VERBOSE_MDTINDEX;
break;
case 'R':
- param->raw = 1;
+ param->fp_raw = 1;
break;
default:
return CMD_HELP;
if (optind >= argc)
return CMD_HELP;
- if (param->recursive)
+ if (param->fp_recursive)
param->fp_max_depth = -1;
- if (!param->verbose)
- param->verbose = VERBOSE_ALL;
- if (param->quiet)
- param->verbose = VERBOSE_OBJID;
+ if (!param->fp_verbose)
+ param->fp_verbose = VERBOSE_ALL;
+ if (param->fp_quiet)
+ param->fp_verbose = VERBOSE_OBJID;
do {
rc = llapi_getstripe(argv[optind], param);
memset(¶m, 0, sizeof(param));
if (!strcmp(argv[0], "mdts"))
- param.get_lmv = 1;
+ param.fp_get_lmv = 1;
rc = llapi_ostlist(mntdir, ¶m);
if (rc) {
{
struct find_param param = { 0 };
- param.get_lmv = 1;
+ param.fp_get_lmv = 1;
return lfs_getstripe_internal(argc, argv, ¶m);
}
char *stripe_count_opt = NULL;
char *stripe_hash_opt = NULL;
char *mode_opt = NULL;
- int default_stripe = 0;
+ bool default_stripe = false;
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO;
mode_t previous_mode = 0;
+ bool delete = false;
struct option long_opts[] = {
{"count", required_argument, 0, 'c'},
+ {"delete", no_argument, 0, 'd'},
{"index", required_argument, 0, 'i'},
{"mode", required_argument, 0, 'm'},
{"hash-type", required_argument, 0, 't'},
{0, 0, 0, 0}
};
- optind = 0;
-
- while ((c = getopt_long(argc, argv, "c:Di:m:t:", long_opts,
+ while ((c = getopt_long(argc, argv, "c:dDi:m:t:", long_opts,
NULL)) >= 0) {
switch (c) {
case 0:
case 'c':
stripe_count_opt = optarg;
break;
+ case 'd':
+ delete = true;
+ default_stripe = true;
+ break;
case 'D':
- default_stripe = 1;
+ default_stripe = true;
break;
case 'i':
stripe_offset_opt = optarg;
return CMD_HELP;
}
- if (stripe_offset_opt == NULL && stripe_count_opt == NULL) {
+ if (!delete && stripe_offset_opt == NULL && stripe_count_opt == NULL) {
fprintf(stderr, "error: %s: missing stripe offset and count.\n",
argv[0]);
return CMD_HELP;
}
}
+ if (delete) {
+ if (stripe_offset_opt != NULL || stripe_count_opt != NULL) {
+ fprintf(stderr, "error: %s: cannot specify -d with -s,"
+ " or -i options.\n", argv[0]);
+ return CMD_HELP;
+ } else {
+ stripe_count = 0;
+ }
+ }
+
+
if (mode_opt != NULL) {
mode = strtoul(mode_opt, &end, 8);
if (*end != '\0') {
dname = argv[optind];
do {
- if (default_stripe == 1) {
+ if (default_stripe) {
result = llapi_dir_set_default_lmv_stripe(dname,
stripe_offset, stripe_count,
hash_type, NULL);
{
struct find_param param = {
.fp_max_depth = -1,
- .mdtindex = -1,
+ .fp_mdt_index = -1,
};
char *end;
int c;
int rc = 0;
struct option long_opts[] = {
- {"--mdt-index", required_argument, 0, 'M'},
+ {"mdt-index", required_argument, 0, 'M'},
{"verbose", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
while ((c = getopt_long(argc, argv, "M:v", long_opts, NULL)) != -1) {
switch (c) {
case 'M': {
- param.mdtindex = strtoul(optarg, &end, 0);
+ param.fp_mdt_index = strtoul(optarg, &end, 0);
if (*end != '\0') {
fprintf(stderr, "%s: invalid MDT index'%s'\n",
argv[0], optarg);
break;
}
case 'v': {
- param.verbose = VERBOSE_DETAIL;
+ param.fp_verbose = VERBOSE_DETAIL;
break;
}
default:
}
}
- if (param.mdtindex == -1) {
- fprintf(stderr, "%s MDT index must be indicated\n", argv[0]);
+ if (param.fp_mdt_index == -1) {
+ fprintf(stderr, "%s: MDT index must be specified\n", argv[0]);
return CMD_HELP;
}
if (optind >= argc) {
- fprintf(stderr, "%s missing operand path\n", argv[0]);
+ fprintf(stderr, "%s: missing operand path\n", argv[0]);
return CMD_HELP;
}
- param.migrate = 1;
+ param.fp_migrate = 1;
rc = llapi_mv(argv[optind], ¶m);
if (rc != 0)
- fprintf(stderr, "cannot migrate '%s' to MDT%04x: %s\n",
- argv[optind], param.mdtindex, strerror(-rc));
+ fprintf(stderr, "%s: cannot migrate '%s' to MDT%04x: %s\n",
+ argv[0], argv[optind], param.fp_mdt_index,
+ strerror(-rc));
return rc;
}
{0, 0, 0, 0}
};
- optind = 0;
while ((c = getopt_long(argc, argv, "hilp:", long_opts, NULL)) != -1) {
switch (c) {
case 'i':
int rc = 0, index = 0, c;
char buf[sizeof(struct obd_uuid)];
- optind = 0;
while ((c = getopt(argc, argv, "h")) != -1)
return CMD_HELP;
memset(&qchk, 0, sizeof(qchk));
- optind = 0;
while ((c = getopt(argc, argv, "gu")) != -1) {
switch (c) {
case 'u':
memset(&qctl, 0, sizeof(qctl));
qctl.qc_cmd = LUSTRE_Q_QUOTAON;
- optind = 0;
while ((c = getopt(argc, argv, "fgu")) != -1) {
switch (c) {
case 'u':
memset(&qctl, 0, sizeof(qctl));
qctl.qc_cmd = LUSTRE_Q_QUOTAOFF;
- optind = 0;
while ((c = getopt(argc, argv, "gu")) != -1) {
switch (c) {
case 'u':
qctl.qc_cmd = LUSTRE_Q_SETINFO;
qctl.qc_type = UGQUOTA;
- optind = 0;
while ((c = getopt_long(argc, argv, "b:gi:tu", long_opts, NULL)) != -1) {
switch (c) {
case 'u':
* so it can be used as a marker that qc_type
* isn't reinitialized from command line */
- optind = 0;
while ((c = getopt_long(argc, argv, "b:B:g:i:I:u:", long_opts, NULL)) != -1) {
switch (c) {
case 'u':
__u64 total_ialloc = 0, total_balloc = 0;
bool human_readable = false;
- optind = 0;
while ((c = getopt(argc, argv, "gi:I:o:qtuvh")) != -1) {
switch (c) {
case 'u':
int index = 0;
int rc = 0;
- optind = 0;
while ((c = getopt(argc, argv, "k")) != -1) {
switch (c) {
case 'k':
char short_opts[] = "f";
int rc, follow = 0;
- optind = 0;
while ((rc = getopt_long(argc, argv, short_opts,
long_opts, NULL)) != -1) {
switch (rc) {
int printcur = 0;
int rc = 0;
- optind = 0;
-
while ((rc = getopt_long(argc, argv, short_opts,
long_opts, NULL)) != -1) {
switch (rc) {
int rc = 0;
bool show_parents = false;
- optind = 0;
while ((rc = getopt_long(argc, argv, short_opts,
long_opts, NULL)) != -1) {
switch (rc) {
if (argc < 2)
return CMD_HELP;
- optind = 0;
while ((c = getopt(argc, argv, "nrw")) != -1) {
switch (c) {
case 'n':
if (argc < 3)
return CMD_HELP;
- optind = 0;
while ((c = getopt_long(argc, argv, short_opts,
long_opts, NULL)) != -1) {
switch (c) {
if ((hps == HPS_RUNNING) &&
(hua == HUA_ARCHIVE || hua == HUA_RESTORE))
- printf("("LPX64 " bytes moved)\n", he.length);
+ printf("(%llu bytes moved)\n",
+ (unsigned long long)he.length);
else if ((he.offset + he.length) == LUSTRE_EOF)
- printf("(from "LPX64 " to EOF)\n", he.offset);
+ printf("(from %llu to EOF)\n",
+ (unsigned long long)he.offset);
else
- printf("(from "LPX64 " to "LPX64")\n",
- he.offset, he.offset + he.length);
+ printf("(from %llu to %llu)\n",
+ (unsigned long long)he.offset,
+ (unsigned long long)(he.offset + he.length));
} while (++i < argc);
if (argc < 2)
return CMD_HELP;
- optind = 0;
while ((c = getopt_long(argc, argv, short_opts,
long_opts, NULL)) != -1) {
switch (c) {
while ((rc = getline(&line, &len, fp)) != -1) {
struct hsm_user_item *hui;
- /* If allocated buffer was too small, gets something
- * bigger */
+ /* If allocated buffer was too small, get something
+ * larger */
if (nbfile_alloc <= hur->hur_request.hr_itemcount) {
ssize_t size;
nbfile_alloc = nbfile_alloc * 2 + 1;
{
int rc;
+ /* Ensure that liblustreapi constructor has run */
+ if (!liblustreapi_initialized)
+ fprintf(stderr, "liblustreapi was not properly initialized\n");
+
setlinebuf(stdout);
Parser_init("lfs > ", cmdlist);