@@ -661,8 +661,10 @@ struct ftrace_event_field {
661
661
};
662
662
663
663
struct event_filter {
664
- int n_preds ;
665
- struct filter_pred * * preds ;
664
+ int n_preds ; /* Number assigned */
665
+ int a_preds ; /* allocated */
666
+ struct filter_pred * preds ;
667
+ struct filter_pred * root ;
666
668
char * filter_string ;
667
669
};
668
670
@@ -674,11 +676,23 @@ struct event_subsystem {
674
676
int nr_events ;
675
677
};
676
678
679
+ #define FILTER_PRED_INVALID ((unsigned short)-1)
680
+ #define FILTER_PRED_IS_RIGHT (1 << 15)
681
+ #define FILTER_PRED_FOLD (1 << 15)
682
+
683
+ /*
684
+ * The max preds is the size of unsigned short with
685
+ * two flags at the MSBs. One bit is used for both the IS_RIGHT
686
+ * and FOLD flags. The other is reserved.
687
+ *
688
+ * 2^14 preds is way more than enough.
689
+ */
690
+ #define MAX_FILTER_PRED 16384
691
+
677
692
struct filter_pred ;
678
693
struct regex ;
679
694
680
- typedef int (* filter_pred_fn_t ) (struct filter_pred * pred , void * event ,
681
- int val1 , int val2 );
695
+ typedef int (* filter_pred_fn_t ) (struct filter_pred * pred , void * event );
682
696
683
697
typedef int (* regex_match_func )(char * str , struct regex * r , int len );
684
698
@@ -700,11 +714,23 @@ struct filter_pred {
700
714
filter_pred_fn_t fn ;
701
715
u64 val ;
702
716
struct regex regex ;
703
- char * field_name ;
717
+ /*
718
+ * Leaf nodes use field_name, ops is used by AND and OR
719
+ * nodes. The field_name is always freed when freeing a pred.
720
+ * We can overload field_name for ops and have it freed
721
+ * as well.
722
+ */
723
+ union {
724
+ char * field_name ;
725
+ unsigned short * ops ;
726
+ };
704
727
int offset ;
705
728
int not ;
706
729
int op ;
707
- int pop_n ;
730
+ unsigned short index ;
731
+ unsigned short parent ;
732
+ unsigned short left ;
733
+ unsigned short right ;
708
734
};
709
735
710
736
extern struct list_head ftrace_common_fields ;
0 commit comments