data->ioc_version = OBD_IOCTL_VERSION;
if (*pbuf != NULL && data->ioc_len > max_len) {
- fprintf(stderr, "pbuf = %p, ioc_len = %u, max_len = %d\n",
- *pbuf, data->ioc_len, max_len);
+ llapi_error(LLAPI_MSG_ERROR, -EINVAL,
+ "pbuf = %p, ioc_len = %u, max_len = %d\n",
+ *pbuf, data->ioc_len, max_len);
return -EINVAL;
}
goto free_path;
}
- llapi_printf(LLAPI_MSG_NORMAL, "Pools from %s:\n", fsname);
dir = opendir(pathname.gl_pathv[0]);
if (dir == NULL) {
rc = -errno;
/* check output bounds */
if (nb_entries >= list_size) {
rc = -EOVERFLOW;
- goto free_dir;
+ goto free_dir_no_msg;
}
/* +2 for '.' and final '\0' */
if (used + strlen(pool->d_name) + strlen(fsname) + 2
> buffer_size) {
rc = -EOVERFLOW;
- goto free_dir;
+ goto free_dir_no_msg;
}
sprintf(buffer + used, "%s.%s", fsname, pool->d_name);
if (rc)
llapi_error(LLAPI_MSG_ERROR, rc,
"Error reading pool list for '%s'", name);
+ else
+ llapi_printf(LLAPI_MSG_NORMAL, "Pools from %s:\n", fsname);
+
+free_dir_no_msg:
closedir(dir);
free_path:
cfs_free_param_data(&pathname);
goto migrate;
} else if (errno == EALREADY) {
if (param->fp_verbose & VERBOSE_DETAIL)
- fprintf(stdout,
- "%s was migrated to MDT%d already\n",
- path, lmu->lum_stripe_offset);
+ llapi_printf(LLAPI_MSG_NORMAL,
+ "%s was migrated to MDT%d already\n",
+ path, lmu->lum_stripe_offset);
ret = 0;
} else {
ret = -errno;
- fprintf(stderr, "%s migrate failed: %s (%d)\n",
- path, strerror(-ret), ret);
+ llapi_error(LLAPI_MSG_ERROR, ret,
+ "%s migrate failed: %s (%d)\n",
+ path, strerror(-ret), ret);
goto out;
}
} else if (param->fp_verbose & VERBOSE_DETAIL) {
- fprintf(stdout, "migrate %s to MDT%d stripe count %d\n",
- path, lmu->lum_stripe_offset, lmu->lum_stripe_count);
+ llapi_printf(LLAPI_MSG_NORMAL,
+ "migrate %s to MDT%d stripe count %d\n",
+ path, lmu->lum_stripe_offset,
+ lmu->lum_stripe_count);
}
out: