/**
* size_units is to be initialized (or zeroed) by caller.
*/
-int parse_size(char *optarg, unsigned long long *size,
- unsigned long long *size_units, int bytes_spec)
+int llapi_parse_size(const char *optarg, unsigned long long *size,
+ unsigned long long *size_units, int bytes_spec)
{
char *end;
llapi_err_noerrno(LLAPI_MSG_ERROR,
"error LL_IOC_LMV_SETSTRIPE '%s' : too large"
"pool name: %s", name, pool_name);
- GOTO(out, rc = -E2BIG);
+ rc = -E2BIG;
+ goto out;
}
memcpy(lmu.lum_pool_name, pool_name, strlen(pool_name));
}
llapi_error(LLAPI_MSG_ERROR, rc,
"error: LL_IOC_LMV_SETSTRIPE pack failed '%s'.",
name);
- GOTO(out, rc);
+ goto out;
}
fd = open(dir, O_DIRECTORY | O_RDONLY);
if (fd < 0) {
rc = -errno;
llapi_error(LLAPI_MSG_ERROR, rc, "unable to open '%s'", name);
- GOTO(out, rc);
+ goto out;
}
if (ioctl(fd, LL_IOC_LMV_SETSTRIPE, buf)) {
rc = -errno;
llapi_error(LLAPI_MSG_ERROR, rc, "unable to open '%s'",
filename);
- GOTO(out, rc);
+ goto out;
}
if (ioctl(fd, LL_IOC_REMOVE_ENTRY, filename)) {
} else if (!d && !parent) {
/* ENOTDIR. Open the parent dir. */
p = opendir_parent(path);
- if (!p)
- GOTO(out, ret = -errno);
+ if (!p) {
+ ret = -errno;
+ goto out;
+ }
}
if (sem_init && (ret = sem_init(path, parent ?: p, d, data, de)))
goto err;
- if (!d || (param->get_lmv && !param->recursive))
- GOTO(out, ret = 0);
+ if (!d || (param->get_lmv && !param->recursive)) {
+ ret = 0;
+ goto out;
+ }
while ((dent = readdir64(d)) != NULL) {
param->have_fileinfo = 0;
int num_obds, int **obdindexes, int *obdindex,
enum tgt_type type)
{
- int ret, obdcount, obd_valid = 0, obdnum, i;
+ int ret, obdcount, obd_valid = 0, obdnum;
+ long i;
struct obd_uuid *uuids = NULL;
char buf[16];
int *indexes;
}
}
- if ((verbose & VERBOSE_DETAIL) && !is_dir) {
- llapi_printf(LLAPI_MSG_NORMAL, "lmm_stripe_pattern: %x%c",
- lum->lmm_pattern, nl);
- }
+ if ((verbose & VERBOSE_LAYOUT) && !is_dir) {
+ if (verbose & ~VERBOSE_LAYOUT)
+ llapi_printf(LLAPI_MSG_NORMAL, "%spattern: ",
+ prefix);
+ llapi_printf(LLAPI_MSG_NORMAL, "%.x%c", lum->lmm_pattern, nl);
+ }
if ((verbose & VERBOSE_GENERATION) && !is_dir) {
if (verbose & ~VERBOSE_GENERATION)
/* Request MDS for the stat info if some of these parameters need
* to be compared. */
- if (param->obduuid || param->mdtuuid || param->check_uid ||
- param->check_gid || param->check_pool || param->atime ||
- param->ctime || param->mtime || param->check_size ||
- param->check_stripecount || param->check_stripesize)
- decision = 0;
+ if (param->obduuid || param->mdtuuid || param->check_uid ||
+ param->check_gid || param->check_pool || param->atime ||
+ param->ctime || param->mtime || param->check_size ||
+ param->check_stripecount || param->check_stripesize ||
+ param->check_layout)
+ decision = 0;
if (param->type && checked_type == 0)
decision = 0;
goto decided;
}
+ if (param->check_layout) {
+ __u32 found;
+
+ found = (param->lmd->lmd_lmm.lmm_pattern & param->layout);
+ if ((param->lmd->lmd_lmm.lmm_pattern == 0xFFFFFFFF) ||
+ (found && param->exclude_layout) ||
+ (!found && !param->exclude_layout)) {
+ decision = -1;
+ goto decided;
+ }
+ }
+
/* If an OBD UUID is specified but none matches, skip this file. */
if ((param->obduuid && param->obdindex == OBD_NOT_FOUND) ||
(param->mdtuuid && param->mdtindex == OBD_NOT_FOUND))
close(fd);
if (rc < 0) {
rc = -errno;
- llapi_error(LLAPI_MSG_ERROR, rc, "ioctl %d\n", fd);
+ llapi_error(LLAPI_MSG_ERROR, rc,
+ "ioctl RMTACL on '%s' err %d\n",
+ mnt->mnt_dir, rc);
goto out;
}
{
char fsname[20];
char *ptr;
- int fd, index, rc;
+ int fd, rc;
+ long index;
/* Take path, fsname, or MDTname. Assume MDT0000 in the former cases.
Open root and parse mdt index. */
int llapi_changelog_clear(const char *mdtname, const char *idstr,
long long endrec)
{
- int id;
+ long id;
if (endrec < 0) {
llapi_err_noerrno(LLAPI_MSG_ERROR,