Lines Matching refs:pred

153 	struct filter_pred	*pred;  member
192 struct filter_pred **pred);
200 static void free_predicate(struct filter_pred *pred) in free_predicate() argument
202 if (pred) { in free_predicate()
203 kfree(pred->regex); in free_predicate()
204 kfree(pred->mask); in free_predicate()
205 kfree(pred); in free_predicate()
536 len = parse_pred(next, data, ptr - str, pe, &prog[N].pred); in predicate_parse()
613 prog[N].pred = NULL; /* #13 */ in predicate_parse()
615 prog[N+1].pred = NULL; in predicate_parse()
645 for (i = 0; prog_stack[i].pred; i++) in predicate_parse()
646 free_predicate(prog_stack[i].pred); in predicate_parse()
714 static int filter_pred_##type(struct filter_pred *pred, void *event) \
716 switch (pred->op) { \
718 type *addr = (type *)(event + pred->offset); \
719 type val = (type)pred->val; \
723 type *addr = (type *)(event + pred->offset); \
724 type val = (type)pred->val; \
728 type *addr = (type *)(event + pred->offset); \
729 type val = (type)pred->val; \
733 type *addr = (type *)(event + pred->offset); \
734 type val = (type)pred->val; \
738 type *addr = (type *)(event + pred->offset); \
739 type val = (type)pred->val; \
748 static int filter_pred_##size##_cpumask(struct filter_pred *pred, void *event) \
750 u##size *addr = (u##size *)(event + pred->offset); \
756 return do_filter_scalar_cpumask(pred->op, cpu, pred->mask); \
760 static int filter_pred_##size(struct filter_pred *pred, void *event) \
762 u##size *addr = (u##size *)(event + pred->offset); \
763 u##size val = (u##size)pred->val; \
766 match = (val == *addr) ^ pred->not; \
837 static int filter_pred_string(struct filter_pred *pred, void *event) in filter_pred_string() argument
839 char *addr = (char *)(event + pred->offset); in filter_pred_string()
842 cmp = pred->regex->match(addr, pred->regex, pred->regex->field_len); in filter_pred_string()
844 match = cmp ^ pred->not; in filter_pred_string()
849 static __always_inline int filter_pchar(struct filter_pred *pred, char *str) in filter_pchar() argument
855 cmp = pred->regex->match(str, pred->regex, len); in filter_pchar()
857 match = cmp ^ pred->not; in filter_pchar()
862 static int filter_pred_pchar(struct filter_pred *pred, void *event) in filter_pred_pchar() argument
864 char **addr = (char **)(event + pred->offset); in filter_pred_pchar()
871 return filter_pchar(pred, str); in filter_pred_pchar()
875 static int filter_pred_pchar_user(struct filter_pred *pred, void *event) in filter_pred_pchar_user() argument
877 char **addr = (char **)(event + pred->offset); in filter_pred_pchar_user()
884 return filter_pchar(pred, str); in filter_pred_pchar_user()
897 static int filter_pred_strloc(struct filter_pred *pred, void *event) in filter_pred_strloc() argument
899 u32 str_item = *(u32 *)(event + pred->offset); in filter_pred_strloc()
905 cmp = pred->regex->match(addr, pred->regex, str_len); in filter_pred_strloc()
907 match = cmp ^ pred->not; in filter_pred_strloc()
919 static int filter_pred_strrelloc(struct filter_pred *pred, void *event) in filter_pred_strrelloc() argument
921 u32 *item = (u32 *)(event + pred->offset); in filter_pred_strrelloc()
928 cmp = pred->regex->match(addr, pred->regex, str_len); in filter_pred_strrelloc()
930 match = cmp ^ pred->not; in filter_pred_strrelloc()
936 static int filter_pred_cpu(struct filter_pred *pred, void *event) in filter_pred_cpu() argument
941 cmp = pred->val; in filter_pred_cpu()
943 switch (pred->op) { in filter_pred_cpu()
962 static int filter_pred_cpu_cpumask(struct filter_pred *pred, void *event) in filter_pred_cpu_cpumask() argument
966 return do_filter_scalar_cpumask(pred->op, cpu, pred->mask); in filter_pred_cpu_cpumask()
970 static int filter_pred_cpumask(struct filter_pred *pred, void *event) in filter_pred_cpumask() argument
972 u32 item = *(u32 *)(event + pred->offset); in filter_pred_cpumask()
975 const struct cpumask *cmp = pred->mask; in filter_pred_cpumask()
977 return do_filter_cpumask(pred->op, mask, cmp); in filter_pred_cpumask()
981 static int filter_pred_cpumask_cpu(struct filter_pred *pred, void *event) in filter_pred_cpumask_cpu() argument
983 u32 item = *(u32 *)(event + pred->offset); in filter_pred_cpumask_cpu()
986 unsigned int cpu = pred->val; in filter_pred_cpumask_cpu()
988 return do_filter_cpumask_scalar(pred->op, mask, cpu); in filter_pred_cpumask_cpu()
992 static int filter_pred_comm(struct filter_pred *pred, void *event) in filter_pred_comm() argument
996 cmp = pred->regex->match(current->comm, pred->regex, in filter_pred_comm()
998 return cmp ^ pred->not; in filter_pred_comm()
1002 static int filter_pred_function(struct filter_pred *pred, void *event) in filter_pred_function() argument
1004 unsigned long *addr = (unsigned long *)(event + pred->offset); in filter_pred_function()
1005 unsigned long start = (unsigned long)pred->val; in filter_pred_function()
1006 unsigned long end = (unsigned long)pred->val2; in filter_pred_function()
1009 return pred->op == OP_EQ ? ret : !ret; in filter_pred_function()
1124 static void filter_build_regex(struct filter_pred *pred) in filter_build_regex() argument
1126 struct regex *r = pred->regex; in filter_build_regex()
1130 if (pred->op == OP_GLOB) { in filter_build_regex()
1131 type = filter_parse_regex(r->pattern, r->len, &search, &pred->not); in filter_build_regex()
1159 static int test_pred_visited_fn(struct filter_pred *pred, void *event);
1161 static int test_pred_visited_fn(struct filter_pred *pred, void *event) in test_pred_visited_fn() argument
1168 static int filter_pred_fn_call(struct filter_pred *pred, void *event);
1185 for (i = 0; prog[i].pred; i++) { in filter_match_preds()
1186 struct filter_pred *pred = prog[i].pred; in filter_match_preds() local
1187 int match = filter_pred_fn_call(pred, rec); in filter_match_preds()
1290 for (i = 0; prog[i].pred; i++) in free_prog()
1291 free_predicate(prog[i].pred); in free_prog()
1434 static int filter_pred_fn_call(struct filter_pred *pred, void *event) in filter_pred_fn_call() argument
1436 switch (pred->fn_num) { in filter_pred_fn_call()
1438 return filter_pred_64(pred, event); in filter_pred_fn_call()
1440 return filter_pred_64_cpumask(pred, event); in filter_pred_fn_call()
1442 return filter_pred_s64(pred, event); in filter_pred_fn_call()
1444 return filter_pred_u64(pred, event); in filter_pred_fn_call()
1446 return filter_pred_32(pred, event); in filter_pred_fn_call()
1448 return filter_pred_32_cpumask(pred, event); in filter_pred_fn_call()
1450 return filter_pred_s32(pred, event); in filter_pred_fn_call()
1452 return filter_pred_u32(pred, event); in filter_pred_fn_call()
1454 return filter_pred_16(pred, event); in filter_pred_fn_call()
1456 return filter_pred_16_cpumask(pred, event); in filter_pred_fn_call()
1458 return filter_pred_s16(pred, event); in filter_pred_fn_call()
1460 return filter_pred_u16(pred, event); in filter_pred_fn_call()
1462 return filter_pred_8(pred, event); in filter_pred_fn_call()
1464 return filter_pred_8_cpumask(pred, event); in filter_pred_fn_call()
1466 return filter_pred_s8(pred, event); in filter_pred_fn_call()
1468 return filter_pred_u8(pred, event); in filter_pred_fn_call()
1470 return filter_pred_comm(pred, event); in filter_pred_fn_call()
1472 return filter_pred_string(pred, event); in filter_pred_fn_call()
1474 return filter_pred_strloc(pred, event); in filter_pred_fn_call()
1476 return filter_pred_strrelloc(pred, event); in filter_pred_fn_call()
1478 return filter_pred_pchar_user(pred, event); in filter_pred_fn_call()
1480 return filter_pred_pchar(pred, event); in filter_pred_fn_call()
1482 return filter_pred_cpu(pred, event); in filter_pred_fn_call()
1484 return filter_pred_cpu_cpumask(pred, event); in filter_pred_fn_call()
1486 return filter_pred_cpumask(pred, event); in filter_pred_fn_call()
1488 return filter_pred_cpumask_cpu(pred, event); in filter_pred_fn_call()
1490 return filter_pred_function(pred, event); in filter_pred_fn_call()
1492 return test_pred_visited_fn(pred, event); in filter_pred_fn_call()
1505 struct filter_pred *pred = NULL; in parse_pred() local
1582 pred = kzalloc(sizeof(*pred), GFP_KERNEL); in parse_pred()
1583 if (!pred) in parse_pred()
1586 pred->field = field; in parse_pred()
1587 pred->offset = field->offset; in parse_pred()
1588 pred->op = op; in parse_pred()
1650 pred->fn_num = FILTER_PRED_FN_FUNCTION; in parse_pred()
1651 pred->val = ip - offset; in parse_pred()
1652 pred->val2 = pred->val + size; in parse_pred()
1666 pred->fn_num = FILTER_PRED_FN_NOP; in parse_pred()
1693 pred->regex = kzalloc(sizeof(*pred->regex), GFP_KERNEL); in parse_pred()
1694 if (!pred->regex) in parse_pred()
1696 pred->regex->len = len; in parse_pred()
1697 strncpy(pred->regex->pattern, str + s, len); in parse_pred()
1698 pred->regex->pattern[len] = 0; in parse_pred()
1753 pred->mask = kzalloc(cpumask_size(), GFP_KERNEL); in parse_pred()
1754 if (!pred->mask) { in parse_pred()
1760 if (cpulist_parse(tmp, pred->mask)) { in parse_pred()
1774 single = cpumask_weight(pred->mask) == 1; in parse_pred()
1776 pred->val = cpumask_first(pred->mask); in parse_pred()
1777 kfree(pred->mask); in parse_pred()
1778 pred->mask = NULL; in parse_pred()
1782 pred->fn_num = single ? in parse_pred()
1787 if (pred->op == OP_BAND) in parse_pred()
1788 pred->op = OP_EQ; in parse_pred()
1790 pred->fn_num = FILTER_PRED_FN_CPU; in parse_pred()
1792 pred->fn_num = FILTER_PRED_FN_CPU_CPUMASK; in parse_pred()
1795 if (pred->op == OP_BAND) in parse_pred()
1796 pred->op = OP_EQ; in parse_pred()
1798 pred->fn_num = select_comparison_fn(pred->op, field->size, false); in parse_pred()
1799 if (pred->op == OP_NE) in parse_pred()
1800 pred->not = 1; in parse_pred()
1804 pred->fn_num = FILTER_PRED_FN_64_CPUMASK; in parse_pred()
1807 pred->fn_num = FILTER_PRED_FN_32_CPUMASK; in parse_pred()
1810 pred->fn_num = FILTER_PRED_FN_16_CPUMASK; in parse_pred()
1813 pred->fn_num = FILTER_PRED_FN_8_CPUMASK; in parse_pred()
1825 pred->not = 1; in parse_pred()
1858 pred->regex = kzalloc(sizeof(*pred->regex), GFP_KERNEL); in parse_pred()
1859 if (!pred->regex) in parse_pred()
1861 pred->regex->len = len; in parse_pred()
1862 strncpy(pred->regex->pattern, str + s, len); in parse_pred()
1863 pred->regex->pattern[len] = 0; in parse_pred()
1865 filter_build_regex(pred); in parse_pred()
1868 pred->fn_num = FILTER_PRED_FN_COMM; in parse_pred()
1871 pred->fn_num = FILTER_PRED_FN_STRING; in parse_pred()
1872 pred->regex->field_len = field->size; in parse_pred()
1875 pred->fn_num = FILTER_PRED_FN_STRLOC; in parse_pred()
1877 pred->fn_num = FILTER_PRED_FN_STRRELLOC; in parse_pred()
1888 pred->fn_num = FILTER_PRED_FN_PCHAR_USER; in parse_pred()
1890 pred->fn_num = FILTER_PRED_FN_PCHAR; in parse_pred()
1935 pred->val = val; in parse_pred()
1938 pred->fn_num = FILTER_PRED_FN_CPU; in parse_pred()
1940 pred->fn_num = select_comparison_fn(pred->op, field->size, in parse_pred()
1942 if (pred->op == OP_NE) in parse_pred()
1943 pred->not = 1; in parse_pred()
1951 *pred_ptr = pred; in parse_pred()
1955 free_predicate(pred); in parse_pred()
1958 free_predicate(pred); in parse_pred()
2525 static int ftrace_function_check_pred(struct filter_pred *pred) in ftrace_function_check_pred() argument
2527 struct ftrace_event_field *field = pred->field; in ftrace_function_check_pred()
2534 if ((pred->op != OP_EQ) && (pred->op != OP_NE)) in ftrace_function_check_pred()
2543 static int ftrace_function_set_filter_pred(struct filter_pred *pred, in ftrace_function_set_filter_pred() argument
2549 ret = ftrace_function_check_pred(pred); in ftrace_function_set_filter_pred()
2553 return __ftrace_function_set_filter(pred->op == OP_EQ, in ftrace_function_set_filter_pred()
2554 pred->regex->pattern, in ftrace_function_set_filter_pred()
2555 pred->regex->len, in ftrace_function_set_filter_pred()
2570 if (prog[target].pred) in is_or()
2589 for (i = 0; prog[i].pred; i++) { in ftrace_function_set_filter()
2590 struct filter_pred *pred = prog[i].pred; in ftrace_function_set_filter() local
2595 if (ftrace_function_set_filter_pred(pred, &data) < 0) in ftrace_function_set_filter()
2732 static int test_pred_visited_fn(struct filter_pred *pred, void *event) in test_pred_visited_fn() argument
2734 struct ftrace_event_field *field = pred->field; in test_pred_visited_fn()
2747 for (i = 0; prog[i].pred; i++) { in update_pred_fn()
2748 struct filter_pred *pred = prog[i].pred; in update_pred_fn() local
2749 struct ftrace_event_field *field = pred->field; in update_pred_fn()
2751 WARN_ON_ONCE(pred->fn_num == FILTER_PRED_FN_NOP); in update_pred_fn()
2761 pred->fn_num = FILTER_PRED_TEST_VISITED; in update_pred_fn()