+struct param_opts {
+ unsigned int po_only_path:1;
+ unsigned int po_show_path:1;
+ unsigned int po_show_type:1;
+ unsigned int po_recursive:1;
+ unsigned int po_params2:1;
+ unsigned int po_delete:1;
+};
+
+/* Param set to single log file, used by all clients and servers.
+ * This should be loaded after the individual config logs.
+ * Called from set param with -P option.
+ */
+static int jt_lcfg_mgsparam2(int argc, char **argv, struct param_opts *popt)
+{
+ int rc, i;
+ int first_param;
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
+ char *buf = NULL;
+ int len;
+
+ first_param = optind;
+ if (first_param < 0 || first_param >= argc)
+ return CMD_HELP;
+
+ for (i = first_param, rc = 0; i < argc; i++) {
+ lustre_cfg_bufs_reset(&bufs, NULL);
+ /* This same command would be executed on all nodes, many
+ * of which should fail (silently) because they don't have
+ * that proc file existing locally. There would be no
+ * preprocessing on the MGS to try to figure out which
+ * parameter files to add this to, there would be nodes
+ * processing on the cluster nodes to try to figure out
+ * if they are the intended targets. They will blindly
+ * try to set the parameter, and ENOTFOUND means it wasn't
+ * for them.
+ * Target name "general" means call on all targets. It is
+ * left here in case some filtering will be added in
+ * future.
+ */
+ lustre_cfg_bufs_set_string(&bufs, 0, "general");
+
+ len = strlen(argv[i]);
+
+ /* put an '=' on the end in case it doesn't have one */
+ if (popt->po_delete && argv[i][len - 1] != '=') {
+ buf = malloc(len + 1);
+ sprintf(buf, "%s=", argv[i]);
+ } else {
+ buf = argv[i];
+ }
+ lustre_cfg_bufs_set_string(&bufs, 1, buf);
+
+ lcfg = lustre_cfg_new(LCFG_SET_PARAM, &bufs);
+ if (IS_ERR(lcfg)) {
+ fprintf(stderr, "error: allocating lcfg for %s: %s\n",
+ jt_cmdname(argv[0]), strerror(PTR_ERR(lcfg)));
+ if (rc == 0)
+ rc = PTR_ERR(lcfg);
+ } else {
+ 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));
+ if (rc == 0)
+ rc = rc2;
+ }
+ lustre_cfg_free(lcfg);
+ }
+ if (buf != argv[i])
+ free(buf);
+ }
+
+ return rc;
+}
+