Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
trace_events_filter.c File Reference
#include <linux/module.h>
#include <linux/ctype.h>
#include <linux/mutex.h>
#include <linux/perf_event.h>
#include <linux/slab.h>
#include "trace.h"
#include "trace_output.h"

Go to the source code of this file.

Data Structures

struct  filter_op
 
struct  opstack_op
 
struct  postfix_elt
 
struct  filter_parse_state
 
struct  pred_stack
 
struct  filter_match_preds_data
 
struct  check_pred_data
 
struct  fold_pred_data
 
struct  filter_list
 

Macros

#define DEFAULT_SYS_FILTER_MESSAGE
 
#define DEFINE_COMPARISON_PRED(type)
 
#define DEFINE_EQUALITY_PRED(size)
 

Typedefs

typedef int(* filter_pred_walkcb_t )(enum move_type move, struct filter_pred *pred, int *err, void *data)
 

Enumerations

enum  filter_op_ids {
  OP_OR, OP_AND, OP_GLOB, OP_NE,
  OP_EQ, OP_LT, OP_LE, OP_GT,
  OP_GE, OP_NONE, OP_OPEN_PAREN
}
 
enum  {
  FILT_ERR_NONE, FILT_ERR_INVALID_OP, FILT_ERR_UNBALANCED_PAREN, FILT_ERR_TOO_MANY_OPERANDS,
  FILT_ERR_OPERAND_TOO_LONG, FILT_ERR_FIELD_NOT_FOUND, FILT_ERR_ILLEGAL_FIELD_OP, FILT_ERR_ILLEGAL_INTVAL,
  FILT_ERR_BAD_SUBSYS_FILTER, FILT_ERR_TOO_MANY_PREDS, FILT_ERR_MISSING_FIELD, FILT_ERR_INVALID_FILTER,
  FILT_ERR_IP_FIELD_ONLY
}
 
enum  move_type {
  MOVE_DOWN, MOVE_UP_FROM_LEFT, MOVE_UP_FROM_RIGHT, MOVE_CHARGE_TYPE_ANON,
  MOVE_CHARGE_TYPE_FILE, NR_MOVE_TYPE
}
 
enum  walk_return { WALK_PRED_ABORT, WALK_PRED_PARENT, WALK_PRED_DEFAULT }
 

Functions

 DEFINE_COMPARISON_PRED (s64)
 
 DEFINE_COMPARISON_PRED (u64)
 
 DEFINE_COMPARISON_PRED (s32)
 
 DEFINE_COMPARISON_PRED (u32)
 
 DEFINE_COMPARISON_PRED (s16)
 
 DEFINE_COMPARISON_PRED (u16)
 
 DEFINE_COMPARISON_PRED (s8)
 
 DEFINE_COMPARISON_PRED (u8)
 
 DEFINE_EQUALITY_PRED (64)
 
 DEFINE_EQUALITY_PRED (32)
 
 DEFINE_EQUALITY_PRED (16)
 
 DEFINE_EQUALITY_PRED (8)
 
enum regex_type filter_parse_regex (char *buff, int len, char **search, int *not)
 
int filter_match_preds (struct event_filter *filter, void *rec)
 
 EXPORT_SYMBOL_GPL (filter_match_preds)
 
void print_event_filter (struct ftrace_event_call *call, struct trace_seq *s)
 
void print_subsystem_event_filter (struct event_subsystem *system, struct trace_seq *s)
 
void destroy_preds (struct ftrace_event_call *call)
 
int filter_assign_type (const char *type)
 
int apply_event_filter (struct ftrace_event_call *call, char *filter_string)
 
int apply_subsystem_event_filter (struct event_subsystem *system, char *filter_string)
 

Macro Definition Documentation

#define DEFAULT_SYS_FILTER_MESSAGE
Value:
"### global filter ###\n" \
"# Use this to set filters for multiple events.\n" \
"# Only events with the given fields will be affected.\n" \
"# If no events are modified, an error message will be displayed here"

Definition at line 30 of file trace_events_filter.c.

#define DEFINE_COMPARISON_PRED (   type)
Value:
static int filter_pred_##type(struct filter_pred *pred, void *event) \
{ \
type *addr = (type *)(event + pred->offset); \
type val = (type)pred->val; \
int match = 0; \
\
switch (pred->op) { \
case OP_LT: \
match = (*addr < val); \
break; \
case OP_LE: \
match = (*addr <= val); \
break; \
case OP_GT: \
match = (*addr > val); \
break; \
case OP_GE: \
match = (*addr >= val); \
break; \
default: \
break; \
} \
\
return match; \
}

Definition at line 139 of file trace_events_filter.c.

#define DEFINE_EQUALITY_PRED (   size)
Value:
static int filter_pred_##size(struct filter_pred *pred, void *event) \
{ \
u##size *addr = (u##size *)(event + pred->offset); \
u##size val = (u##size)pred->val; \
int match; \
\
match = (val == *addr) ^ pred->not; \
\
return match; \
}

Definition at line 166 of file trace_events_filter.c.

Typedef Documentation

typedef int(* filter_pred_walkcb_t)(enum move_type move, struct filter_pred *pred, int *err, void *data)

Definition at line 398 of file trace_events_filter.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
FILT_ERR_NONE 
FILT_ERR_INVALID_OP 
FILT_ERR_UNBALANCED_PAREN 
FILT_ERR_TOO_MANY_OPERANDS 
FILT_ERR_OPERAND_TOO_LONG 
FILT_ERR_FIELD_NOT_FOUND 
FILT_ERR_ILLEGAL_FIELD_OP 
FILT_ERR_ILLEGAL_INTVAL 
FILT_ERR_BAD_SUBSYS_FILTER 
FILT_ERR_TOO_MANY_PREDS 
FILT_ERR_MISSING_FIELD 
FILT_ERR_INVALID_FILTER 
FILT_ERR_IP_FIELD_ONLY 

Definition at line 71 of file trace_events_filter.c.

Enumerator:
OP_OR 
OP_AND 
OP_GLOB 
OP_NE 
OP_EQ 
OP_LT 
OP_LE 
OP_GT 
OP_GE 
OP_NONE 
OP_OPEN_PAREN 

Definition at line 36 of file trace_events_filter.c.

enum move_type
Enumerator:
MOVE_DOWN 
MOVE_UP_FROM_LEFT 
MOVE_UP_FROM_RIGHT 
MOVE_CHARGE_TYPE_ANON 
MOVE_CHARGE_TYPE_FILE 
NR_MOVE_TYPE 

Definition at line 373 of file trace_events_filter.c.

Enumerator:
WALK_PRED_ABORT 
WALK_PRED_PARENT 
WALK_PRED_DEFAULT 

Definition at line 392 of file trace_events_filter.c.

Function Documentation

int apply_event_filter ( struct ftrace_event_call call,
char filter_string 
)

Definition at line 1861 of file trace_events_filter.c.

int apply_subsystem_event_filter ( struct event_subsystem system,
char filter_string 
)

Definition at line 1910 of file trace_events_filter.c.

DEFINE_COMPARISON_PRED ( s64  )
DEFINE_COMPARISON_PRED ( u64  )
DEFINE_COMPARISON_PRED ( s32  )
DEFINE_COMPARISON_PRED ( u32  )
DEFINE_COMPARISON_PRED ( s16  )
DEFINE_COMPARISON_PRED ( u16  )
DEFINE_COMPARISON_PRED ( s8  )
DEFINE_COMPARISON_PRED ( u8  )
DEFINE_EQUALITY_PRED ( 64  )
DEFINE_EQUALITY_PRED ( 32  )
DEFINE_EQUALITY_PRED ( 16  )
DEFINE_EQUALITY_PRED ( )
void destroy_preds ( struct ftrace_event_call call)

Definition at line 809 of file trace_events_filter.c.

EXPORT_SYMBOL_GPL ( filter_match_preds  )
int filter_assign_type ( const char type)

Definition at line 893 of file trace_events_filter.c.

int filter_match_preds ( struct event_filter filter,
void rec 
)

Definition at line 533 of file trace_events_filter.c.

enum regex_type filter_parse_regex ( char buff,
int  len,
char **  search,
int not 
)

filter_parse_regex - parse a basic regex : the raw regex : length of the regex : will point to the beginning of the string to compare : tell whether the match will have to be inverted

This passes in a buffer containing a regex and this function will set search to point to the search part of the buffer and return the type of search it is (see enum above). This does modify buff.

Returns enum type. search returns the pointer to use for comparison. not returns 1 if buff started with a '!' 0 otherwise.

Definition at line 309 of file trace_events_filter.c.

void print_event_filter ( struct ftrace_event_call call,
struct trace_seq s 
)

Definition at line 634 of file trace_events_filter.c.

void print_subsystem_event_filter ( struct event_subsystem system,
struct trace_seq s 
)

Definition at line 647 of file trace_events_filter.c.