Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146048
b: refs/heads/master
c: f66578a
h: refs/heads/master
v: v3
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Apr 21, 2009
1 parent f3b31ea commit 6290245
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e8082f3f5a17d7a7bfc7dd1050a3f958dc034e9a
refs/heads/master: f66578a7637b87810cbb9041c4e3a77fd2fa4706
26 changes: 12 additions & 14 deletions trunk/kernel/trace/trace_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ static int __filter_add_pred(struct ftrace_event_call *call,
{
struct ftrace_event_field *field;
filter_pred_fn_t fn;
unsigned long long val;

field = find_event_field(call, pred->field_name);
if (!field)
Expand All @@ -322,14 +323,13 @@ static int __filter_add_pred(struct ftrace_event_call *call,
pred->offset = field->offset;

if (is_string_field(field->type)) {
if (!pred->str_len)
return -EINVAL;
fn = filter_pred_string;
pred->str_len = field->size;
return filter_add_pred_fn(call, pred, fn);
} else {
if (pred->str_len)
if (strict_strtoull(pred->str_val, 0, &val))
return -EINVAL;
pred->val = val;
}

switch (field->size) {
Expand Down Expand Up @@ -413,12 +413,16 @@ int filter_add_subsystem_pred(struct event_subsystem *system,
return 0;
}

/*
* The filter format can be
* - 0, which means remove all filter preds
* - [||/&&] <field> ==/!= <val>
*/
int filter_parse(char **pbuf, struct filter_pred *pred)
{
char *tmp, *tok, *val_str = NULL;
char *tok, *val_str = NULL;
int tok_n = 0;

/* field ==/!= number, or/and field ==/!= number, number */
while ((tok = strsep(pbuf, " \n"))) {
if (tok_n == 0) {
if (!strcmp(tok, "0")) {
Expand Down Expand Up @@ -478,19 +482,13 @@ int filter_parse(char **pbuf, struct filter_pred *pred)
return -EINVAL;
}

strcpy(pred->str_val, val_str);
pred->str_len = strlen(val_str);

pred->field_name = kstrdup(pred->field_name, GFP_KERNEL);
if (!pred->field_name)
return -ENOMEM;

pred->str_len = 0;
pred->val = simple_strtoull(val_str, &tmp, 0);
if (tmp == val_str) {
strncpy(pred->str_val, val_str, MAX_FILTER_STR_VAL);
pred->str_len = strlen(val_str);
pred->str_val[pred->str_len] = '\0';
} else if (*tmp != '\0')
return -EINVAL;

return 0;
}

Expand Down

0 comments on commit 6290245

Please sign in to comment.