RETURN(rc);
}
+
+#define LPROCFS_NRS_WR_MAX_ARG (1024)
/**
* The longest valid command string is the maxium policy name size, plus the
- * length of the " reg" substring
+ * length of the " reg" substring, plus the lenght of argument
*/
-#define LPROCFS_NRS_WR_MAX_CMD (NRS_POL_NAME_MAX + sizeof(" reg") - 1)
+#define LPROCFS_NRS_WR_MAX_CMD (NRS_POL_NAME_MAX + sizeof(" reg") - 1 \
+ + LPROCFS_NRS_WR_MAX_ARG)
/**
* Starts and stops a given policy on a PTLRPC service.
enum ptlrpc_nrs_queue_type queue = PTLRPC_NRS_QUEUE_BOTH;
char *cmd;
char *cmd_copy = NULL;
- char *token;
+ char *policy_name;
+ char *queue_name;
int rc = 0;
ENTRY;
cmd[count] = '\0';
- token = strsep(&cmd, " ");
+ policy_name = strsep(&cmd, " ");
- if (strlen(token) > NRS_POL_NAME_MAX - 1)
+ if (strlen(policy_name) > NRS_POL_NAME_MAX - 1)
GOTO(out, rc = -EINVAL);
/**
if (cmd == NULL)
goto default_queue;
+ queue_name = strsep(&cmd, " ");
/**
- * The second token is either NULL, or an optional [reg|hp] string
+ * The second token is either an optional [reg|hp] string,
+ * or arguments
*/
- if (strcmp(cmd, "reg") == 0)
+ if (strcmp(queue_name, "reg") == 0)
queue = PTLRPC_NRS_QUEUE_REG;
- else if (strcmp(cmd, "hp") == 0)
+ else if (strcmp(queue_name, "hp") == 0)
queue = PTLRPC_NRS_QUEUE_HP;
- else
- GOTO(out, rc = -EINVAL);
+ else {
+ if (cmd != NULL)
+ *(cmd - 1) = ' ';
+ cmd = queue_name;
+ }
default_queue:
*/
mutex_lock(&nrs_core.nrs_mutex);
- rc = ptlrpc_nrs_policy_control(svc, queue, token, PTLRPC_NRS_CTL_START,
- false, NULL);
+ rc = ptlrpc_nrs_policy_control(svc, queue, policy_name,
+ PTLRPC_NRS_CTL_START,
+ false, cmd);
mutex_unlock(&nrs_core.nrs_mutex);
out: