|
@@ -5162,7 +5162,7 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
|
|
|
struct synth_event *se;
|
|
|
const char *se_name;
|
|
|
bool remove = false;
|
|
|
- char *trigger;
|
|
|
+ char *trigger, *p;
|
|
|
int ret = 0;
|
|
|
|
|
|
if (!param)
|
|
@@ -5171,10 +5171,37 @@ static int event_hist_trigger_func(struct event_command *cmd_ops,
|
|
|
if (glob[0] == '!')
|
|
|
remove = true;
|
|
|
|
|
|
- /* separate the trigger from the filter (k:v [if filter]) */
|
|
|
- trigger = strsep(¶m, " \t");
|
|
|
- if (!trigger)
|
|
|
- return -EINVAL;
|
|
|
+ /*
|
|
|
+ * separate the trigger from the filter (k:v [if filter])
|
|
|
+ * allowing for whitespace in the trigger
|
|
|
+ */
|
|
|
+ p = trigger = param;
|
|
|
+ do {
|
|
|
+ p = strstr(p, "if");
|
|
|
+ if (!p)
|
|
|
+ break;
|
|
|
+ if (p == param)
|
|
|
+ return -EINVAL;
|
|
|
+ if (*(p - 1) != ' ' && *(p - 1) != '\t') {
|
|
|
+ p++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (p >= param + strlen(param) - strlen("if") - 1)
|
|
|
+ return -EINVAL;
|
|
|
+ if (*(p + strlen("if")) != ' ' && *(p + strlen("if")) != '\t') {
|
|
|
+ p++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ } while (p);
|
|
|
+
|
|
|
+ if (!p)
|
|
|
+ param = NULL;
|
|
|
+ else {
|
|
|
+ *(p - 1) = '\0';
|
|
|
+ param = strstrip(p);
|
|
|
+ trigger = strstrip(trigger);
|
|
|
+ }
|
|
|
|
|
|
attrs = parse_hist_trigger_attrs(trigger);
|
|
|
if (IS_ERR(attrs))
|