#include <ctype.h>
#include <glob.h>
-#ifndef __KERNEL__
-#include <liblustre.h>
-#endif
-#include <lustre_lib.h>
+#include <libcfs/libcfs.h>
#include <lustre_cfg.h>
#include <lustre/lustre_idl.h>
-#include <lustre_dlm.h>
-#include <obd.h> /* for struct lov_stripe_md */
-#include <obd_lov.h>
#include <lustre/lustre_build_version.h>
#include <unistd.h>
return do_add_uuid(argv[0], argv[1], nid);
}
-int obd_add_uuid(char *uuid, lnet_nid_t nid)
-{
- return do_add_uuid("obd_add_uuid", uuid, nid);
-}
-
int jt_lcfg_del_uuid(int argc, char **argv)
{
int rc;
int rc2 = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
if (rc2 != 0) {
fprintf(stderr, "error: executing %s: %s\n",
- jt_cmdname(argv[0]), strerror(rc2));
+ jt_cmdname(argv[0]), strerror(errno));
if (rc == 0)
rc = rc2;
}
* AT NEXT REBOOT, not immediately. */
int jt_lcfg_mgsparam(int argc, char **argv)
{
- int rc;
- int del = 0;
- struct lustre_cfg_bufs bufs;
- struct lustre_cfg *lcfg;
- char *buf = NULL;
+ int rc;
+ int del = 0;
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
+ char *buf = NULL;
-#if LUSTRE_VERSION >= OBD_OCD_VERSION(2,7,53,0)
+#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 53, 0)
fprintf(stderr, "warning: 'lctl conf_param' is deprecated, "
"use 'lctl set_param -P' instead\n");
#endif
/* As listparam_display is used to show param name (with type),
* here "if (only_path)" is ignored.*/
if (popt->po_show_path) {
- strcpy(filename, glob_info.gl_pathv[i]);
+ if (strlen(glob_info.gl_pathv[i]) >
+ sizeof(filename)-1) {
+ free(buf);
+ return -E2BIG;
+ }
+ strncpy(filename, glob_info.gl_pathv[i],
+ sizeof(filename));
valuename = display_name(filename, 0);
}
char *valuename = NULL;
if (popt->po_show_path) {
- strcpy(filename, glob_info.gl_pathv[i]);
+ if (strlen(glob_info.gl_pathv[i]) > sizeof(filename)-1)
+ return -E2BIG;
+ strncpy(filename, glob_info.gl_pathv[i],
+ sizeof(filename));
valuename = display_name(filename, 0);
if (valuename)
printf("%s=%s\n", valuename, value);
*value = '\0';
value ++;
path = argv[i];
+ if (*value == '\0')
+ break;
} else {
/* format: set_param a b */
if (path == NULL) {
if (rc2 < 0 && rc == 0)
rc = rc2;
}
+ if (path != NULL && (value == NULL || *value == '\0'))
+ fprintf(stderr, "error: %s: setting %s=: %s\n",
+ jt_cmdname(argv[0]), path, strerror(rc = EINVAL));
return rc;
}