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, 2012, 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 <liblustre.h>
55 #include <lustre_lib.h>
56 #include <lustre_cfg.h>
57 #include <lustre/lustre_idl.h>
58 #include <lustre_dlm.h>
59 #include <obd.h> /* for struct lov_stripe_md */
61 #include <lustre/lustre_build_version.h>
72 #include <lnet/lnetctl.h>
73 #include <libcfs/libcfsutil.h>
76 static char * lcfg_devname;
78 int lcfg_set_devname(char *name)
86 /* quietly strip the unnecessary '$' */
87 if (*name == '$' || *name == '%')
91 while (*ptr != '\0') {
100 /* We can't translate from dev # to name */
103 lcfg_devname = strdup(name);
111 char * lcfg_get_devname(void)
116 int jt_lcfg_device(int argc, char **argv)
118 return jt_obd_device(argc, argv);
121 int jt_lcfg_attach(int argc, char **argv)
123 struct lustre_cfg_bufs bufs;
124 struct lustre_cfg *lcfg;
130 lustre_cfg_bufs_reset(&bufs, NULL);
132 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
133 lustre_cfg_bufs_set_string(&bufs, 0, argv[2]);
134 lustre_cfg_bufs_set_string(&bufs, 2, argv[3]);
136 lcfg = lustre_cfg_new(LCFG_ATTACH, &bufs);
137 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
138 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);
173 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
174 lustre_cfg_free(lcfg);
176 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
177 strerror(rc = errno));
182 int jt_obd_detach(int argc, char **argv)
184 struct lustre_cfg_bufs bufs;
185 struct lustre_cfg *lcfg;
188 if (lcfg_devname == NULL) {
189 fprintf(stderr, "%s: please use 'device name' to set the "
190 "device name for config commands.\n",
191 jt_cmdname(argv[0]));
195 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
200 lcfg = lustre_cfg_new(LCFG_DETACH, &bufs);
201 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
202 lustre_cfg_free(lcfg);
204 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
205 strerror(rc = errno));
210 int jt_obd_cleanup(int argc, char **argv)
212 struct lustre_cfg_bufs bufs;
213 struct lustre_cfg *lcfg;
216 char flags[3] = { 0 };
220 if (lcfg_devname == NULL) {
221 fprintf(stderr, "%s: please use 'device name' to set the "
222 "device name for config commands.\n",
223 jt_cmdname(argv[0]));
227 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
229 if (argc < 1 || argc > 3)
232 /* we are protected from overflowing our buffer by the argc
235 for (n = 1; n < argc; n++) {
236 if (strcmp(argv[n], "force") == 0) {
237 flags[flag_cnt++] = force;
238 } else if (strcmp(argv[n], "failover") == 0) {
239 flags[flag_cnt++] = failover;
241 fprintf(stderr, "unknown option: %s", argv[n]);
247 lustre_cfg_bufs_set_string(&bufs, 1, flags);
250 lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
251 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
252 lustre_cfg_free(lcfg);
254 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
255 strerror(rc = errno));
261 int do_add_uuid(char * func, char *uuid, lnet_nid_t nid)
264 struct lustre_cfg_bufs bufs;
265 struct lustre_cfg *lcfg;
267 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
269 lustre_cfg_bufs_set_string(&bufs, 1, uuid);
271 lcfg = lustre_cfg_new(LCFG_ADD_UUID, &bufs);
272 lcfg->lcfg_nid = nid;
273 /* Poison NAL -- pre 1.4.6 will LASSERT on 0 NAL, this way it
274 doesn't work without crashing (bz 10130) */
275 lcfg->lcfg_nal = 0x5a;
278 fprintf(stderr, "adding\tnid: %d\tuuid: %s\n",
279 lcfg->lcfg_nid, uuid);
281 rc = lcfg_ioctl(func, OBD_DEV_ID, lcfg);
282 lustre_cfg_free(lcfg);
284 fprintf(stderr, "IOC_PORTAL_ADD_UUID failed: %s\n",
289 printf ("Added uuid %s: %s\n", uuid, libcfs_nid2str(nid));
293 int jt_lcfg_add_uuid(int argc, char **argv)
301 nid = libcfs_str2nid(argv[2]);
302 if (nid == LNET_NID_ANY) {
303 fprintf (stderr, "Can't parse NID %s\n", argv[2]);
307 return do_add_uuid(argv[0], argv[1], nid);
310 int obd_add_uuid(char *uuid, lnet_nid_t nid)
312 return do_add_uuid("obd_add_uuid", uuid, nid);
315 int jt_lcfg_del_uuid(int argc, char **argv)
318 struct lustre_cfg_bufs bufs;
319 struct lustre_cfg *lcfg;
322 fprintf(stderr, "usage: %s <uuid>\n", argv[0]);
326 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
327 if (strcmp (argv[1], "_all_"))
328 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
330 lcfg = lustre_cfg_new(LCFG_DEL_UUID, &bufs);
331 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
332 lustre_cfg_free(lcfg);
334 fprintf(stderr, "IOC_PORTAL_DEL_UUID failed: %s\n",
341 int jt_lcfg_del_mount_option(int argc, char **argv)
344 struct lustre_cfg_bufs bufs;
345 struct lustre_cfg *lcfg;
350 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
353 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
355 lcfg = lustre_cfg_new(LCFG_DEL_MOUNTOPT, &bufs);
356 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
357 lustre_cfg_free(lcfg);
359 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
360 strerror(rc = errno));
365 int jt_lcfg_set_timeout(int argc, char **argv)
368 struct lustre_cfg_bufs bufs;
369 struct lustre_cfg *lcfg;
371 fprintf(stderr, "%s has been deprecated. Use conf_param instead.\n"
372 "e.g. conf_param lustre-MDT0000 obd_timeout=50\n",
373 jt_cmdname(argv[0]));
380 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
381 lcfg = lustre_cfg_new(LCFG_SET_TIMEOUT, &bufs);
382 lcfg->lcfg_num = atoi(argv[1]);
384 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
385 //rc = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
387 lustre_cfg_free(lcfg);
389 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
390 strerror(rc = errno));
395 int jt_lcfg_add_conn(int argc, char **argv)
397 struct lustre_cfg_bufs bufs;
398 struct lustre_cfg *lcfg;
409 if (lcfg_devname == NULL) {
410 fprintf(stderr, "%s: please use 'device name' to set the "
411 "device name for config commands.\n",
412 jt_cmdname(argv[0]));
416 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
418 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
420 lcfg = lustre_cfg_new(LCFG_ADD_CONN, &bufs);
421 lcfg->lcfg_num = priority;
423 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
424 lustre_cfg_free (lcfg);
426 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
427 strerror(rc = errno));
433 int jt_lcfg_del_conn(int argc, char **argv)
435 struct lustre_cfg_bufs bufs;
436 struct lustre_cfg *lcfg;
442 if (lcfg_devname == NULL) {
443 fprintf(stderr, "%s: please use 'device name' to set the "
444 "device name for config commands.\n",
445 jt_cmdname(argv[0]));
449 lustre_cfg_bufs_reset(&bufs, lcfg_devname);
451 /* connection uuid */
452 lustre_cfg_bufs_set_string(&bufs, 1, argv[1]);
454 lcfg = lustre_cfg_new(LCFG_DEL_MOUNTOPT, &bufs);
456 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
457 lustre_cfg_free(lcfg);
459 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
460 strerror(rc = errno));
466 /* Param set locally, directly on target */
467 int jt_lcfg_param(int argc, char **argv)
470 struct lustre_cfg_bufs bufs;
471 struct lustre_cfg *lcfg;
473 if (argc >= LUSTRE_CFG_MAX_BUFCOUNT)
476 lustre_cfg_bufs_reset(&bufs, NULL);
478 for (i = 1; i < argc; i++) {
479 lustre_cfg_bufs_set_string(&bufs, i, argv[i]);
482 lcfg = lustre_cfg_new(LCFG_PARAM, &bufs);
484 rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
485 lustre_cfg_free(lcfg);
487 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
488 strerror(rc = errno));
494 unsigned int po_only_path:1;
495 unsigned int po_show_path:1;
496 unsigned int po_show_type:1;
497 unsigned int po_recursive:1;
498 unsigned int po_params2:1;
499 unsigned int po_delete:1;
502 /* Param set to single log file, used by all clients and servers.
503 * This should be loaded after the individual config logs.
504 * Called from set param with -P option.
506 static int jt_lcfg_mgsparam2(int argc, char **argv, struct param_opts *popt)
510 struct lustre_cfg_bufs bufs;
511 struct lustre_cfg *lcfg;
515 first_param = optind;
516 if (first_param < 0 || first_param >= argc)
519 for (i = first_param, rc = 0; i < argc; i++) {
520 lustre_cfg_bufs_reset(&bufs, NULL);
521 /* This same command would be executed on all nodes, many
522 * of which should fail (silently) because they don't have
523 * that proc file existing locally. There would be no
524 * preprocessing on the MGS to try to figure out which
525 * parameter files to add this to, there would be nodes
526 * processing on the cluster nodes to try to figure out
527 * if they are the intended targets. They will blindly
528 * try to set the parameter, and ENOTFOUND means it wasn't
530 * Target name "general" means call on all targets. It is
531 * left here in case some filtering will be added in
534 lustre_cfg_bufs_set_string(&bufs, 0, "general");
536 len = strlen(argv[i]);
538 /* put an '=' on the end in case it doesn't have one */
539 if (popt->po_delete && argv[i][len - 1] != '=') {
540 buf = malloc(len + 1);
541 sprintf(buf, "%s=", argv[i]);
545 lustre_cfg_bufs_set_string(&bufs, 1, buf);
547 lcfg = lustre_cfg_new(LCFG_SET_PARAM, &bufs);
549 fprintf(stderr, "error: allocating lcfg for %s: %s\n",
550 jt_cmdname(argv[0]), strerror(PTR_ERR(lcfg)));
554 int rc2 = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
556 fprintf(stderr, "error: executing %s: %s\n",
557 jt_cmdname(argv[0]), strerror(rc2));
561 lustre_cfg_free(lcfg);
570 /* Param set in config log on MGS */
571 /* conf_param key=value */
572 /* Note we can actually send mgc conf_params from clients, but currently
573 * that's only done for default file striping (see ll_send_mgc_param),
575 /* After removal of a parameter (-d) Lustre will use the default
576 * AT NEXT REBOOT, not immediately. */
577 int jt_lcfg_mgsparam(int argc, char **argv)
581 struct lustre_cfg_bufs bufs;
582 struct lustre_cfg *lcfg;
585 /* mgs_setparam processes only lctl buf #1 */
586 if ((argc > 3) || (argc <= 1))
589 while ((rc = getopt(argc, argv, "d")) != -1) {
599 lustre_cfg_bufs_reset(&bufs, NULL);
603 /* for delete, make it "<param>=\0" */
604 buf = malloc(strlen(argv[optind]) + 2);
605 /* put an '=' on the end in case it doesn't have one */
606 sprintf(buf, "%s=", argv[optind]);
607 /* then truncate after the first '=' */
608 ptr = strchr(buf, '=');
610 lustre_cfg_bufs_set_string(&bufs, 1, buf);
612 lustre_cfg_bufs_set_string(&bufs, 1, argv[optind]);
615 /* We could put other opcodes here. */
616 lcfg = lustre_cfg_new(LCFG_PARAM, &bufs);
618 rc = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
619 lustre_cfg_free(lcfg);
623 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
624 strerror(rc = errno));
630 /* Display the path in the same format as sysctl
631 * For eg. obdfilter.lustre-OST0000.stats */
632 static char *display_name(char *filename, unsigned int po_show_type)
638 if (lstat(filename, &st) < 0)
642 filename += strlen("/proc/");
643 if (strncmp(filename, "fs/", strlen("fs/")) == 0)
644 filename += strlen("fs/");
646 filename += strlen("sys/");
648 if (strncmp(filename, "lustre/", strlen("lustre/")) == 0)
649 filename += strlen("lustre/");
650 else if (strncmp(filename, "lnet/", strlen("lnet/")) == 0)
651 filename += strlen("lnet/");
653 /* replace '/' with '.' to match conf_param and sysctl */
655 while ((tmp = strchr(tmp, '/')) != NULL)
658 /* append the indicator to entries */
660 if (S_ISDIR(st.st_mode))
661 strcat(filename, "/");
662 else if (S_ISLNK(st.st_mode))
663 strcat(filename, "@");
664 else if (st.st_mode & S_IWUSR)
665 strcat(filename, "=");
671 /* Find a character in a length limited string */
672 /* BEWARE - kernel definition of strnchr has args in different order! */
673 static char *strnchr(const char *p, char c, size_t n)
686 static char *globerrstr(int glob_rc)
690 return "Out of memory";
694 return "Found no match";
696 return "Unknown error";
699 static void clean_path(char *path)
703 /* If the input is in form Eg. obdfilter.*.stats */
704 if (strchr(path, '.')) {
706 while (*tmp != '\0') {
708 (tmp != path) && (*(tmp - 1) != '\\'))
713 /* get rid of '\', glob doesn't like it */
714 if ((tmp = strrchr(path, '\\')) != NULL) {
715 char *tail = path + strlen(path);
716 while (tmp != path) {
718 memmove(tmp, tmp + 1, tail - tmp);
726 /* Supporting file paths creates perilous behavoir: LU-888.
727 * Path support is deprecated.
728 * If a path is supplied it must begin with /proc. */
729 static void lprocfs_param_pattern(const char *cmd, const char *path, char *buf,
732 /* test path to see if it begins with '/proc/' */
733 if (strncmp(path, "/proc/", strlen("/proc/")) == 0) {
736 fprintf(stderr, "%s: specifying parameters via "
737 "full paths is deprecated.\n", cmd);
738 #if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 6, 50, 0)
739 #warning "remove deprecated full path tunable access"
743 snprintf(buf, buf_size, "%s", path);
745 snprintf(buf, buf_size, "/proc/{fs,sys}/{lnet,lustre}/%s",
750 static int listparam_cmdline(int argc, char **argv, struct param_opts *popt)
754 popt->po_show_path = 1;
755 popt->po_only_path = 1;
756 popt->po_show_type = 0;
757 popt->po_recursive = 0;
759 while ((ch = getopt(argc, argv, "FR")) != -1) {
762 popt->po_show_type = 1;
765 popt->po_recursive = 1;
775 static int listparam_display(struct param_opts *popt, char *pattern)
780 char filename[PATH_MAX + 1]; /* extra 1 byte for file type */
782 rc = glob(pattern, GLOB_BRACE | (popt->po_recursive ? GLOB_MARK : 0),
785 fprintf(stderr, "error: list_param: %s: %s\n",
786 pattern, globerrstr(rc));
790 for (i = 0; i < glob_info.gl_pathc; i++) {
791 char *valuename = NULL;
794 /* Trailing '/' will indicate recursion into directory */
795 last = strlen(glob_info.gl_pathv[i]) - 1;
797 /* Remove trailing '/' or it will be converted to '.' */
798 if (last > 0 && glob_info.gl_pathv[i][last] == '/')
799 glob_info.gl_pathv[i][last] = '\0';
802 strcpy(filename, glob_info.gl_pathv[i]);
803 valuename = display_name(filename, popt->po_show_type);
805 printf("%s\n", valuename);
807 strcpy(filename, glob_info.gl_pathv[i]);
808 strcat(filename, "/*");
809 listparam_display(popt, filename);
813 globfree(&glob_info);
817 int jt_lcfg_listparam(int argc, char **argv)
820 struct param_opts popt;
821 char pattern[PATH_MAX];
824 rc = listparam_cmdline(argc, argv, &popt);
825 if (rc == argc && popt.po_recursive) {
826 rc--; /* we know at least "-R" is a parameter */
828 } else if (rc < 0 || rc >= argc) {
832 for (i = rc; i < argc; i++) {
837 lprocfs_param_pattern(argv[0], path, pattern, sizeof(pattern));
839 rc = listparam_display(&popt, pattern);
847 static int getparam_cmdline(int argc, char **argv, struct param_opts *popt)
851 popt->po_show_path = 1;
852 popt->po_only_path = 0;
853 popt->po_show_type = 0;
854 popt->po_recursive = 0;
856 while ((ch = getopt(argc, argv, "nNF")) != -1) {
859 popt->po_only_path = 1;
862 popt->po_show_path = 0;
864 popt->po_show_type = 1;
874 static int getparam_display(struct param_opts *popt, char *pattern)
881 char filename[PATH_MAX + 1]; /* extra 1 byte for file type */
883 rc = glob(pattern, GLOB_BRACE, NULL, &glob_info);
885 fprintf(stderr, "error: get_param: %s: %s\n",
886 pattern, globerrstr(rc));
890 buf = malloc(PAGE_CACHE_SIZE);
891 for (i = 0; i < glob_info.gl_pathc; i++) {
892 char *valuename = NULL;
894 memset(buf, 0, PAGE_CACHE_SIZE);
895 /* As listparam_display is used to show param name (with type),
896 * here "if (only_path)" is ignored.*/
897 if (popt->po_show_path) {
898 strcpy(filename, glob_info.gl_pathv[i]);
899 valuename = display_name(filename, 0);
902 /* Write the contents of file to stdout */
903 fd = open(glob_info.gl_pathv[i], O_RDONLY);
906 "error: get_param: opening('%s') failed: %s\n",
907 glob_info.gl_pathv[i], strerror(errno));
912 rc = read(fd, buf, PAGE_CACHE_SIZE);
916 fprintf(stderr, "error: get_param: "
917 "read('%s') failed: %s\n",
918 glob_info.gl_pathv[i], strerror(errno));
921 /* Print the output in the format path=value if the
922 * value contains no new line character or cab be
923 * occupied in a line, else print value on new line */
924 if (valuename && popt->po_show_path) {
925 int longbuf = strnchr(buf, rc - 1, '\n') != NULL
927 printf("%s=%s", valuename, longbuf ? "\n" : buf);
933 rc = write(fileno(stdout), buf, rc);
935 fprintf(stderr, "error: get_param: "
936 "write to stdout failed: %s\n",
944 globfree(&glob_info);
949 int jt_lcfg_getparam(int argc, char **argv)
952 struct param_opts popt;
953 char pattern[PATH_MAX];
956 rc = getparam_cmdline(argc, argv, &popt);
957 if (rc < 0 || rc >= argc)
960 for (i = rc, rc = 0; i < argc; i++) {
967 lprocfs_param_pattern(argv[0], path, pattern, sizeof(pattern));
969 if (popt.po_only_path)
970 rc2 = listparam_display(&popt, pattern);
972 rc2 = getparam_display(&popt, pattern);
973 if (rc2 < 0 && rc == 0)
980 static int setparam_cmdline(int argc, char **argv, struct param_opts *popt)
984 popt->po_show_path = 1;
985 popt->po_only_path = 0;
986 popt->po_show_type = 0;
987 popt->po_recursive = 0;
988 popt->po_params2 = 0;
991 while ((ch = getopt(argc, argv, "nPd")) != -1) {
994 popt->po_show_path = 0;
997 popt->po_params2 = 1;
1000 popt->po_delete = 1;
1009 static int setparam_display(struct param_opts *popt, char *pattern, char *value)
1015 char filename[PATH_MAX + 1]; /* extra 1 byte for file type */
1017 rc = glob(pattern, GLOB_BRACE, NULL, &glob_info);
1019 fprintf(stderr, "error: set_param: %s: %s\n",
1020 pattern, globerrstr(rc));
1023 for (i = 0; i < glob_info.gl_pathc; i++) {
1024 char *valuename = NULL;
1026 if (popt->po_show_path) {
1027 strcpy(filename, glob_info.gl_pathv[i]);
1028 valuename = display_name(filename, 0);
1030 printf("%s=%s\n", valuename, value);
1032 /* Write the new value to the file */
1033 fd = open(glob_info.gl_pathv[i], O_WRONLY);
1035 rc = write(fd, value, strlen(value));
1037 fprintf(stderr, "error: set_param: setting "
1038 "%s=%s: %s\n", glob_info.gl_pathv[i],
1039 value, strerror(errno));
1044 fprintf(stderr, "error: set_param: %s opening %s\n",
1045 strerror(rc = errno), glob_info.gl_pathv[i]);
1049 globfree(&glob_info);
1053 int jt_lcfg_setparam(int argc, char **argv)
1056 struct param_opts popt;
1057 char pattern[PATH_MAX];
1058 char *path = NULL, *value = NULL;
1060 rc = setparam_cmdline(argc, argv, &popt);
1061 if (rc < 0 || rc >= argc)
1064 if (popt.po_params2)
1065 /* We can't delete parameters that were
1066 * set with old conf_param interface */
1067 return jt_lcfg_mgsparam2(argc, argv, &popt);
1069 for (i = rc, rc = 0; i < argc; i++) {
1072 if ((value = strchr(argv[i], '=')) != NULL) {
1073 /* format: set_param a=b */
1078 /* format: set_param a b */
1089 lprocfs_param_pattern(argv[0], path, pattern, sizeof(pattern));
1091 rc2 = setparam_display(&popt, pattern, value);
1094 if (rc2 < 0 && rc == 0)