+ char fsname[MTI_NAME_MAXLEN];
+ struct sptlrpc_rule rule;
+ char *target, *param;
+ int rc;
+
+ print_lustre_cfg(lcfg);
+
+ target = lustre_cfg_string(lcfg, 1);
+ if (!target) {
+ CERROR("missing target name\n");
+ return -EINVAL;
+ }
+
+ param = lustre_cfg_string(lcfg, 2);
+ if (!param) {
+ CERROR("missing parameter\n");
+ return -EINVAL;
+ }
+
+ /* parse rule to make sure the format is correct */
+ if (strncmp(param, PARAM_SRPC_FLVR,
+ sizeof(PARAM_SRPC_FLVR) - 1) != 0) {
+ CERROR("Invalid sptlrpc parameter: %s\n", param);
+ return -EINVAL;
+ }
+ param += sizeof(PARAM_SRPC_FLVR) - 1;
+
+ CDEBUG(D_SEC, "processing rule: %s.%s\n", target, param);
+
+ /*
+ * Three types of targets exist for sptlrpc using conf_param
+ * 1. '_mgs' which targets mgc srpc settings. Treat it as
+ * as a special file system name.
+ * 2. target is a device which can be fsname-MDTXXXX or
+ * fsname-OSTXXXX. This can be verified by the function
+ * server_name2fsname.
+ * 3. If both above conditions are not meet then the target
+ * is a actual filesystem.
+ */
+ if (server_name2fsname(target, fsname, NULL))
+ strlcpy(fsname, target, sizeof(target));
+
+ rc = sptlrpc_parse_rule(param, &rule);
+ if (rc)
+ return rc;
+
+ return __sptlrpc_process_config(target, fsname, &rule, NULL);