4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2014, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/utils/lustre_cfg.c
38 * Author: Peter J. Braam <braam@clusterfs.com>
39 * Author: Phil Schwan <phil@clusterfs.com>
40 * Author: Andreas Dilger <adilger@clusterfs.com>
41 * Author: Robert Read <rread@clusterfs.com>
45 #include <sys/ioctl.h>
53 #include <libcfs/libcfs.h>
54 #include <libcfs/util/string.h>
55 #include <libcfs/util/parser.h>
56 #include <lnet/nidstr.h>
57 #include <lustre_cfg.h>
58 #include <lustre/lustre_idl.h>
59 #include <lustre/lustre_build_version.h>
69 #include <lnet/lnetctl.h>
72 static char * lcfg_devname;
74 int lcfg_set_devname(char *name)
82 /* quietly strip the unnecessary '$' */
83 if (*name == '$' || *name == '%')
87 while (*ptr != '\0') {
96 /* We can't translate from dev # to name */
99 lcfg_devname = strdup(name);
107 char * lcfg_get_devname(void)
112 int jt_lcfg_device(int argc, char **argv)
114 return jt_obd_device(argc, argv);
117 int jt_lcfg_attach(int argc, char **argv)
119 struct lustre_cfg_bufs bufs;
120 struct lustre_cfg *lcfg;
126 lustre_cfg_bufs_reset(&bufs, NULL);
128 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
129 lustre_cfg_bufs_set_string(&bufs, 0, argv[2]);
130 lustre_cfg_bufs_set_string(&bufs, 2, argv[3]);
132 lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
136 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
137 lustre_cfg_free(lcfg);
140 fprintf(stderr, "error: %s: LCFG_ATTACH %s\n",
141 jt_cmdname(argv[0]), strerror(rc = errno));
143 lcfg_set_devname(argv[2]);
149 int jt_lcfg_setup(int argc, char **argv)
151 struct lustre_cfg_bufs bufs;
152 struct lustre_cfg *lcfg;
156 if (lcfg_devname == NULL) {
157 fprintf(stderr, "%s: please use 'device name' to set the "
158 "device name for config commands.\n",
159 jt_cmdname(argv[0]));
163 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
168 for (i = 1; i < argc; i++) {
169 lustre_cfg_bufs_set_string(&bufs, i, argv[i]);
172 lcfg = lustre_cfg_new(LCFG_SETUP, &bufs);
176 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
177 lustre_cfg_free(lcfg);
180 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
181 strerror(rc = errno));
186 int jt_obd_detach(int argc, char **argv)
188 struct lustre_cfg_bufs bufs;
189 struct lustre_cfg *lcfg;
192 if (lcfg_devname == NULL) {
193 fprintf(stderr, "%s: please use 'device name' to set the "
194 "device name for config commands.\n",
195 jt_cmdname(argv[0]));
199 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
204 lcfg = lustre_cfg_new(LCFG_DETACH, &bufs);
208 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
209 lustre_cfg_free(lcfg);
212 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
213 strerror(rc = errno));
218 int jt_obd_cleanup(int argc, char **argv)
220 struct lustre_cfg_bufs bufs;
221 struct lustre_cfg *lcfg;
224 char flags[3] = { 0 };
228 if (lcfg_devname == NULL) {
229 fprintf(stderr, "%s: please use 'device name' to set the "
230 "device name for config commands.\n",
231 jt_cmdname(argv[0]));
235 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
237 if (argc < 1 || argc > 3)
240 /* we are protected from overflowing our buffer by the argc
243 for (n = 1; n < argc; n++) {
244 if (strcmp(argv[n], "force") == 0) {
245 flags[flag_cnt++] = force;
246 } else if (strcmp(argv[n], "failover") == 0) {
247 flags[flag_cnt++] = failover;
249 fprintf(stderr, "unknown option: %s\n", argv[n]);
255 lustre_cfg_bufs_set_string(&bufs, 1, flags);
258 lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
262 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
263 lustre_cfg_free(lcfg);
266 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
267 strerror(rc = errno));
273 int do_add_uuid(char * func, char *uuid, lnet_nid_t nid)
276 struct lustre_cfg_bufs bufs;
277 struct lustre_cfg *lcfg;
279 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
281 lustre_cfg_bufs_set_string(&bufs, 1, uuid);
283 lcfg = lustre_cfg_new(LCFG_ADD_UUID, &bufs);
287 lcfg->lcfg_nid = nid;
289 rc = lcfg_ioctl(func, OBD_DEV_ID, lcfg);
290 lustre_cfg_free(lcfg);
293 fprintf(stderr, "IOC_PORTAL_ADD_UUID failed: %s\n",
299 printf("Added uuid %s: %s\n", uuid, libcfs_nid2str(nid));
304 int jt_lcfg_add_uuid(int argc, char **argv)
312 nid = libcfs_str2nid(argv[2]);
313 if (nid == LNET_NID_ANY) {
314 fprintf (stderr, "Can't parse NID %s\n", argv[2]);
318 return do_add_uuid(argv[0], argv[1], nid);
321 int jt_lcfg_del_uuid(int argc, char **argv)
324 struct lustre_cfg_bufs bufs;
325 struct lustre_cfg *lcfg;
328 fprintf(stderr, "usage: %s <uuid>\n", argv[0]);
332 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
333 if (strcmp (argv[1], "_all_"))
334 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
336 lcfg = lustre_cfg_new(LCFG_DEL_UUID, &bufs);
340 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
341 lustre_cfg_free(lcfg);
344 fprintf(stderr, "IOC_PORTAL_DEL_UUID failed: %s\n",
351 int jt_lcfg_del_mount_option(int argc, char **argv)
354 struct lustre_cfg_bufs bufs;
355 struct lustre_cfg *lcfg;
360 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
363 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
365 lcfg = lustre_cfg_new(LCFG_DEL_MOUNTOPT, &bufs);
369 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
370 lustre_cfg_free(lcfg);
373 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
374 strerror(rc = errno));
379 int jt_lcfg_set_timeout(int argc, char **argv)
382 struct lustre_cfg_bufs bufs;
383 struct lustre_cfg *lcfg;
385 fprintf(stderr, "%s has been deprecated. Use conf_param instead.\n"
386 "e.g. conf_param lustre-MDT0000 obd_timeout=50\n",
387 jt_cmdname(argv[0]));
394 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
395 lcfg = lustre_cfg_new(LCFG_SET_TIMEOUT, &bufs);
399 lcfg->lcfg_num = atoi(argv[1]);
401 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
402 lustre_cfg_free(lcfg);
405 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
406 strerror(rc = errno));
411 int jt_lcfg_add_conn(int argc, char **argv)
413 struct lustre_cfg_bufs bufs;
414 struct lustre_cfg *lcfg;
425 if (lcfg_devname == NULL) {
426 fprintf(stderr, "%s: please use 'device name' to set the "
427 "device name for config commands.\n",
428 jt_cmdname(argv[0]));
432 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
434 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
436 lcfg = lustre_cfg_new(LCFG_ADD_CONN, &bufs);
440 lcfg->lcfg_num = priority;
442 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
443 lustre_cfg_free(lcfg);
446 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
447 strerror(rc = errno));
453 int jt_lcfg_del_conn(int argc, char **argv)
455 struct lustre_cfg_bufs bufs;
456 struct lustre_cfg *lcfg;
462 if (lcfg_devname == NULL) {
463 fprintf(stderr, "%s: please use 'device name' to set the "
464 "device name for config commands.\n",
465 jt_cmdname(argv[0]));
469 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
471 /* connection uuid */
472 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
474 lcfg = lustre_cfg_new(LCFG_DEL_MOUNTOPT, &bufs);
478 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
479 lustre_cfg_free(lcfg);
482 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
483 strerror(rc = errno));
489 /* Param set locally, directly on target */
490 int jt_lcfg_param(int argc, char **argv)
493 struct lustre_cfg_bufs bufs;
494 struct lustre_cfg *lcfg;
496 if (argc >= LUSTRE_CFG_MAX_BUFCOUNT)
499 lustre_cfg_bufs_reset(&bufs, NULL);
501 for (i = 1; i < argc; i++) {
502 lustre_cfg_bufs_set_string(&bufs, i, argv[i]);
505 lcfg = lustre_cfg_new(LCFG_PARAM, &bufs);
509 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
510 lustre_cfg_free(lcfg);
513 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
514 strerror(rc = errno));
520 unsigned int po_only_path:1;
521 unsigned int po_show_path:1;
522 unsigned int po_show_type:1;
523 unsigned int po_recursive:1;
524 unsigned int po_params2:1;
525 unsigned int po_delete:1;
528 /* Param set to single log file, used by all clients and servers.
529 * This should be loaded after the individual config logs.
530 * Called from set param with -P option.
532 static int jt_lcfg_mgsparam2(int argc, char **argv, struct param_opts *popt)
536 struct lustre_cfg_bufs bufs;
537 struct lustre_cfg *lcfg;
541 first_param = optind;
542 if (first_param < 0 || first_param >= argc)
545 for (i = first_param, rc = 0; i < argc; i++) {
546 lustre_cfg_bufs_reset(&bufs, NULL);
547 /* This same command would be executed on all nodes, many
548 * of which should fail (silently) because they don't have
549 * that proc file existing locally. There would be no
550 * preprocessing on the MGS to try to figure out which
551 * parameter files to add this to, there would be nodes
552 * processing on the cluster nodes to try to figure out
553 * if they are the intended targets. They will blindly
554 * try to set the parameter, and ENOTFOUND means it wasn't
556 * Target name "general" means call on all targets. It is
557 * left here in case some filtering will be added in
560 lustre_cfg_bufs_set_string(&bufs, 0, "general");
562 len = strlen(argv[i]);
564 /* put an '=' on the end in case it doesn't have one */
565 if (popt->po_delete && argv[i][len - 1] != '=') {
566 buf = malloc(len + 1);
567 sprintf(buf, "%s=", argv[i]);
571 lustre_cfg_bufs_set_string(&bufs, 1, buf);
573 lcfg = lustre_cfg_new(LCFG_SET_PARAM, &bufs);
575 fprintf(stderr, "error: allocating lcfg for %s: %s\n",
576 jt_cmdname(argv[0]), strerror(-ENOMEM));
580 int rc2 = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
582 fprintf(stderr, "error: executing %s: %s\n",
583 jt_cmdname(argv[0]), strerror(errno));
587 lustre_cfg_free(lcfg);
596 /* Param set in config log on MGS */
597 /* conf_param key=value */
598 /* Note we can actually send mgc conf_params from clients, but currently
599 * that's only done for default file striping (see ll_send_mgc_param),
601 /* After removal of a parameter (-d) Lustre will use the default
602 * AT NEXT REBOOT, not immediately. */
603 int jt_lcfg_mgsparam(int argc, char **argv)
607 struct lustre_cfg_bufs bufs;
608 struct lustre_cfg *lcfg;
611 #if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 53, 0)
612 fprintf(stderr, "warning: 'lctl conf_param' is deprecated, "
613 "use 'lctl set_param -P' instead\n");
616 /* mgs_setparam processes only lctl buf #1 */
617 if ((argc > 3) || (argc <= 1))
620 while ((rc = getopt(argc, argv, "d")) != -1) {
630 lustre_cfg_bufs_reset(&bufs, NULL);
634 /* for delete, make it "<param>=\0" */
635 buf = malloc(strlen(argv[optind]) + 2);
636 /* put an '=' on the end in case it doesn't have one */
637 sprintf(buf, "%s=", argv[optind]);
638 /* then truncate after the first '=' */
639 ptr = strchr(buf, '=');
641 lustre_cfg_bufs_set_string(&bufs, 1, buf);
643 lustre_cfg_bufs_set_string(&bufs, 1, argv[optind]);
646 /* We could put other opcodes here. */
647 lcfg = lustre_cfg_new(LCFG_PARAM, &bufs);
651 rc = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
652 lustre_cfg_free(lcfg);
657 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
658 strerror(rc = errno));
664 /* Display the path in the same format as sysctl
665 * For eg. obdfilter.lustre-OST0000.stats */
667 display_name(char *filename, size_t filename_size, bool po_show_type)
674 if (lstat(filename, &st) == -1)
677 if (S_ISDIR(st.st_mode))
679 else if (S_ISLNK(st.st_mode))
681 else if (st.st_mode & S_IWUSR)
685 filename += strlen("/proc/");
686 if (strncmp(filename, "fs/", strlen("fs/")) == 0)
687 filename += strlen("fs/");
689 filename += strlen("sys/");
691 if (strncmp(filename, "lustre/", strlen("lustre/")) == 0)
692 filename += strlen("lustre/");
693 else if (strncmp(filename, "lnet/", strlen("lnet/")) == 0)
694 filename += strlen("lnet/");
696 /* replace '/' with '.' to match conf_param and sysctl */
698 while ((tmp = strchr(tmp, '/')) != NULL)
701 /* Append the indicator to entries. We know there is enough space
702 * for the suffix, since the path prefix was deleted. */
703 if (po_show_type && suffix != NULL)
704 strncat(filename, suffix, filename_size);
709 /* Find a character in a length limited string */
710 /* BEWARE - kernel definition of strnchr has args in different order! */
711 static char *strnchr(const char *p, char c, size_t n)
724 static char *globerrstr(int glob_rc)
728 return "Out of memory";
732 return "Found no match";
734 return "Unknown error";
737 static void clean_path(char *path)
741 /* If the input is in form Eg. obdfilter.*.stats */
742 if (strchr(path, '.')) {
744 while (*tmp != '\0') {
746 (tmp != path) && (*(tmp - 1) != '\\'))
751 /* get rid of '\', glob doesn't like it */
752 if ((tmp = strrchr(path, '\\')) != NULL) {
753 char *tail = path + strlen(path);
754 while (tmp != path) {
756 memmove(tmp, tmp + 1, tail - tmp);
764 /* Take a parameter name and turn it into a pathname glob.
765 * Disallow relative pathnames to avoid potential problems. */
766 static int lprocfs_param_pattern(const char *pattern, char *buf, size_t bufsize)
770 rc = snprintf(buf, bufsize, "/proc/{fs,sys}/{lnet,lustre}/%s", pattern);
773 } else if (rc >= bufsize) {
774 fprintf(stderr, "error: parameter '%s' too long\n", pattern);
781 static int listparam_cmdline(int argc, char **argv, struct param_opts *popt)
785 popt->po_show_path = 1;
786 popt->po_only_path = 1;
787 popt->po_show_type = 0;
788 popt->po_recursive = 0;
790 while ((ch = getopt(argc, argv, "FR")) != -1) {
793 popt->po_show_type = 1;
796 popt->po_recursive = 1;
806 static int listparam_display(struct param_opts *popt, char *pattern)
809 char filename[PATH_MAX + 1]; /* extra 1 byte for file type */
813 rc = lprocfs_param_pattern(pattern, filename, sizeof(filename));
817 rc = glob(filename, GLOB_BRACE | (popt->po_recursive ? GLOB_MARK : 0),
820 fprintf(stderr, "error: list_param: %s: %s\n",
821 pattern, globerrstr(rc));
825 for (i = 0; i < glob_info.gl_pathc; i++) {
826 int len = sizeof(filename), last;
827 char *valuename = NULL;
829 /* Trailing '/' will indicate recursion into directory */
830 last = strlen(glob_info.gl_pathv[i]) - 1;
832 /* Remove trailing '/' or it will be converted to '.' */
833 if (last > 0 && glob_info.gl_pathv[i][last] == '/')
834 glob_info.gl_pathv[i][last] = '\0';
837 strlcpy(filename, glob_info.gl_pathv[i], len);
838 valuename = display_name(filename, len, popt->po_show_type);
840 printf("%s\n", valuename);
842 strlcpy(filename, glob_info.gl_pathv[i], len);
843 strlcat(filename, "/*", len);
844 listparam_display(popt, filename);
848 globfree(&glob_info);
852 int jt_lcfg_listparam(int argc, char **argv)
855 struct param_opts popt;
858 rc = listparam_cmdline(argc, argv, &popt);
859 if (rc == argc && popt.po_recursive) {
860 rc--; /* we know at least "-R" is a parameter */
862 } else if (rc < 0 || rc >= argc) {
866 for (i = rc; i < argc; i++) {
871 rc = listparam_display(&popt, pattern);
879 static int getparam_cmdline(int argc, char **argv, struct param_opts *popt)
883 popt->po_show_path = 1;
884 popt->po_only_path = 0;
885 popt->po_show_type = 0;
886 popt->po_recursive = 0;
888 while ((ch = getopt(argc, argv, "nNF")) != -1) {
891 popt->po_only_path = 1;
894 popt->po_show_path = 0;
897 popt->po_show_type = 1;
907 static int getparam_display(struct param_opts *popt, char *pattern)
909 long page_size = sysconf(_SC_PAGESIZE);
910 char filename[PATH_MAX + 1]; /* extra 1 byte for file type */
917 rc = lprocfs_param_pattern(pattern, filename, sizeof(filename));
921 rc = glob(filename, GLOB_BRACE, NULL, &glob_info);
923 fprintf(stderr, "error: get_param: %s: %s\n",
924 pattern, globerrstr(rc));
928 buf = malloc(page_size);
932 for (i = 0; i < glob_info.gl_pathc; i++) {
933 char *valuename = NULL;
935 memset(buf, 0, page_size);
936 /* As listparam_display is used to show param name (with type),
937 * here "if (only_path)" is ignored.*/
938 if (popt->po_show_path) {
939 if (strlen(glob_info.gl_pathv[i]) >
940 sizeof(filename) - 1) {
944 strncpy(filename, glob_info.gl_pathv[i],
946 valuename = display_name(filename, sizeof(filename),
950 /* Write the contents of file to stdout */
951 fd = open(glob_info.gl_pathv[i], O_RDONLY);
954 "error: get_param: opening('%s') failed: %s\n",
955 glob_info.gl_pathv[i], strerror(errno));
960 rc = read(fd, buf, page_size);
964 fprintf(stderr, "error: get_param: "
965 "read('%s') failed: %s\n",
966 glob_info.gl_pathv[i], strerror(errno));
969 /* Print the output in the format path=value if the
970 * value contains no new line character or can be
971 * occupied in a line, else print value on new line */
972 if (valuename && popt->po_show_path) {
975 longbuf = strnchr(buf, rc - 1, '\n') != NULL ||
976 rc + strlen(valuename) >= 80;
977 printf("%s=%s", valuename,
978 longbuf ? "\n" : buf);
984 rc = write(fileno(stdout), buf, rc);
986 fprintf(stderr, "error: get_param: "
987 "write to stdout failed: %s\n",
995 globfree(&glob_info);
1000 int jt_lcfg_getparam(int argc, char **argv)
1003 struct param_opts popt;
1006 rc = getparam_cmdline(argc, argv, &popt);
1007 if (rc < 0 || rc >= argc)
1010 for (i = rc, rc = 0; i < argc; i++) {
1017 if (popt.po_only_path)
1018 rc2 = listparam_display(&popt, param);
1020 rc2 = getparam_display(&popt, param);
1021 if (rc2 < 0 && rc == 0)
1028 static int setparam_cmdline(int argc, char **argv, struct param_opts *popt)
1032 popt->po_show_path = 1;
1033 popt->po_only_path = 0;
1034 popt->po_show_type = 0;
1035 popt->po_recursive = 0;
1036 popt->po_params2 = 0;
1037 popt->po_delete = 0;
1039 while ((ch = getopt(argc, argv, "nPd")) != -1) {
1042 popt->po_show_path = 0;
1045 popt->po_params2 = 1;
1048 popt->po_delete = 1;
1057 static int setparam_display(struct param_opts *popt, char *pattern, char *value)
1060 char filename[PATH_MAX + 1]; /* extra 1 byte for file type */
1065 rc = lprocfs_param_pattern(pattern, filename, sizeof(filename));
1069 rc = glob(filename, GLOB_BRACE, NULL, &glob_info);
1071 fprintf(stderr, "error: set_param: %s: %s\n",
1072 pattern, globerrstr(rc));
1075 for (i = 0; i < glob_info.gl_pathc; i++) {
1076 char *valuename = NULL;
1078 if (popt->po_show_path) {
1079 if (strlen(glob_info.gl_pathv[i]) > sizeof(filename)-1)
1081 strncpy(filename, glob_info.gl_pathv[i],
1083 valuename = display_name(filename, sizeof(filename),
1086 printf("%s=%s\n", valuename, value);
1088 /* Write the new value to the file */
1089 fd = open(glob_info.gl_pathv[i], O_WRONLY);
1093 rc2 = write(fd, value, strlen(value));
1097 fprintf(stderr, "error: set_param: setting "
1098 "%s=%s: %s\n", glob_info.gl_pathv[i],
1099 value, strerror(errno));
1105 fprintf(stderr, "error: set_param: opening %s: %s\n",
1106 strerror(errno), glob_info.gl_pathv[i]);
1110 globfree(&glob_info);
1114 int jt_lcfg_setparam(int argc, char **argv)
1117 struct param_opts popt;
1118 char *pattern = NULL, *value = NULL;
1120 rc = setparam_cmdline(argc, argv, &popt);
1121 if (rc < 0 || rc >= argc)
1124 if (popt.po_params2)
1125 /* We can't delete parameters that were
1126 * set with old conf_param interface */
1127 return jt_lcfg_mgsparam2(argc, argv, &popt);
1129 for (i = rc, rc = 0; i < argc; i++) {
1132 value = strchr(argv[i], '=');
1133 if (value != NULL) {
1134 /* format: set_param a=b */
1141 /* format: set_param a b */
1142 if (pattern == NULL) {
1150 clean_path(pattern);
1152 rc2 = setparam_display(&popt, pattern, value);
1155 if (rc2 < 0 && rc == 0)
1158 if (pattern != NULL && (value == NULL || *value == '\0'))
1159 fprintf(stderr, "error: %s: setting %s=: %s\n",
1160 jt_cmdname(argv[0]), pattern, strerror(rc = EINVAL));