hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/lib/traceevent/parse-filter.c
....@@ -11,22 +11,23 @@
1111 #include <sys/types.h>
1212
1313 #include "event-parse.h"
14
+#include "event-parse-local.h"
1415 #include "event-utils.h"
1516
1617 #define COMM "COMM"
1718 #define CPU "CPU"
1819
19
-static struct format_field comm = {
20
+static struct tep_format_field comm = {
2021 .name = "COMM",
2122 };
2223
23
-static struct format_field cpu = {
24
+static struct tep_format_field cpu = {
2425 .name = "CPU",
2526 };
2627
2728 struct event_list {
2829 struct event_list *next;
29
- struct event_format *event;
30
+ struct tep_event *event;
3031 };
3132
3233 static void show_error(char *error_buf, const char *fmt, ...)
....@@ -37,8 +38,8 @@
3738 int len;
3839 int i;
3940
40
- input = tep_get_input_buf();
41
- index = tep_get_input_buf_ptr();
41
+ input = get_input_buf();
42
+ index = get_input_buf_ptr();
4243 len = input ? strlen(input) : 0;
4344
4445 if (len) {
....@@ -56,35 +57,30 @@
5657 va_end(ap);
5758 }
5859
59
-static void free_token(char *token)
60
+static enum tep_event_type filter_read_token(char **tok)
6061 {
61
- tep_free_token(token);
62
-}
63
-
64
-static enum event_type read_token(char **tok)
65
-{
66
- enum event_type type;
62
+ enum tep_event_type type;
6763 char *token = NULL;
6864
6965 do {
7066 free_token(token);
71
- type = tep_read_token(&token);
72
- } while (type == EVENT_NEWLINE || type == EVENT_SPACE);
67
+ type = read_token(&token);
68
+ } while (type == TEP_EVENT_NEWLINE || type == TEP_EVENT_SPACE);
7369
7470 /* If token is = or ! check to see if the next char is ~ */
7571 if (token &&
7672 (strcmp(token, "=") == 0 || strcmp(token, "!") == 0) &&
77
- tep_peek_char() == '~') {
73
+ peek_char() == '~') {
7874 /* append it */
7975 *tok = malloc(3);
8076 if (*tok == NULL) {
8177 free_token(token);
82
- return EVENT_ERROR;
78
+ return TEP_EVENT_ERROR;
8379 }
8480 sprintf(*tok, "%c%c", *token, '~');
8581 free_token(token);
8682 /* Now remove the '~' from the buffer */
87
- tep_read_token(&token);
83
+ read_token(&token);
8884 free_token(token);
8985 } else
9086 *tok = token;
....@@ -94,8 +90,8 @@
9490
9591 static int filter_cmp(const void *a, const void *b)
9692 {
97
- const struct filter_type *ea = a;
98
- const struct filter_type *eb = b;
93
+ const struct tep_filter_type *ea = a;
94
+ const struct tep_filter_type *eb = b;
9995
10096 if (ea->event_id < eb->event_id)
10197 return -1;
....@@ -106,11 +102,11 @@
106102 return 0;
107103 }
108104
109
-static struct filter_type *
110
-find_filter_type(struct event_filter *filter, int id)
105
+static struct tep_filter_type *
106
+find_filter_type(struct tep_event_filter *filter, int id)
111107 {
112
- struct filter_type *filter_type;
113
- struct filter_type key;
108
+ struct tep_filter_type *filter_type;
109
+ struct tep_filter_type key;
114110
115111 key.event_id = id;
116112
....@@ -122,10 +118,10 @@
122118 return filter_type;
123119 }
124120
125
-static struct filter_type *
126
-add_filter_type(struct event_filter *filter, int id)
121
+static struct tep_filter_type *
122
+add_filter_type(struct tep_event_filter *filter, int id)
127123 {
128
- struct filter_type *filter_type;
124
+ struct tep_filter_type *filter_type;
129125 int i;
130126
131127 filter_type = find_filter_type(filter, id);
....@@ -153,7 +149,7 @@
153149
154150 filter_type = &filter->event_filters[i];
155151 filter_type->event_id = id;
156
- filter_type->event = tep_find_event(filter->pevent, id);
152
+ filter_type->event = tep_find_event(filter->tep, id);
157153 filter_type->filter = NULL;
158154
159155 filter->filters++;
....@@ -163,61 +159,61 @@
163159
164160 /**
165161 * tep_filter_alloc - create a new event filter
166
- * @pevent: The pevent that this filter is associated with
162
+ * @tep: The tep that this filter is associated with
167163 */
168
-struct event_filter *tep_filter_alloc(struct tep_handle *pevent)
164
+struct tep_event_filter *tep_filter_alloc(struct tep_handle *tep)
169165 {
170
- struct event_filter *filter;
166
+ struct tep_event_filter *filter;
171167
172168 filter = malloc(sizeof(*filter));
173169 if (filter == NULL)
174170 return NULL;
175171
176172 memset(filter, 0, sizeof(*filter));
177
- filter->pevent = pevent;
178
- tep_ref(pevent);
173
+ filter->tep = tep;
174
+ tep_ref(tep);
179175
180176 return filter;
181177 }
182178
183
-static struct filter_arg *allocate_arg(void)
179
+static struct tep_filter_arg *allocate_arg(void)
184180 {
185
- return calloc(1, sizeof(struct filter_arg));
181
+ return calloc(1, sizeof(struct tep_filter_arg));
186182 }
187183
188
-static void free_arg(struct filter_arg *arg)
184
+static void free_arg(struct tep_filter_arg *arg)
189185 {
190186 if (!arg)
191187 return;
192188
193189 switch (arg->type) {
194
- case FILTER_ARG_NONE:
195
- case FILTER_ARG_BOOLEAN:
190
+ case TEP_FILTER_ARG_NONE:
191
+ case TEP_FILTER_ARG_BOOLEAN:
196192 break;
197193
198
- case FILTER_ARG_NUM:
194
+ case TEP_FILTER_ARG_NUM:
199195 free_arg(arg->num.left);
200196 free_arg(arg->num.right);
201197 break;
202198
203
- case FILTER_ARG_EXP:
199
+ case TEP_FILTER_ARG_EXP:
204200 free_arg(arg->exp.left);
205201 free_arg(arg->exp.right);
206202 break;
207203
208
- case FILTER_ARG_STR:
204
+ case TEP_FILTER_ARG_STR:
209205 free(arg->str.val);
210206 regfree(&arg->str.reg);
211207 free(arg->str.buffer);
212208 break;
213209
214
- case FILTER_ARG_VALUE:
215
- if (arg->value.type == FILTER_STRING ||
216
- arg->value.type == FILTER_CHAR)
210
+ case TEP_FILTER_ARG_VALUE:
211
+ if (arg->value.type == TEP_FILTER_STRING ||
212
+ arg->value.type == TEP_FILTER_CHAR)
217213 free(arg->value.str);
218214 break;
219215
220
- case FILTER_ARG_OP:
216
+ case TEP_FILTER_ARG_OP:
221217 free_arg(arg->op.left);
222218 free_arg(arg->op.right);
223219 default:
....@@ -228,7 +224,7 @@
228224 }
229225
230226 static int add_event(struct event_list **events,
231
- struct event_format *event)
227
+ struct tep_event *event)
232228 {
233229 struct event_list *list;
234230
....@@ -242,7 +238,7 @@
242238 return 0;
243239 }
244240
245
-static int event_match(struct event_format *event,
241
+static int event_match(struct tep_event *event,
246242 regex_t *sreg, regex_t *ereg)
247243 {
248244 if (sreg) {
....@@ -255,10 +251,10 @@
255251 }
256252
257253 static enum tep_errno
258
-find_event(struct tep_handle *pevent, struct event_list **events,
254
+find_event(struct tep_handle *tep, struct event_list **events,
259255 char *sys_name, char *event_name)
260256 {
261
- struct event_format *event;
257
+ struct tep_event *event;
262258 regex_t ereg;
263259 regex_t sreg;
264260 int match = 0;
....@@ -298,8 +294,8 @@
298294 }
299295 }
300296
301
- for (i = 0; i < pevent->nr_events; i++) {
302
- event = pevent->events[i];
297
+ for (i = 0; i < tep->nr_events; i++) {
298
+ event = tep->events[i];
303299 if (event_match(event, sys_name ? &sreg : NULL, &ereg)) {
304300 match = 1;
305301 if (add_event(events, event) < 0) {
....@@ -333,11 +329,11 @@
333329 }
334330
335331 static enum tep_errno
336
-create_arg_item(struct event_format *event, const char *token,
337
- enum event_type type, struct filter_arg **parg, char *error_str)
332
+create_arg_item(struct tep_event *event, const char *token,
333
+ enum tep_event_type type, struct tep_filter_arg **parg, char *error_str)
338334 {
339
- struct format_field *field;
340
- struct filter_arg *arg;
335
+ struct tep_format_field *field;
336
+ struct tep_filter_arg *arg;
341337
342338 arg = allocate_arg();
343339 if (arg == NULL) {
....@@ -347,11 +343,11 @@
347343
348344 switch (type) {
349345
350
- case EVENT_SQUOTE:
351
- case EVENT_DQUOTE:
352
- arg->type = FILTER_ARG_VALUE;
346
+ case TEP_EVENT_SQUOTE:
347
+ case TEP_EVENT_DQUOTE:
348
+ arg->type = TEP_FILTER_ARG_VALUE;
353349 arg->value.type =
354
- type == EVENT_DQUOTE ? FILTER_STRING : FILTER_CHAR;
350
+ type == TEP_EVENT_DQUOTE ? TEP_FILTER_STRING : TEP_FILTER_CHAR;
355351 arg->value.str = strdup(token);
356352 if (!arg->value.str) {
357353 free_arg(arg);
....@@ -359,11 +355,11 @@
359355 return TEP_ERRNO__MEM_ALLOC_FAILED;
360356 }
361357 break;
362
- case EVENT_ITEM:
358
+ case TEP_EVENT_ITEM:
363359 /* if it is a number, then convert it */
364360 if (isdigit(token[0])) {
365
- arg->type = FILTER_ARG_VALUE;
366
- arg->value.type = FILTER_NUMBER;
361
+ arg->type = TEP_FILTER_ARG_VALUE;
362
+ arg->value.type = TEP_FILTER_NUMBER;
367363 arg->value.val = strtoull(token, NULL, 0);
368364 break;
369365 }
....@@ -377,12 +373,12 @@
377373 field = &cpu;
378374 } else {
379375 /* not a field, Make it false */
380
- arg->type = FILTER_ARG_BOOLEAN;
381
- arg->boolean.value = FILTER_FALSE;
376
+ arg->type = TEP_FILTER_ARG_BOOLEAN;
377
+ arg->boolean.value = TEP_FILTER_FALSE;
382378 break;
383379 }
384380 }
385
- arg->type = FILTER_ARG_FIELD;
381
+ arg->type = TEP_FILTER_ARG_FIELD;
386382 arg->field.field = field;
387383 break;
388384 default:
....@@ -394,82 +390,82 @@
394390 return 0;
395391 }
396392
397
-static struct filter_arg *
398
-create_arg_op(enum filter_op_type btype)
393
+static struct tep_filter_arg *
394
+create_arg_op(enum tep_filter_op_type btype)
399395 {
400
- struct filter_arg *arg;
396
+ struct tep_filter_arg *arg;
401397
402398 arg = allocate_arg();
403399 if (!arg)
404400 return NULL;
405401
406
- arg->type = FILTER_ARG_OP;
402
+ arg->type = TEP_FILTER_ARG_OP;
407403 arg->op.type = btype;
408404
409405 return arg;
410406 }
411407
412
-static struct filter_arg *
413
-create_arg_exp(enum filter_exp_type etype)
408
+static struct tep_filter_arg *
409
+create_arg_exp(enum tep_filter_exp_type etype)
414410 {
415
- struct filter_arg *arg;
411
+ struct tep_filter_arg *arg;
416412
417413 arg = allocate_arg();
418414 if (!arg)
419415 return NULL;
420416
421
- arg->type = FILTER_ARG_EXP;
417
+ arg->type = TEP_FILTER_ARG_EXP;
422418 arg->exp.type = etype;
423419
424420 return arg;
425421 }
426422
427
-static struct filter_arg *
428
-create_arg_cmp(enum filter_cmp_type ctype)
423
+static struct tep_filter_arg *
424
+create_arg_cmp(enum tep_filter_cmp_type ctype)
429425 {
430
- struct filter_arg *arg;
426
+ struct tep_filter_arg *arg;
431427
432428 arg = allocate_arg();
433429 if (!arg)
434430 return NULL;
435431
436432 /* Use NUM and change if necessary */
437
- arg->type = FILTER_ARG_NUM;
433
+ arg->type = TEP_FILTER_ARG_NUM;
438434 arg->num.type = ctype;
439435
440436 return arg;
441437 }
442438
443439 static enum tep_errno
444
-add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
440
+add_right(struct tep_filter_arg *op, struct tep_filter_arg *arg, char *error_str)
445441 {
446
- struct filter_arg *left;
442
+ struct tep_filter_arg *left;
447443 char *str;
448444 int op_type;
449445 int ret;
450446
451447 switch (op->type) {
452
- case FILTER_ARG_EXP:
448
+ case TEP_FILTER_ARG_EXP:
453449 if (op->exp.right)
454450 goto out_fail;
455451 op->exp.right = arg;
456452 break;
457453
458
- case FILTER_ARG_OP:
454
+ case TEP_FILTER_ARG_OP:
459455 if (op->op.right)
460456 goto out_fail;
461457 op->op.right = arg;
462458 break;
463459
464
- case FILTER_ARG_NUM:
460
+ case TEP_FILTER_ARG_NUM:
465461 if (op->op.right)
466462 goto out_fail;
467463 /*
468464 * The arg must be num, str, or field
469465 */
470466 switch (arg->type) {
471
- case FILTER_ARG_VALUE:
472
- case FILTER_ARG_FIELD:
467
+ case TEP_FILTER_ARG_VALUE:
468
+ case TEP_FILTER_ARG_FIELD:
473469 break;
474470 default:
475471 show_error(error_str, "Illegal rvalue");
....@@ -481,20 +477,20 @@
481477 * convert this to a string or regex.
482478 */
483479 switch (arg->value.type) {
484
- case FILTER_CHAR:
480
+ case TEP_FILTER_CHAR:
485481 /*
486482 * A char should be converted to number if
487483 * the string is 1 byte, and the compare
488484 * is not a REGEX.
489485 */
490486 if (strlen(arg->value.str) == 1 &&
491
- op->num.type != FILTER_CMP_REGEX &&
492
- op->num.type != FILTER_CMP_NOT_REGEX) {
493
- arg->value.type = FILTER_NUMBER;
487
+ op->num.type != TEP_FILTER_CMP_REGEX &&
488
+ op->num.type != TEP_FILTER_CMP_NOT_REGEX) {
489
+ arg->value.type = TEP_FILTER_NUMBER;
494490 goto do_int;
495491 }
496492 /* fall through */
497
- case FILTER_STRING:
493
+ case TEP_FILTER_STRING:
498494
499495 /* convert op to a string arg */
500496 op_type = op->num.type;
....@@ -508,16 +504,16 @@
508504 * If left arg was a field not found then
509505 * NULL the entire op.
510506 */
511
- if (left->type == FILTER_ARG_BOOLEAN) {
507
+ if (left->type == TEP_FILTER_ARG_BOOLEAN) {
512508 free_arg(left);
513509 free_arg(arg);
514
- op->type = FILTER_ARG_BOOLEAN;
515
- op->boolean.value = FILTER_FALSE;
510
+ op->type = TEP_FILTER_ARG_BOOLEAN;
511
+ op->boolean.value = TEP_FILTER_FALSE;
516512 break;
517513 }
518514
519515 /* Left arg must be a field */
520
- if (left->type != FILTER_ARG_FIELD) {
516
+ if (left->type != TEP_FILTER_ARG_FIELD) {
521517 show_error(error_str,
522518 "Illegal lvalue for string comparison");
523519 return TEP_ERRNO__ILLEGAL_LVALUE;
....@@ -525,15 +521,15 @@
525521
526522 /* Make sure this is a valid string compare */
527523 switch (op_type) {
528
- case FILTER_CMP_EQ:
529
- op_type = FILTER_CMP_MATCH;
524
+ case TEP_FILTER_CMP_EQ:
525
+ op_type = TEP_FILTER_CMP_MATCH;
530526 break;
531
- case FILTER_CMP_NE:
532
- op_type = FILTER_CMP_NOT_MATCH;
527
+ case TEP_FILTER_CMP_NE:
528
+ op_type = TEP_FILTER_CMP_NOT_MATCH;
533529 break;
534530
535
- case FILTER_CMP_REGEX:
536
- case FILTER_CMP_NOT_REGEX:
531
+ case TEP_FILTER_CMP_REGEX:
532
+ case TEP_FILTER_CMP_NOT_REGEX:
537533 ret = regcomp(&op->str.reg, str, REG_ICASE|REG_NOSUB);
538534 if (ret) {
539535 show_error(error_str,
....@@ -548,7 +544,7 @@
548544 return TEP_ERRNO__ILLEGAL_STRING_CMP;
549545 }
550546
551
- op->type = FILTER_ARG_STR;
547
+ op->type = TEP_FILTER_ARG_STR;
552548 op->str.type = op_type;
553549 op->str.field = left->field.field;
554550 op->str.val = strdup(str);
....@@ -573,12 +569,12 @@
573569
574570 break;
575571
576
- case FILTER_NUMBER:
572
+ case TEP_FILTER_NUMBER:
577573
578574 do_int:
579575 switch (op->num.type) {
580
- case FILTER_CMP_REGEX:
581
- case FILTER_CMP_NOT_REGEX:
576
+ case TEP_FILTER_CMP_REGEX:
577
+ case TEP_FILTER_CMP_NOT_REGEX:
582578 show_error(error_str,
583579 "Op not allowed with integers");
584580 return TEP_ERRNO__ILLEGAL_INTEGER_CMP;
....@@ -605,35 +601,35 @@
605601 return TEP_ERRNO__SYNTAX_ERROR;
606602 }
607603
608
-static struct filter_arg *
609
-rotate_op_right(struct filter_arg *a, struct filter_arg *b)
604
+static struct tep_filter_arg *
605
+rotate_op_right(struct tep_filter_arg *a, struct tep_filter_arg *b)
610606 {
611
- struct filter_arg *arg;
607
+ struct tep_filter_arg *arg;
612608
613609 arg = a->op.right;
614610 a->op.right = b;
615611 return arg;
616612 }
617613
618
-static enum tep_errno add_left(struct filter_arg *op, struct filter_arg *arg)
614
+static enum tep_errno add_left(struct tep_filter_arg *op, struct tep_filter_arg *arg)
619615 {
620616 switch (op->type) {
621
- case FILTER_ARG_EXP:
622
- if (arg->type == FILTER_ARG_OP)
617
+ case TEP_FILTER_ARG_EXP:
618
+ if (arg->type == TEP_FILTER_ARG_OP)
623619 arg = rotate_op_right(arg, op);
624620 op->exp.left = arg;
625621 break;
626622
627
- case FILTER_ARG_OP:
623
+ case TEP_FILTER_ARG_OP:
628624 op->op.left = arg;
629625 break;
630
- case FILTER_ARG_NUM:
631
- if (arg->type == FILTER_ARG_OP)
626
+ case TEP_FILTER_ARG_NUM:
627
+ if (arg->type == TEP_FILTER_ARG_OP)
632628 arg = rotate_op_right(arg, op);
633629
634630 /* left arg of compares must be a field */
635
- if (arg->type != FILTER_ARG_FIELD &&
636
- arg->type != FILTER_ARG_BOOLEAN)
631
+ if (arg->type != TEP_FILTER_ARG_FIELD &&
632
+ arg->type != TEP_FILTER_ARG_BOOLEAN)
637633 return TEP_ERRNO__INVALID_ARG_TYPE;
638634 op->num.left = arg;
639635 break;
....@@ -652,91 +648,91 @@
652648 };
653649
654650 static enum op_type process_op(const char *token,
655
- enum filter_op_type *btype,
656
- enum filter_cmp_type *ctype,
657
- enum filter_exp_type *etype)
651
+ enum tep_filter_op_type *btype,
652
+ enum tep_filter_cmp_type *ctype,
653
+ enum tep_filter_exp_type *etype)
658654 {
659
- *btype = FILTER_OP_NOT;
660
- *etype = FILTER_EXP_NONE;
661
- *ctype = FILTER_CMP_NONE;
655
+ *btype = TEP_FILTER_OP_NOT;
656
+ *etype = TEP_FILTER_EXP_NONE;
657
+ *ctype = TEP_FILTER_CMP_NONE;
662658
663659 if (strcmp(token, "&&") == 0)
664
- *btype = FILTER_OP_AND;
660
+ *btype = TEP_FILTER_OP_AND;
665661 else if (strcmp(token, "||") == 0)
666
- *btype = FILTER_OP_OR;
662
+ *btype = TEP_FILTER_OP_OR;
667663 else if (strcmp(token, "!") == 0)
668664 return OP_NOT;
669665
670
- if (*btype != FILTER_OP_NOT)
666
+ if (*btype != TEP_FILTER_OP_NOT)
671667 return OP_BOOL;
672668
673669 /* Check for value expressions */
674670 if (strcmp(token, "+") == 0) {
675
- *etype = FILTER_EXP_ADD;
671
+ *etype = TEP_FILTER_EXP_ADD;
676672 } else if (strcmp(token, "-") == 0) {
677
- *etype = FILTER_EXP_SUB;
673
+ *etype = TEP_FILTER_EXP_SUB;
678674 } else if (strcmp(token, "*") == 0) {
679
- *etype = FILTER_EXP_MUL;
675
+ *etype = TEP_FILTER_EXP_MUL;
680676 } else if (strcmp(token, "/") == 0) {
681
- *etype = FILTER_EXP_DIV;
677
+ *etype = TEP_FILTER_EXP_DIV;
682678 } else if (strcmp(token, "%") == 0) {
683
- *etype = FILTER_EXP_MOD;
679
+ *etype = TEP_FILTER_EXP_MOD;
684680 } else if (strcmp(token, ">>") == 0) {
685
- *etype = FILTER_EXP_RSHIFT;
681
+ *etype = TEP_FILTER_EXP_RSHIFT;
686682 } else if (strcmp(token, "<<") == 0) {
687
- *etype = FILTER_EXP_LSHIFT;
683
+ *etype = TEP_FILTER_EXP_LSHIFT;
688684 } else if (strcmp(token, "&") == 0) {
689
- *etype = FILTER_EXP_AND;
685
+ *etype = TEP_FILTER_EXP_AND;
690686 } else if (strcmp(token, "|") == 0) {
691
- *etype = FILTER_EXP_OR;
687
+ *etype = TEP_FILTER_EXP_OR;
692688 } else if (strcmp(token, "^") == 0) {
693
- *etype = FILTER_EXP_XOR;
689
+ *etype = TEP_FILTER_EXP_XOR;
694690 } else if (strcmp(token, "~") == 0)
695
- *etype = FILTER_EXP_NOT;
691
+ *etype = TEP_FILTER_EXP_NOT;
696692
697
- if (*etype != FILTER_EXP_NONE)
693
+ if (*etype != TEP_FILTER_EXP_NONE)
698694 return OP_EXP;
699695
700696 /* Check for compares */
701697 if (strcmp(token, "==") == 0)
702
- *ctype = FILTER_CMP_EQ;
698
+ *ctype = TEP_FILTER_CMP_EQ;
703699 else if (strcmp(token, "!=") == 0)
704
- *ctype = FILTER_CMP_NE;
700
+ *ctype = TEP_FILTER_CMP_NE;
705701 else if (strcmp(token, "<") == 0)
706
- *ctype = FILTER_CMP_LT;
702
+ *ctype = TEP_FILTER_CMP_LT;
707703 else if (strcmp(token, ">") == 0)
708
- *ctype = FILTER_CMP_GT;
704
+ *ctype = TEP_FILTER_CMP_GT;
709705 else if (strcmp(token, "<=") == 0)
710
- *ctype = FILTER_CMP_LE;
706
+ *ctype = TEP_FILTER_CMP_LE;
711707 else if (strcmp(token, ">=") == 0)
712
- *ctype = FILTER_CMP_GE;
708
+ *ctype = TEP_FILTER_CMP_GE;
713709 else if (strcmp(token, "=~") == 0)
714
- *ctype = FILTER_CMP_REGEX;
710
+ *ctype = TEP_FILTER_CMP_REGEX;
715711 else if (strcmp(token, "!~") == 0)
716
- *ctype = FILTER_CMP_NOT_REGEX;
712
+ *ctype = TEP_FILTER_CMP_NOT_REGEX;
717713 else
718714 return OP_NONE;
719715
720716 return OP_CMP;
721717 }
722718
723
-static int check_op_done(struct filter_arg *arg)
719
+static int check_op_done(struct tep_filter_arg *arg)
724720 {
725721 switch (arg->type) {
726
- case FILTER_ARG_EXP:
722
+ case TEP_FILTER_ARG_EXP:
727723 return arg->exp.right != NULL;
728724
729
- case FILTER_ARG_OP:
725
+ case TEP_FILTER_ARG_OP:
730726 return arg->op.right != NULL;
731727
732
- case FILTER_ARG_NUM:
728
+ case TEP_FILTER_ARG_NUM:
733729 return arg->num.right != NULL;
734730
735
- case FILTER_ARG_STR:
731
+ case TEP_FILTER_ARG_STR:
736732 /* A string conversion is always done */
737733 return 1;
738734
739
- case FILTER_ARG_BOOLEAN:
735
+ case TEP_FILTER_ARG_BOOLEAN:
740736 /* field not found, is ok */
741737 return 1;
742738
....@@ -752,14 +748,14 @@
752748 };
753749
754750 static enum tep_errno
755
-reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
756
- struct filter_arg *arg, char *error_str)
751
+reparent_op_arg(struct tep_filter_arg *parent, struct tep_filter_arg *old_child,
752
+ struct tep_filter_arg *arg, char *error_str)
757753 {
758
- struct filter_arg *other_child;
759
- struct filter_arg **ptr;
754
+ struct tep_filter_arg *other_child;
755
+ struct tep_filter_arg **ptr;
760756
761
- if (parent->type != FILTER_ARG_OP &&
762
- arg->type != FILTER_ARG_OP) {
757
+ if (parent->type != TEP_FILTER_ARG_OP &&
758
+ arg->type != TEP_FILTER_ARG_OP) {
763759 show_error(error_str, "can not reparent other than OP");
764760 return TEP_ERRNO__REPARENT_NOT_OP;
765761 }
....@@ -804,7 +800,7 @@
804800 }
805801
806802 /* Returns either filter_vals (success) or tep_errno (failfure) */
807
-static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
803
+static int test_arg(struct tep_filter_arg *parent, struct tep_filter_arg *arg,
808804 char *error_str)
809805 {
810806 int lval, rval;
....@@ -812,16 +808,16 @@
812808 switch (arg->type) {
813809
814810 /* bad case */
815
- case FILTER_ARG_BOOLEAN:
811
+ case TEP_FILTER_ARG_BOOLEAN:
816812 return FILTER_VAL_FALSE + arg->boolean.value;
817813
818814 /* good cases: */
819
- case FILTER_ARG_STR:
820
- case FILTER_ARG_VALUE:
821
- case FILTER_ARG_FIELD:
815
+ case TEP_FILTER_ARG_STR:
816
+ case TEP_FILTER_ARG_VALUE:
817
+ case TEP_FILTER_ARG_FIELD:
822818 return FILTER_VAL_NORM;
823819
824
- case FILTER_ARG_EXP:
820
+ case TEP_FILTER_ARG_EXP:
825821 lval = test_arg(arg, arg->exp.left, error_str);
826822 if (lval != FILTER_VAL_NORM)
827823 return lval;
....@@ -830,7 +826,7 @@
830826 return rval;
831827 return FILTER_VAL_NORM;
832828
833
- case FILTER_ARG_NUM:
829
+ case TEP_FILTER_ARG_NUM:
834830 lval = test_arg(arg, arg->num.left, error_str);
835831 if (lval != FILTER_VAL_NORM)
836832 return lval;
....@@ -839,14 +835,14 @@
839835 return rval;
840836 return FILTER_VAL_NORM;
841837
842
- case FILTER_ARG_OP:
843
- if (arg->op.type != FILTER_OP_NOT) {
838
+ case TEP_FILTER_ARG_OP:
839
+ if (arg->op.type != TEP_FILTER_OP_NOT) {
844840 lval = test_arg(arg, arg->op.left, error_str);
845841 switch (lval) {
846842 case FILTER_VAL_NORM:
847843 break;
848844 case FILTER_VAL_TRUE:
849
- if (arg->op.type == FILTER_OP_OR)
845
+ if (arg->op.type == TEP_FILTER_OP_OR)
850846 return FILTER_VAL_TRUE;
851847 rval = test_arg(arg, arg->op.right, error_str);
852848 if (rval != FILTER_VAL_NORM)
....@@ -856,7 +852,7 @@
856852 error_str);
857853
858854 case FILTER_VAL_FALSE:
859
- if (arg->op.type == FILTER_OP_AND)
855
+ if (arg->op.type == TEP_FILTER_OP_AND)
860856 return FILTER_VAL_FALSE;
861857 rval = test_arg(arg, arg->op.right, error_str);
862858 if (rval != FILTER_VAL_NORM)
....@@ -877,18 +873,18 @@
877873 break;
878874
879875 case FILTER_VAL_TRUE:
880
- if (arg->op.type == FILTER_OP_OR)
876
+ if (arg->op.type == TEP_FILTER_OP_OR)
881877 return FILTER_VAL_TRUE;
882
- if (arg->op.type == FILTER_OP_NOT)
878
+ if (arg->op.type == TEP_FILTER_OP_NOT)
883879 return FILTER_VAL_FALSE;
884880
885881 return reparent_op_arg(parent, arg, arg->op.left,
886882 error_str);
887883
888884 case FILTER_VAL_FALSE:
889
- if (arg->op.type == FILTER_OP_AND)
885
+ if (arg->op.type == TEP_FILTER_OP_AND)
890886 return FILTER_VAL_FALSE;
891
- if (arg->op.type == FILTER_OP_NOT)
887
+ if (arg->op.type == TEP_FILTER_OP_NOT)
892888 return FILTER_VAL_TRUE;
893889
894890 return reparent_op_arg(parent, arg, arg->op.left,
....@@ -904,8 +900,8 @@
904900 }
905901
906902 /* Remove any unknown event fields */
907
-static int collapse_tree(struct filter_arg *arg,
908
- struct filter_arg **arg_collapsed, char *error_str)
903
+static int collapse_tree(struct tep_filter_arg *arg,
904
+ struct tep_filter_arg **arg_collapsed, char *error_str)
909905 {
910906 int ret;
911907
....@@ -919,7 +915,7 @@
919915 free_arg(arg);
920916 arg = allocate_arg();
921917 if (arg) {
922
- arg->type = FILTER_ARG_BOOLEAN;
918
+ arg->type = TEP_FILTER_ARG_BOOLEAN;
923919 arg->boolean.value = ret == FILTER_VAL_TRUE;
924920 } else {
925921 show_error(error_str, "Failed to allocate filter arg");
....@@ -939,30 +935,30 @@
939935 }
940936
941937 static enum tep_errno
942
-process_filter(struct event_format *event, struct filter_arg **parg,
938
+process_filter(struct tep_event *event, struct tep_filter_arg **parg,
943939 char *error_str, int not)
944940 {
945
- enum event_type type;
941
+ enum tep_event_type type;
946942 char *token = NULL;
947
- struct filter_arg *current_op = NULL;
948
- struct filter_arg *current_exp = NULL;
949
- struct filter_arg *left_item = NULL;
950
- struct filter_arg *arg = NULL;
943
+ struct tep_filter_arg *current_op = NULL;
944
+ struct tep_filter_arg *current_exp = NULL;
945
+ struct tep_filter_arg *left_item = NULL;
946
+ struct tep_filter_arg *arg = NULL;
951947 enum op_type op_type;
952
- enum filter_op_type btype;
953
- enum filter_exp_type etype;
954
- enum filter_cmp_type ctype;
948
+ enum tep_filter_op_type btype;
949
+ enum tep_filter_exp_type etype;
950
+ enum tep_filter_cmp_type ctype;
955951 enum tep_errno ret;
956952
957953 *parg = NULL;
958954
959955 do {
960956 free(token);
961
- type = read_token(&token);
957
+ type = filter_read_token(&token);
962958 switch (type) {
963
- case EVENT_SQUOTE:
964
- case EVENT_DQUOTE:
965
- case EVENT_ITEM:
959
+ case TEP_EVENT_SQUOTE:
960
+ case TEP_EVENT_DQUOTE:
961
+ case TEP_EVENT_ITEM:
966962 ret = create_arg_item(event, token, type, &arg, error_str);
967963 if (ret < 0)
968964 goto fail;
....@@ -987,7 +983,7 @@
987983 arg = NULL;
988984 break;
989985
990
- case EVENT_DELIM:
986
+ case TEP_EVENT_DELIM:
991987 if (*token == ',') {
992988 show_error(error_str, "Illegal token ','");
993989 ret = TEP_ERRNO__ILLEGAL_TOKEN;
....@@ -1054,7 +1050,7 @@
10541050 }
10551051 break;
10561052
1057
- case EVENT_OP:
1053
+ case TEP_EVENT_OP:
10581054 op_type = process_op(token, &btype, &ctype, &etype);
10591055
10601056 /* All expect a left arg except for NOT */
....@@ -1139,14 +1135,14 @@
11391135 if (ret < 0)
11401136 goto fail_syntax;
11411137 break;
1142
- case EVENT_NONE:
1138
+ case TEP_EVENT_NONE:
11431139 break;
1144
- case EVENT_ERROR:
1140
+ case TEP_EVENT_ERROR:
11451141 goto fail_alloc;
11461142 default:
11471143 goto fail_syntax;
11481144 }
1149
- } while (type != EVENT_NONE);
1145
+ } while (type != TEP_EVENT_NONE);
11501146
11511147 if (!current_op && !current_exp)
11521148 goto fail_syntax;
....@@ -1179,12 +1175,12 @@
11791175 }
11801176
11811177 static enum tep_errno
1182
-process_event(struct event_format *event, const char *filter_str,
1183
- struct filter_arg **parg, char *error_str)
1178
+process_event(struct tep_event *event, const char *filter_str,
1179
+ struct tep_filter_arg **parg, char *error_str)
11841180 {
11851181 int ret;
11861182
1187
- tep_buffer_init(filter_str, strlen(filter_str));
1183
+ init_input_buf(filter_str, strlen(filter_str));
11881184
11891185 ret = process_filter(event, parg, error_str, 0);
11901186 if (ret < 0)
....@@ -1196,19 +1192,19 @@
11961192 if (*parg == NULL)
11971193 return TEP_ERRNO__MEM_ALLOC_FAILED;
11981194
1199
- (*parg)->type = FILTER_ARG_BOOLEAN;
1200
- (*parg)->boolean.value = FILTER_FALSE;
1195
+ (*parg)->type = TEP_FILTER_ARG_BOOLEAN;
1196
+ (*parg)->boolean.value = TEP_FILTER_FALSE;
12011197 }
12021198
12031199 return 0;
12041200 }
12051201
12061202 static enum tep_errno
1207
-filter_event(struct event_filter *filter, struct event_format *event,
1203
+filter_event(struct tep_event_filter *filter, struct tep_event *event,
12081204 const char *filter_str, char *error_str)
12091205 {
1210
- struct filter_type *filter_type;
1211
- struct filter_arg *arg;
1206
+ struct tep_filter_type *filter_type;
1207
+ struct tep_filter_arg *arg;
12121208 enum tep_errno ret;
12131209
12141210 if (filter_str) {
....@@ -1222,8 +1218,8 @@
12221218 if (arg == NULL)
12231219 return TEP_ERRNO__MEM_ALLOC_FAILED;
12241220
1225
- arg->type = FILTER_ARG_BOOLEAN;
1226
- arg->boolean.value = FILTER_TRUE;
1221
+ arg->type = TEP_FILTER_ARG_BOOLEAN;
1222
+ arg->boolean.value = TEP_FILTER_TRUE;
12271223 }
12281224
12291225 filter_type = add_filter_type(filter, event->id);
....@@ -1239,10 +1235,10 @@
12391235 return 0;
12401236 }
12411237
1242
-static void filter_init_error_buf(struct event_filter *filter)
1238
+static void filter_init_error_buf(struct tep_event_filter *filter)
12431239 {
12441240 /* clear buffer to reset show error */
1245
- tep_buffer_init("", 0);
1241
+ init_input_buf("", 0);
12461242 filter->error_buffer[0] = '\0';
12471243 }
12481244
....@@ -1255,10 +1251,10 @@
12551251 * negative error code. Use tep_filter_strerror() to see
12561252 * actual error message in case of error.
12571253 */
1258
-enum tep_errno tep_filter_add_filter_str(struct event_filter *filter,
1254
+enum tep_errno tep_filter_add_filter_str(struct tep_event_filter *filter,
12591255 const char *filter_str)
12601256 {
1261
- struct tep_handle *pevent = filter->pevent;
1257
+ struct tep_handle *tep = filter->tep;
12621258 struct event_list *event;
12631259 struct event_list *events = NULL;
12641260 const char *filter_start;
....@@ -1314,7 +1310,7 @@
13141310 }
13151311
13161312 /* Find this event */
1317
- ret = find_event(pevent, &events, strim(sys_name), strim(event_name));
1313
+ ret = find_event(tep, &events, strim(sys_name), strim(event_name));
13181314 if (ret < 0) {
13191315 free_events(events);
13201316 free(this_event);
....@@ -1335,7 +1331,7 @@
13351331 if (ret < 0)
13361332 rtn = ret;
13371333
1338
- if (ret >= 0 && pevent->test_filters) {
1334
+ if (ret >= 0 && tep->test_filters) {
13391335 char *test;
13401336 test = tep_filter_make_string(filter, event->event->id);
13411337 if (test) {
....@@ -1347,13 +1343,10 @@
13471343
13481344 free_events(events);
13491345
1350
- if (rtn >= 0 && pevent->test_filters)
1351
- exit(0);
1352
-
13531346 return rtn;
13541347 }
13551348
1356
-static void free_filter_type(struct filter_type *filter_type)
1349
+static void free_filter_type(struct tep_filter_type *filter_type)
13571350 {
13581351 free_arg(filter_type->filter);
13591352 }
....@@ -1367,7 +1360,7 @@
13671360 *
13681361 * Returns 0 if message was filled successfully, -1 if error
13691362 */
1370
-int tep_filter_strerror(struct event_filter *filter, enum tep_errno err,
1363
+int tep_filter_strerror(struct tep_event_filter *filter, enum tep_errno err,
13711364 char *buf, size_t buflen)
13721365 {
13731366 if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END)
....@@ -1381,7 +1374,7 @@
13811374 return 0;
13821375 }
13831376
1384
- return tep_strerror(filter->pevent, err, buf, buflen);
1377
+ return tep_strerror(filter->tep, err, buf, buflen);
13851378 }
13861379
13871380 /**
....@@ -1395,10 +1388,10 @@
13951388 * Returns 1: if an event was removed
13961389 * 0: if the event was not found
13971390 */
1398
-int tep_filter_remove_event(struct event_filter *filter,
1391
+int tep_filter_remove_event(struct tep_event_filter *filter,
13991392 int event_id)
14001393 {
1401
- struct filter_type *filter_type;
1394
+ struct tep_filter_type *filter_type;
14021395 unsigned long len;
14031396
14041397 if (!filter->filters)
....@@ -1430,7 +1423,7 @@
14301423 *
14311424 * Removes all filters from a filter and resets it.
14321425 */
1433
-void tep_filter_reset(struct event_filter *filter)
1426
+void tep_filter_reset(struct tep_event_filter *filter)
14341427 {
14351428 int i;
14361429
....@@ -1442,31 +1435,31 @@
14421435 filter->event_filters = NULL;
14431436 }
14441437
1445
-void tep_filter_free(struct event_filter *filter)
1438
+void tep_filter_free(struct tep_event_filter *filter)
14461439 {
1447
- tep_unref(filter->pevent);
1440
+ tep_unref(filter->tep);
14481441
14491442 tep_filter_reset(filter);
14501443
14511444 free(filter);
14521445 }
14531446
1454
-static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg);
1447
+static char *arg_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg);
14551448
1456
-static int copy_filter_type(struct event_filter *filter,
1457
- struct event_filter *source,
1458
- struct filter_type *filter_type)
1449
+static int copy_filter_type(struct tep_event_filter *filter,
1450
+ struct tep_event_filter *source,
1451
+ struct tep_filter_type *filter_type)
14591452 {
1460
- struct filter_arg *arg;
1461
- struct event_format *event;
1453
+ struct tep_filter_arg *arg;
1454
+ struct tep_event *event;
14621455 const char *sys;
14631456 const char *name;
14641457 char *str;
14651458
1466
- /* Can't assume that the pevent's are the same */
1459
+ /* Can't assume that the tep's are the same */
14671460 sys = filter_type->event->system;
14681461 name = filter_type->event->name;
1469
- event = tep_find_event_by_name(filter->pevent, sys, name);
1462
+ event = tep_find_event_by_name(filter->tep, sys, name);
14701463 if (!event)
14711464 return -1;
14721465
....@@ -1482,7 +1475,7 @@
14821475 return -1;
14831476 }
14841477
1485
- arg->type = FILTER_ARG_BOOLEAN;
1478
+ arg->type = TEP_FILTER_ARG_BOOLEAN;
14861479 if (strcmp(str, "TRUE") == 0)
14871480 arg->boolean.value = 1;
14881481 else
....@@ -1514,7 +1507,7 @@
15141507 *
15151508 * Returns 0 on success and -1 if not all filters were copied
15161509 */
1517
-int tep_filter_copy(struct event_filter *dest, struct event_filter *source)
1510
+int tep_filter_copy(struct tep_event_filter *dest, struct tep_event_filter *source)
15181511 {
15191512 int ret = 0;
15201513 int i;
....@@ -1528,184 +1521,23 @@
15281521 return ret;
15291522 }
15301523
1531
-
1532
-/**
1533
- * tep_update_trivial - update the trivial filters with the given filter
1534
- * @dest - the filter to update
1535
- * @source - the filter as the source of the update
1536
- * @type - the type of trivial filter to update.
1537
- *
1538
- * Scan dest for trivial events matching @type to replace with the source.
1539
- *
1540
- * Returns 0 on success and -1 if there was a problem updating, but
1541
- * events may have still been updated on error.
1542
- */
1543
-int tep_update_trivial(struct event_filter *dest, struct event_filter *source,
1544
- enum filter_trivial_type type)
1545
-{
1546
- struct tep_handle *src_pevent;
1547
- struct tep_handle *dest_pevent;
1548
- struct event_format *event;
1549
- struct filter_type *filter_type;
1550
- struct filter_arg *arg;
1551
- char *str;
1552
- int i;
1553
-
1554
- src_pevent = source->pevent;
1555
- dest_pevent = dest->pevent;
1556
-
1557
- /* Do nothing if either of the filters has nothing to filter */
1558
- if (!dest->filters || !source->filters)
1559
- return 0;
1560
-
1561
- for (i = 0; i < dest->filters; i++) {
1562
- filter_type = &dest->event_filters[i];
1563
- arg = filter_type->filter;
1564
- if (arg->type != FILTER_ARG_BOOLEAN)
1565
- continue;
1566
- if ((arg->boolean.value && type == FILTER_TRIVIAL_FALSE) ||
1567
- (!arg->boolean.value && type == FILTER_TRIVIAL_TRUE))
1568
- continue;
1569
-
1570
- event = filter_type->event;
1571
-
1572
- if (src_pevent != dest_pevent) {
1573
- /* do a look up */
1574
- event = tep_find_event_by_name(src_pevent,
1575
- event->system,
1576
- event->name);
1577
- if (!event)
1578
- return -1;
1579
- }
1580
-
1581
- str = tep_filter_make_string(source, event->id);
1582
- if (!str)
1583
- continue;
1584
-
1585
- /* Don't bother if the filter is trivial too */
1586
- if (strcmp(str, "TRUE") != 0 && strcmp(str, "FALSE") != 0)
1587
- filter_event(dest, event, str, NULL);
1588
- free(str);
1589
- }
1590
- return 0;
1591
-}
1592
-
1593
-/**
1594
- * tep_filter_clear_trivial - clear TRUE and FALSE filters
1595
- * @filter: the filter to remove trivial filters from
1596
- * @type: remove only true, false, or both
1597
- *
1598
- * Removes filters that only contain a TRUE or FALES boolean arg.
1599
- *
1600
- * Returns 0 on success and -1 if there was a problem.
1601
- */
1602
-int tep_filter_clear_trivial(struct event_filter *filter,
1603
- enum filter_trivial_type type)
1604
-{
1605
- struct filter_type *filter_type;
1606
- int count = 0;
1607
- int *ids = NULL;
1608
- int i;
1609
-
1610
- if (!filter->filters)
1611
- return 0;
1612
-
1613
- /*
1614
- * Two steps, first get all ids with trivial filters.
1615
- * then remove those ids.
1616
- */
1617
- for (i = 0; i < filter->filters; i++) {
1618
- int *new_ids;
1619
-
1620
- filter_type = &filter->event_filters[i];
1621
- if (filter_type->filter->type != FILTER_ARG_BOOLEAN)
1622
- continue;
1623
- switch (type) {
1624
- case FILTER_TRIVIAL_FALSE:
1625
- if (filter_type->filter->boolean.value)
1626
- continue;
1627
- break;
1628
- case FILTER_TRIVIAL_TRUE:
1629
- if (!filter_type->filter->boolean.value)
1630
- continue;
1631
- default:
1632
- break;
1633
- }
1634
-
1635
- new_ids = realloc(ids, sizeof(*ids) * (count + 1));
1636
- if (!new_ids) {
1637
- free(ids);
1638
- return -1;
1639
- }
1640
-
1641
- ids = new_ids;
1642
- ids[count++] = filter_type->event_id;
1643
- }
1644
-
1645
- if (!count)
1646
- return 0;
1647
-
1648
- for (i = 0; i < count; i++)
1649
- tep_filter_remove_event(filter, ids[i]);
1650
-
1651
- free(ids);
1652
- return 0;
1653
-}
1654
-
1655
-/**
1656
- * tep_filter_event_has_trivial - return true event contains trivial filter
1657
- * @filter: the filter with the information
1658
- * @event_id: the id of the event to test
1659
- * @type: trivial type to test for (TRUE, FALSE, EITHER)
1660
- *
1661
- * Returns 1 if the event contains a matching trivial type
1662
- * otherwise 0.
1663
- */
1664
-int tep_filter_event_has_trivial(struct event_filter *filter,
1665
- int event_id,
1666
- enum filter_trivial_type type)
1667
-{
1668
- struct filter_type *filter_type;
1669
-
1670
- if (!filter->filters)
1671
- return 0;
1672
-
1673
- filter_type = find_filter_type(filter, event_id);
1674
-
1675
- if (!filter_type)
1676
- return 0;
1677
-
1678
- if (filter_type->filter->type != FILTER_ARG_BOOLEAN)
1679
- return 0;
1680
-
1681
- switch (type) {
1682
- case FILTER_TRIVIAL_FALSE:
1683
- return !filter_type->filter->boolean.value;
1684
-
1685
- case FILTER_TRIVIAL_TRUE:
1686
- return filter_type->filter->boolean.value;
1687
- default:
1688
- return 1;
1689
- }
1690
-}
1691
-
1692
-static int test_filter(struct event_format *event, struct filter_arg *arg,
1524
+static int test_filter(struct tep_event *event, struct tep_filter_arg *arg,
16931525 struct tep_record *record, enum tep_errno *err);
16941526
16951527 static const char *
1696
-get_comm(struct event_format *event, struct tep_record *record)
1528
+get_comm(struct tep_event *event, struct tep_record *record)
16971529 {
16981530 const char *comm;
16991531 int pid;
17001532
1701
- pid = tep_data_pid(event->pevent, record);
1702
- comm = tep_data_comm_from_pid(event->pevent, pid);
1533
+ pid = tep_data_pid(event->tep, record);
1534
+ comm = tep_data_comm_from_pid(event->tep, pid);
17031535 return comm;
17041536 }
17051537
17061538 static unsigned long long
1707
-get_value(struct event_format *event,
1708
- struct format_field *field, struct tep_record *record)
1539
+get_value(struct tep_event *event,
1540
+ struct tep_format_field *field, struct tep_record *record)
17091541 {
17101542 unsigned long long val;
17111543
....@@ -1723,7 +1555,7 @@
17231555
17241556 tep_read_number_field(field, record->data, &val);
17251557
1726
- if (!(field->flags & FIELD_IS_SIGNED))
1558
+ if (!(field->flags & TEP_FIELD_IS_SIGNED))
17271559 return val;
17281560
17291561 switch (field->size) {
....@@ -1740,11 +1572,11 @@
17401572 }
17411573
17421574 static unsigned long long
1743
-get_arg_value(struct event_format *event, struct filter_arg *arg,
1575
+get_arg_value(struct tep_event *event, struct tep_filter_arg *arg,
17441576 struct tep_record *record, enum tep_errno *err);
17451577
17461578 static unsigned long long
1747
-get_exp_value(struct event_format *event, struct filter_arg *arg,
1579
+get_exp_value(struct tep_event *event, struct tep_filter_arg *arg,
17481580 struct tep_record *record, enum tep_errno *err)
17491581 {
17501582 unsigned long long lval, rval;
....@@ -1760,37 +1592,37 @@
17601592 }
17611593
17621594 switch (arg->exp.type) {
1763
- case FILTER_EXP_ADD:
1595
+ case TEP_FILTER_EXP_ADD:
17641596 return lval + rval;
17651597
1766
- case FILTER_EXP_SUB:
1598
+ case TEP_FILTER_EXP_SUB:
17671599 return lval - rval;
17681600
1769
- case FILTER_EXP_MUL:
1601
+ case TEP_FILTER_EXP_MUL:
17701602 return lval * rval;
17711603
1772
- case FILTER_EXP_DIV:
1604
+ case TEP_FILTER_EXP_DIV:
17731605 return lval / rval;
17741606
1775
- case FILTER_EXP_MOD:
1607
+ case TEP_FILTER_EXP_MOD:
17761608 return lval % rval;
17771609
1778
- case FILTER_EXP_RSHIFT:
1610
+ case TEP_FILTER_EXP_RSHIFT:
17791611 return lval >> rval;
17801612
1781
- case FILTER_EXP_LSHIFT:
1613
+ case TEP_FILTER_EXP_LSHIFT:
17821614 return lval << rval;
17831615
1784
- case FILTER_EXP_AND:
1616
+ case TEP_FILTER_EXP_AND:
17851617 return lval & rval;
17861618
1787
- case FILTER_EXP_OR:
1619
+ case TEP_FILTER_EXP_OR:
17881620 return lval | rval;
17891621
1790
- case FILTER_EXP_XOR:
1622
+ case TEP_FILTER_EXP_XOR:
17911623 return lval ^ rval;
17921624
1793
- case FILTER_EXP_NOT:
1625
+ case TEP_FILTER_EXP_NOT:
17941626 default:
17951627 if (!*err)
17961628 *err = TEP_ERRNO__INVALID_EXP_TYPE;
....@@ -1799,21 +1631,21 @@
17991631 }
18001632
18011633 static unsigned long long
1802
-get_arg_value(struct event_format *event, struct filter_arg *arg,
1634
+get_arg_value(struct tep_event *event, struct tep_filter_arg *arg,
18031635 struct tep_record *record, enum tep_errno *err)
18041636 {
18051637 switch (arg->type) {
1806
- case FILTER_ARG_FIELD:
1638
+ case TEP_FILTER_ARG_FIELD:
18071639 return get_value(event, arg->field.field, record);
18081640
1809
- case FILTER_ARG_VALUE:
1810
- if (arg->value.type != FILTER_NUMBER) {
1641
+ case TEP_FILTER_ARG_VALUE:
1642
+ if (arg->value.type != TEP_FILTER_NUMBER) {
18111643 if (!*err)
18121644 *err = TEP_ERRNO__NOT_A_NUMBER;
18131645 }
18141646 return arg->value.val;
18151647
1816
- case FILTER_ARG_EXP:
1648
+ case TEP_FILTER_ARG_EXP:
18171649 return get_exp_value(event, arg, record, err);
18181650
18191651 default:
....@@ -1823,7 +1655,7 @@
18231655 return 0;
18241656 }
18251657
1826
-static int test_num(struct event_format *event, struct filter_arg *arg,
1658
+static int test_num(struct tep_event *event, struct tep_filter_arg *arg,
18271659 struct tep_record *record, enum tep_errno *err)
18281660 {
18291661 unsigned long long lval, rval;
....@@ -1839,22 +1671,22 @@
18391671 }
18401672
18411673 switch (arg->num.type) {
1842
- case FILTER_CMP_EQ:
1674
+ case TEP_FILTER_CMP_EQ:
18431675 return lval == rval;
18441676
1845
- case FILTER_CMP_NE:
1677
+ case TEP_FILTER_CMP_NE:
18461678 return lval != rval;
18471679
1848
- case FILTER_CMP_GT:
1680
+ case TEP_FILTER_CMP_GT:
18491681 return lval > rval;
18501682
1851
- case FILTER_CMP_LT:
1683
+ case TEP_FILTER_CMP_LT:
18521684 return lval < rval;
18531685
1854
- case FILTER_CMP_GE:
1686
+ case TEP_FILTER_CMP_GE:
18551687 return lval >= rval;
18561688
1857
- case FILTER_CMP_LE:
1689
+ case TEP_FILTER_CMP_LE:
18581690 return lval <= rval;
18591691
18601692 default:
....@@ -1864,21 +1696,21 @@
18641696 }
18651697 }
18661698
1867
-static const char *get_field_str(struct filter_arg *arg, struct tep_record *record)
1699
+static const char *get_field_str(struct tep_filter_arg *arg, struct tep_record *record)
18681700 {
1869
- struct event_format *event;
1870
- struct tep_handle *pevent;
1701
+ struct tep_event *event;
1702
+ struct tep_handle *tep;
18711703 unsigned long long addr;
18721704 const char *val = NULL;
18731705 unsigned int size;
18741706 char hex[64];
18751707
18761708 /* If the field is not a string convert it */
1877
- if (arg->str.field->flags & FIELD_IS_STRING) {
1709
+ if (arg->str.field->flags & TEP_FIELD_IS_STRING) {
18781710 val = record->data + arg->str.field->offset;
18791711 size = arg->str.field->size;
18801712
1881
- if (arg->str.field->flags & FIELD_IS_DYNAMIC) {
1713
+ if (arg->str.field->flags & TEP_FIELD_IS_DYNAMIC) {
18821714 addr = *(unsigned int *)val;
18831715 val = record->data + (addr & 0xffff);
18841716 size = addr >> 16;
....@@ -1897,12 +1729,12 @@
18971729
18981730 } else {
18991731 event = arg->str.field->event;
1900
- pevent = event->pevent;
1732
+ tep = event->tep;
19011733 addr = get_value(event, arg->str.field, record);
19021734
1903
- if (arg->str.field->flags & (FIELD_IS_POINTER | FIELD_IS_LONG))
1735
+ if (arg->str.field->flags & (TEP_FIELD_IS_POINTER | TEP_FIELD_IS_LONG))
19041736 /* convert to a kernel symbol */
1905
- val = tep_find_function(pevent, addr);
1737
+ val = tep_find_function(tep, addr);
19061738
19071739 if (val == NULL) {
19081740 /* just use the hex of the string name */
....@@ -1914,7 +1746,7 @@
19141746 return val;
19151747 }
19161748
1917
-static int test_str(struct event_format *event, struct filter_arg *arg,
1749
+static int test_str(struct tep_event *event, struct tep_filter_arg *arg,
19181750 struct tep_record *record, enum tep_errno *err)
19191751 {
19201752 const char *val;
....@@ -1925,17 +1757,17 @@
19251757 val = get_field_str(arg, record);
19261758
19271759 switch (arg->str.type) {
1928
- case FILTER_CMP_MATCH:
1760
+ case TEP_FILTER_CMP_MATCH:
19291761 return strcmp(val, arg->str.val) == 0;
19301762
1931
- case FILTER_CMP_NOT_MATCH:
1763
+ case TEP_FILTER_CMP_NOT_MATCH:
19321764 return strcmp(val, arg->str.val) != 0;
19331765
1934
- case FILTER_CMP_REGEX:
1766
+ case TEP_FILTER_CMP_REGEX:
19351767 /* Returns zero on match */
19361768 return !regexec(&arg->str.reg, val, 0, NULL, 0);
19371769
1938
- case FILTER_CMP_NOT_REGEX:
1770
+ case TEP_FILTER_CMP_NOT_REGEX:
19391771 return regexec(&arg->str.reg, val, 0, NULL, 0);
19401772
19411773 default:
....@@ -1945,19 +1777,19 @@
19451777 }
19461778 }
19471779
1948
-static int test_op(struct event_format *event, struct filter_arg *arg,
1780
+static int test_op(struct tep_event *event, struct tep_filter_arg *arg,
19491781 struct tep_record *record, enum tep_errno *err)
19501782 {
19511783 switch (arg->op.type) {
1952
- case FILTER_OP_AND:
1784
+ case TEP_FILTER_OP_AND:
19531785 return test_filter(event, arg->op.left, record, err) &&
19541786 test_filter(event, arg->op.right, record, err);
19551787
1956
- case FILTER_OP_OR:
1788
+ case TEP_FILTER_OP_OR:
19571789 return test_filter(event, arg->op.left, record, err) ||
19581790 test_filter(event, arg->op.right, record, err);
19591791
1960
- case FILTER_OP_NOT:
1792
+ case TEP_FILTER_OP_NOT:
19611793 return !test_filter(event, arg->op.right, record, err);
19621794
19631795 default:
....@@ -1967,7 +1799,7 @@
19671799 }
19681800 }
19691801
1970
-static int test_filter(struct event_format *event, struct filter_arg *arg,
1802
+static int test_filter(struct tep_event *event, struct tep_filter_arg *arg,
19711803 struct tep_record *record, enum tep_errno *err)
19721804 {
19731805 if (*err) {
....@@ -1978,22 +1810,22 @@
19781810 }
19791811
19801812 switch (arg->type) {
1981
- case FILTER_ARG_BOOLEAN:
1813
+ case TEP_FILTER_ARG_BOOLEAN:
19821814 /* easy case */
19831815 return arg->boolean.value;
19841816
1985
- case FILTER_ARG_OP:
1817
+ case TEP_FILTER_ARG_OP:
19861818 return test_op(event, arg, record, err);
19871819
1988
- case FILTER_ARG_NUM:
1820
+ case TEP_FILTER_ARG_NUM:
19891821 return test_num(event, arg, record, err);
19901822
1991
- case FILTER_ARG_STR:
1823
+ case TEP_FILTER_ARG_STR:
19921824 return test_str(event, arg, record, err);
19931825
1994
- case FILTER_ARG_EXP:
1995
- case FILTER_ARG_VALUE:
1996
- case FILTER_ARG_FIELD:
1826
+ case TEP_FILTER_ARG_EXP:
1827
+ case TEP_FILTER_ARG_VALUE:
1828
+ case TEP_FILTER_ARG_FIELD:
19971829 /*
19981830 * Expressions, fields and values evaluate
19991831 * to true if they return non zero
....@@ -2015,9 +1847,9 @@
20151847 * Returns 1 if filter found for @event_id
20161848 * otherwise 0;
20171849 */
2018
-int tep_event_filtered(struct event_filter *filter, int event_id)
1850
+int tep_event_filtered(struct tep_event_filter *filter, int event_id)
20191851 {
2020
- struct filter_type *filter_type;
1852
+ struct tep_filter_type *filter_type;
20211853
20221854 if (!filter->filters)
20231855 return 0;
....@@ -2039,11 +1871,11 @@
20391871 * NO_FILTER - if no filters exist
20401872 * otherwise - error occurred during test
20411873 */
2042
-enum tep_errno tep_filter_match(struct event_filter *filter,
1874
+enum tep_errno tep_filter_match(struct tep_event_filter *filter,
20431875 struct tep_record *record)
20441876 {
2045
- struct tep_handle *pevent = filter->pevent;
2046
- struct filter_type *filter_type;
1877
+ struct tep_handle *tep = filter->tep;
1878
+ struct tep_filter_type *filter_type;
20471879 int event_id;
20481880 int ret;
20491881 enum tep_errno err = 0;
....@@ -2053,7 +1885,7 @@
20531885 if (!filter->filters)
20541886 return TEP_ERRNO__NO_FILTER;
20551887
2056
- event_id = tep_data_type(pevent, record);
1888
+ event_id = tep_data_type(tep, record);
20571889
20581890 filter_type = find_filter_type(filter, event_id);
20591891 if (!filter_type)
....@@ -2066,7 +1898,7 @@
20661898 return ret ? TEP_ERRNO__FILTER_MATCH : TEP_ERRNO__FILTER_MISS;
20671899 }
20681900
2069
-static char *op_to_str(struct event_filter *filter, struct filter_arg *arg)
1901
+static char *op_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
20701902 {
20711903 char *str = NULL;
20721904 char *left = NULL;
....@@ -2077,10 +1909,10 @@
20771909 int val;
20781910
20791911 switch (arg->op.type) {
2080
- case FILTER_OP_AND:
1912
+ case TEP_FILTER_OP_AND:
20811913 op = "&&";
20821914 /* fall through */
2083
- case FILTER_OP_OR:
1915
+ case TEP_FILTER_OP_OR:
20841916 if (!op)
20851917 op = "||";
20861918
....@@ -2101,8 +1933,8 @@
21011933 right_val = 0;
21021934
21031935 if (left_val >= 0) {
2104
- if ((arg->op.type == FILTER_OP_AND && !left_val) ||
2105
- (arg->op.type == FILTER_OP_OR && left_val)) {
1936
+ if ((arg->op.type == TEP_FILTER_OP_AND && !left_val) ||
1937
+ (arg->op.type == TEP_FILTER_OP_OR && left_val)) {
21061938 /* Just return left value */
21071939 str = left;
21081940 left = NULL;
....@@ -2112,22 +1944,23 @@
21121944 /* just evaluate this. */
21131945 val = 0;
21141946 switch (arg->op.type) {
2115
- case FILTER_OP_AND:
1947
+ case TEP_FILTER_OP_AND:
21161948 val = left_val && right_val;
21171949 break;
2118
- case FILTER_OP_OR:
1950
+ case TEP_FILTER_OP_OR:
21191951 val = left_val || right_val;
21201952 break;
21211953 default:
21221954 break;
21231955 }
2124
- asprintf(&str, val ? "TRUE" : "FALSE");
1956
+ if (asprintf(&str, val ? "TRUE" : "FALSE") < 0)
1957
+ str = NULL;
21251958 break;
21261959 }
21271960 }
21281961 if (right_val >= 0) {
2129
- if ((arg->op.type == FILTER_OP_AND && !right_val) ||
2130
- (arg->op.type == FILTER_OP_OR && right_val)) {
1962
+ if ((arg->op.type == TEP_FILTER_OP_AND && !right_val) ||
1963
+ (arg->op.type == TEP_FILTER_OP_OR && right_val)) {
21311964 /* Just return right value */
21321965 str = right;
21331966 right = NULL;
....@@ -2139,10 +1972,11 @@
21391972 break;
21401973 }
21411974
2142
- asprintf(&str, "(%s) %s (%s)", left, op, right);
1975
+ if (asprintf(&str, "(%s) %s (%s)", left, op, right) < 0)
1976
+ str = NULL;
21431977 break;
21441978
2145
- case FILTER_OP_NOT:
1979
+ case TEP_FILTER_OP_NOT:
21461980 op = "!";
21471981 right = arg_to_str(filter, arg->op.right);
21481982 if (!right)
....@@ -2155,10 +1989,12 @@
21551989 right_val = 0;
21561990 if (right_val >= 0) {
21571991 /* just return the opposite */
2158
- asprintf(&str, right_val ? "FALSE" : "TRUE");
1992
+ if (asprintf(&str, right_val ? "FALSE" : "TRUE") < 0)
1993
+ str = NULL;
21591994 break;
21601995 }
2161
- asprintf(&str, "%s(%s)", op, right);
1996
+ if (asprintf(&str, "%s(%s)", op, right) < 0)
1997
+ str = NULL;
21621998 break;
21631999
21642000 default:
....@@ -2170,21 +2006,22 @@
21702006 return str;
21712007 }
21722008
2173
-static char *val_to_str(struct event_filter *filter, struct filter_arg *arg)
2009
+static char *val_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
21742010 {
21752011 char *str = NULL;
21762012
2177
- asprintf(&str, "%lld", arg->value.val);
2013
+ if (asprintf(&str, "%lld", arg->value.val) < 0)
2014
+ str = NULL;
21782015
21792016 return str;
21802017 }
21812018
2182
-static char *field_to_str(struct event_filter *filter, struct filter_arg *arg)
2019
+static char *field_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
21832020 {
21842021 return strdup(arg->field.field->name);
21852022 }
21862023
2187
-static char *exp_to_str(struct event_filter *filter, struct filter_arg *arg)
2024
+static char *exp_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
21882025 {
21892026 char *lstr;
21902027 char *rstr;
....@@ -2197,34 +2034,34 @@
21972034 goto out;
21982035
21992036 switch (arg->exp.type) {
2200
- case FILTER_EXP_ADD:
2037
+ case TEP_FILTER_EXP_ADD:
22012038 op = "+";
22022039 break;
2203
- case FILTER_EXP_SUB:
2040
+ case TEP_FILTER_EXP_SUB:
22042041 op = "-";
22052042 break;
2206
- case FILTER_EXP_MUL:
2043
+ case TEP_FILTER_EXP_MUL:
22072044 op = "*";
22082045 break;
2209
- case FILTER_EXP_DIV:
2046
+ case TEP_FILTER_EXP_DIV:
22102047 op = "/";
22112048 break;
2212
- case FILTER_EXP_MOD:
2049
+ case TEP_FILTER_EXP_MOD:
22132050 op = "%";
22142051 break;
2215
- case FILTER_EXP_RSHIFT:
2052
+ case TEP_FILTER_EXP_RSHIFT:
22162053 op = ">>";
22172054 break;
2218
- case FILTER_EXP_LSHIFT:
2055
+ case TEP_FILTER_EXP_LSHIFT:
22192056 op = "<<";
22202057 break;
2221
- case FILTER_EXP_AND:
2058
+ case TEP_FILTER_EXP_AND:
22222059 op = "&";
22232060 break;
2224
- case FILTER_EXP_OR:
2061
+ case TEP_FILTER_EXP_OR:
22252062 op = "|";
22262063 break;
2227
- case FILTER_EXP_XOR:
2064
+ case TEP_FILTER_EXP_XOR:
22282065 op = "^";
22292066 break;
22302067 default:
....@@ -2232,7 +2069,8 @@
22322069 break;
22332070 }
22342071
2235
- asprintf(&str, "%s %s %s", lstr, op, rstr);
2072
+ if (asprintf(&str, "%s %s %s", lstr, op, rstr) < 0)
2073
+ str = NULL;
22362074 out:
22372075 free(lstr);
22382076 free(rstr);
....@@ -2240,7 +2078,7 @@
22402078 return str;
22412079 }
22422080
2243
-static char *num_to_str(struct event_filter *filter, struct filter_arg *arg)
2081
+static char *num_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
22442082 {
22452083 char *lstr;
22462084 char *rstr;
....@@ -2253,30 +2091,31 @@
22532091 goto out;
22542092
22552093 switch (arg->num.type) {
2256
- case FILTER_CMP_EQ:
2094
+ case TEP_FILTER_CMP_EQ:
22572095 op = "==";
22582096 /* fall through */
2259
- case FILTER_CMP_NE:
2097
+ case TEP_FILTER_CMP_NE:
22602098 if (!op)
22612099 op = "!=";
22622100 /* fall through */
2263
- case FILTER_CMP_GT:
2101
+ case TEP_FILTER_CMP_GT:
22642102 if (!op)
22652103 op = ">";
22662104 /* fall through */
2267
- case FILTER_CMP_LT:
2105
+ case TEP_FILTER_CMP_LT:
22682106 if (!op)
22692107 op = "<";
22702108 /* fall through */
2271
- case FILTER_CMP_GE:
2109
+ case TEP_FILTER_CMP_GE:
22722110 if (!op)
22732111 op = ">=";
22742112 /* fall through */
2275
- case FILTER_CMP_LE:
2113
+ case TEP_FILTER_CMP_LE:
22762114 if (!op)
22772115 op = "<=";
22782116
2279
- asprintf(&str, "%s %s %s", lstr, op, rstr);
2117
+ if (asprintf(&str, "%s %s %s", lstr, op, rstr) < 0)
2118
+ str = NULL;
22802119 break;
22812120
22822121 default:
....@@ -2290,29 +2129,30 @@
22902129 return str;
22912130 }
22922131
2293
-static char *str_to_str(struct event_filter *filter, struct filter_arg *arg)
2132
+static char *str_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
22942133 {
22952134 char *str = NULL;
22962135 char *op = NULL;
22972136
22982137 switch (arg->str.type) {
2299
- case FILTER_CMP_MATCH:
2138
+ case TEP_FILTER_CMP_MATCH:
23002139 op = "==";
23012140 /* fall through */
2302
- case FILTER_CMP_NOT_MATCH:
2141
+ case TEP_FILTER_CMP_NOT_MATCH:
23032142 if (!op)
23042143 op = "!=";
23052144 /* fall through */
2306
- case FILTER_CMP_REGEX:
2145
+ case TEP_FILTER_CMP_REGEX:
23072146 if (!op)
23082147 op = "=~";
23092148 /* fall through */
2310
- case FILTER_CMP_NOT_REGEX:
2149
+ case TEP_FILTER_CMP_NOT_REGEX:
23112150 if (!op)
23122151 op = "!~";
23132152
2314
- asprintf(&str, "%s %s \"%s\"",
2315
- arg->str.field->name, op, arg->str.val);
2153
+ if (asprintf(&str, "%s %s \"%s\"",
2154
+ arg->str.field->name, op, arg->str.val) < 0)
2155
+ str = NULL;
23162156 break;
23172157
23182158 default:
....@@ -2322,31 +2162,32 @@
23222162 return str;
23232163 }
23242164
2325
-static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg)
2165
+static char *arg_to_str(struct tep_event_filter *filter, struct tep_filter_arg *arg)
23262166 {
23272167 char *str = NULL;
23282168
23292169 switch (arg->type) {
2330
- case FILTER_ARG_BOOLEAN:
2331
- asprintf(&str, arg->boolean.value ? "TRUE" : "FALSE");
2170
+ case TEP_FILTER_ARG_BOOLEAN:
2171
+ if (asprintf(&str, arg->boolean.value ? "TRUE" : "FALSE") < 0)
2172
+ str = NULL;
23322173 return str;
23332174
2334
- case FILTER_ARG_OP:
2175
+ case TEP_FILTER_ARG_OP:
23352176 return op_to_str(filter, arg);
23362177
2337
- case FILTER_ARG_NUM:
2178
+ case TEP_FILTER_ARG_NUM:
23382179 return num_to_str(filter, arg);
23392180
2340
- case FILTER_ARG_STR:
2181
+ case TEP_FILTER_ARG_STR:
23412182 return str_to_str(filter, arg);
23422183
2343
- case FILTER_ARG_VALUE:
2184
+ case TEP_FILTER_ARG_VALUE:
23442185 return val_to_str(filter, arg);
23452186
2346
- case FILTER_ARG_FIELD:
2187
+ case TEP_FILTER_ARG_FIELD:
23472188 return field_to_str(filter, arg);
23482189
2349
- case FILTER_ARG_EXP:
2190
+ case TEP_FILTER_ARG_EXP:
23502191 return exp_to_str(filter, arg);
23512192
23522193 default:
....@@ -2366,9 +2207,9 @@
23662207 * NULL is returned if no filter is found or allocation failed.
23672208 */
23682209 char *
2369
-tep_filter_make_string(struct event_filter *filter, int event_id)
2210
+tep_filter_make_string(struct tep_event_filter *filter, int event_id)
23702211 {
2371
- struct filter_type *filter_type;
2212
+ struct tep_filter_type *filter_type;
23722213
23732214 if (!filter->filters)
23742215 return NULL;
....@@ -2390,10 +2231,10 @@
23902231 * 1 if the two filters hold the same content.
23912232 * 0 if they do not.
23922233 */
2393
-int tep_filter_compare(struct event_filter *filter1, struct event_filter *filter2)
2234
+int tep_filter_compare(struct tep_event_filter *filter1, struct tep_event_filter *filter2)
23942235 {
2395
- struct filter_type *filter_type1;
2396
- struct filter_type *filter_type2;
2236
+ struct tep_filter_type *filter_type1;
2237
+ struct tep_filter_type *filter_type2;
23972238 char *str1, *str2;
23982239 int result;
23992240 int i;
....@@ -2415,14 +2256,6 @@
24152256 break;
24162257 if (filter_type1->filter->type != filter_type2->filter->type)
24172258 break;
2418
- switch (filter_type1->filter->type) {
2419
- case FILTER_TRIVIAL_FALSE:
2420
- case FILTER_TRIVIAL_TRUE:
2421
- /* trivial types just need the type compared */
2422
- continue;
2423
- default:
2424
- break;
2425
- }
24262259 /* The best way to compare complex filters is with strings */
24272260 str1 = arg_to_str(filter1, filter_type1->filter);
24282261 str2 = arg_to_str(filter2, filter_type2->filter);