#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <getopt.h>
#include <glob.h>
#include <signal.h>
#include <stdarg.h>
#include "obdctl.h"
#include <libcfs/libcfs.h>
-#include <lnet/lnet.h>
+#include <lnet/nidstr.h>
#include <lustre/lustre_idl.h>
#include <lustre_cfg.h>
#include <lustre_ioctl.h>
if (rc)
fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
strerror(-rc));
- else
- printf("Lustre version: %s\n", version);
+ else
+ printf("Lustre version: %s\n", version);
- printf("lctl version: %s\n", BUILD_VERSION);
- return rc;
+ return rc;
}
-/*
- * Print an obd device line with the ost_conn_uuid inserted, if the obd
- * is an osc.
- */
static void print_obd_line(char *s)
{
char buf[MAX_STRING_SIZE];
FILE *fp = NULL;
char *ptr;
- if (sscanf(s, " %*d %*s osc %s %*s %*d ", obd_name) == 0)
+ snprintf(buf, sizeof(buf), " %%*d %%*s osc %%%zus %%*s %%*d ",
+ sizeof(obd_name) - 1);
+ if (sscanf(s, buf, obd_name) == 0)
goto try_mdc;
snprintf(buf, sizeof(buf),
"/proc/fs/lustre/osc/%s/ost_conn_uuid", obd_name);
goto got_one;
try_mdc:
- if (sscanf(s, " %*d %*s mdc %s %*s %*d ", obd_name) == 0)
+ snprintf(buf, sizeof(buf), " %%*d %%*s mdc %%%zus %%*s %%*d ",
+ sizeof(obd_name) - 1);
+ if (sscanf(s, buf, obd_name) == 0)
goto fail;
snprintf(buf, sizeof(buf),
"/proc/fs/lustre/mdc/%s/mds_conn_uuid", obd_name);
if (ostname != NULL)
lustre_cfg_bufs_set_string(&bufs, 2, ostname);
- lcfg = lustre_cfg_new(cmd, &bufs);
+ lcfg = lustre_cfg_new(cmd, &bufs);
if (lcfg == NULL)
- return rc;
+ return -ENOMEM;
memset(&data, 0, sizeof(data));
rc = data.ioc_dev = get_mgs_device();
if (rc) {
fprintf(stderr, "error: %s: invalid ioctl\n",
jt_cmdname(cmdname));
+ lustre_cfg_free(lcfg);
return rc;
}
rc = l_ioctl(OBD_DEV_ID, OBD_IOC_POOL, buf);
}
if (nodemap_name == NULL || param == NULL || value == NULL) {
- fprintf(stderr, "usage: nodemap_modify --name <name> "
- "--property <range> --value <value>\n");
+ fprintf(stderr, "usage: nodemap_modify --name <nodemap_name> "
+ "--property <property_name> --value <value>\n");
+ fprintf(stderr, "valid properties: admin trusted "
+ "squash_uid squash_gid\n");
return -1;
}
rc = nodemap_cmd(cmd, NULL, 0, argv[0], nodemap_name, idmap, NULL);
if (rc != 0) {
errno = -rc;
- fprintf(stderr, "cannot add %smap '%s' to nodemap '%s'"
+ fprintf(stderr, "cannot delete %smap '%s' from nodemap '%s'"
": rc = %d\n", idtype, idmap, nodemap_name, rc);
}