* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
static int get_mds_md_size(const char *path)
{
- int md_size = lov_mds_md_size(LOV_MAX_STRIPE_COUNT, LOV_MAGIC_V3);
+ int md_size = lov_user_md_size(LOV_MAX_STRIPE_COUNT, LOV_USER_MAGIC_V3);
char buf[80];
int rc;
mntlen = strlen(mnt.mnt_dir);
ptr = strrchr(mnt.mnt_fsname, '/');
- if (!ptr && !len) {
- rc = -EINVAL;
- break;
- }
+ /* thanks to the call to llapi_is_lustre_mnt() above,
+ * we are sure that mnt.mnt_fsname contains ":/",
+ * so ptr should never be NULL */
+ if (ptr == NULL)
+ continue;
ptr++;
/* Check the fsname for a match, if given */
lov_dump_user_lmm_header(lum, path, objects, is_dir, header,
depth, raw, pool_name);
- if (!is_dir && (header & VERBOSE_OBJID)) {
+ if (!is_dir && (header & VERBOSE_OBJID) &&
+ !(lum->lmm_pattern & LOV_PATTERN_F_RELEASED)) {
if (obdstripe == 1)
llapi_printf(LLAPI_MSG_NORMAL,
"\tobdidx\t\t objid\t\t objid\t\t group\n");
* The object_seq needs to be set for the "(Default)"
* prefix to be displayed. */
struct lov_user_md *lmm = ¶m->lmd->lmd_lmm;
- lmm->lmm_magic = LOV_MAGIC_V1;
+ lmm->lmm_magic = LOV_USER_MAGIC_V1;
if (!param->raw)
ostid_set_seq(&lmm->lmm_oi,
FID_SEQ_LOV_DEFAULT);
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;
}
return -errno;
}
if (idx == -1)
- sprintf(filename, LUSTRE_VOLATILE_HDR"::%.4X", random);
+ snprintf(filename, sizeof(filename),
+ LUSTRE_VOLATILE_HDR"::%.4X", random);
else
- sprintf(filename, LUSTRE_VOLATILE_IDX"%.4X", 0, random);
+ snprintf(filename, sizeof(filename),
+ LUSTRE_VOLATILE_IDX"%.4X", 0, random);
- sprintf(file_path, "%s/%s", directory, filename);
+ rc = snprintf(file_path, sizeof(file_path),
+ "%s/%s", directory, filename);
+ if (rc >= sizeof(file_path))
+ return -E2BIG;
- fd = open(file_path, O_RDWR|O_CREAT|mode, S_IRUSR|S_IWUSR);
+ fd = open(file_path, (O_RDWR | O_CREAT | mode), (S_IRUSR | S_IWUSR));
if (fd < 0) {
llapi_error(LLAPI_MSG_ERROR, errno,
"Cannot create volatile file %s in %s\n",