Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\trace_events_hist.c Create Date:2022-07-28 12:30:54
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:parse_expr

Proto:static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, struct trace_event_file *file, char *str, unsigned long flags, char *var_name, unsigned int level)

Type:struct hist_field

Parameter:

TypeParameterName
struct hist_trigger_data *hist_data
struct trace_event_file *file
char *str
unsigned longflags
char *var_name
unsigned intlevel
3053  struct hist_field * operand1 = NULL, * operand2 = NULL, * expr = NULL
3055  ret = -EINVAL
3058  If level > 3 Then
3059  hist_err(tr, HIST_ERR_TOO_MANY_SUBEXPR, errpos(str))
3060  Return ERR_PTR( - EINVAL)
3063  field_op = contains_operator(str)
3065  If field_op == FIELD_OP_NONE Then Return parse_atom(hist_data, file, str, & flags, var_name)
3068  If field_op == FIELD_OP_UNARY_MINUS Then Return parse_unary(hist_data, file, str, flags, var_name, ++level)
3072  Case field_op == FIELD_OP_MINUS
3073  sep = "-"
3074  Break
3075  Case field_op == FIELD_OP_PLUS
3076  sep = "+"
3077  Break
3078  Default
3079  Go to free
3082  operand1_str = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function
3083  If Not operand1_str || Not str Then Go to free
3086  operand_flags = 0
3087  operand1 = parse_atom(hist_data, file, operand1_str, & operand_flags, NULL)
3089  If IS_ERR(operand1) Then
3090  ret = PTR_ERR(operand1)
3091  operand1 = NULL
3092  Go to free
3096  operand_flags = 0
3097  operand2 = parse_expr(hist_data, file, str, operand_flags, NULL, ++level)
3098  If IS_ERR(operand2) Then
3099  ret = PTR_ERR(operand2)
3100  operand2 = NULL
3101  Go to free
3104  ret = check_expr_operands(tr, operand1, operand2)
3105  If ret Then Go to free
3108  flags |= HIST_FIELD_FL_EXPR
3110  flags |= flags & (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS)
3113  expr = create_hist_field(hist_data, NULL, flags, var_name)
3114  If Not expr Then
3115  ret = -ENOMEM
3116  Go to free
3119  read_once = true
3120  read_once = true
3122  operands[0] = operand1
3123  operands[1] = operand2
3124  operator = field_op
3125  * The name field is used for EXPR and VAR_REF fields. VAR * fields contain the variable name in var.name. = expr_str(expr, 0)
3126  type = kstrdup(type, GFP_KERNEL)
3127  If Not type Then
3128  ret = -ENOMEM
3129  Go to free
3133  Case field_op == FIELD_OP_MINUS
3134  fn = hist_field_minus
3135  Break
3136  Case field_op == FIELD_OP_PLUS
3137  fn = hist_field_plus
3138  Break
3139  Default
3140  ret = -EINVAL
3141  Go to free
3144  Return expr
3145  free :
3146  destroy_hist_field(operand1, 0)
3147  destroy_hist_field(operand2, 0)
3148  destroy_hist_field(expr, 0)
3150  Return ERR_PTR(ret)
Caller
NameDescribe
parse_unary
parse_expr
__create_val_field
create_key_field