+int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
+ struct lustre_cfg *lcfg, void *data)
+{
+#ifdef __KERNEL__
+ struct lprocfs_vars *var;
+ char *key, *sval;
+ int i, vallen;
+ int matched = 0, j = 0;
+ int rc = 0;
+ ENTRY;
+
+ if (lcfg->lcfg_command != LCFG_PARAM) {
+ CERROR("Unknown command: %d\n", lcfg->lcfg_command);
+ RETURN(-EINVAL);
+ }
+
+ /* e.g. tunefs.lustre --param mdt.group_upcall=foo /r/tmp/lustre-mdt
+ or lctl conf_param lustre-MDT0000.mdt.group_upcall=bar
+ or lctl conf_param lustre-OST0000.osc.max_dirty_mb=36 */
+ for (i = 1; i < lcfg->lcfg_bufcount; i++) {
+ key = lustre_cfg_buf(lcfg, i);
+ /* Strip off prefix */
+ class_match_param(key, prefix, &key);
+ sval = strchr(key, '=');
+ if (!sval || (*(sval + 1) == 0)) {
+ CERROR("Can't parse param %s\n", key);
+ rc = -EINVAL;
+ /* continue parsing other params */
+ continue;
+ }
+ sval++;
+ vallen = strlen(sval);
+ matched = 0;
+ j = 0;
+ /* Search proc entries */
+ while (lvars[j].name) {
+ var = &lvars[j];
+ if (class_match_param(key, (char *)var->name, 0) == 0) {
+ matched++;
+ rc = -EROFS;
+ if (var->write_fptr) {
+ mm_segment_t oldfs;
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ rc = (var->write_fptr)(NULL, sval,
+ vallen, data);
+ set_fs(oldfs);
+ }
+ if (rc < 0)
+ CERROR("writing proc entry %s err %d\n",
+ var->name, rc);
+ break;
+ }
+ j++;
+ }
+ if (!matched) {
+ CERROR("%s: unknown param %s\n",
+ lustre_cfg_buf(lcfg, 0), key);
+ rc = -EINVAL;
+ /* continue parsing other params */
+ } else {
+ LCONSOLE_INFO("%s.%.*s: set parameter %.*s=%s\n",
+ lustre_cfg_buf(lcfg, 0),
+ strlen(prefix) - 1, prefix,
+ sval - key - 1, key, sval);
+ }
+ }
+
+ if (rc > 0)
+ rc = 0;
+ RETURN(rc);
+#else
+ CDEBUG(D_CONFIG, "liblustre can't process params.\n");
+ /* Don't throw config error */
+ RETURN(0);
+#endif
+}
+
+int class_config_dump_handler(struct llog_handle * handle,
+ struct llog_rec_hdr *rec, void *data);
+
+#ifdef __KERNEL__
+extern int lustre_check_exclusion(struct super_block *sb, char *svname);
+#else
+#define lustre_check_exclusion(a,b) 0
+#endif
+
+static int class_config_llog_handler(struct llog_handle * handle,
+ struct llog_rec_hdr *rec, void *data)