Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:parse_field

Proto:static int parse_field(char *str, struct trace_event_call *call, struct ftrace_event_field **pf, u64 *pv)

Type:int

Parameter:

TypeParameterName
char *str
struct trace_event_call *call
struct ftrace_event_field **pf
u64 *pv
41  i = 0
45  If Not str[i] Then Return 0
48  When Note: isspace() must return false for %NUL-terminator (str[i]) cycle
49  i++
50  s = i
51  When isalnum(str[i]) || str[i] == '_' cycle
52  i++
53  len = i - s
54  If Not len Then Return -EINVAL
57  field_name = kmemdup_nul(str + s, len, GFP_KERNEL)
58  If Not field_name Then Return -ENOMEM
60  field = trace_find_event_field(call, field_name)
61  kfree(field_name)
62  If Not field Then Return -ENOENT
65  pf = field
66  When Note: isspace() must return false for %NUL-terminator (str[i]) cycle
67  i++
68  If str[i] != '=' Then Return -EINVAL
70  i++
71  When Note: isspace() must return false for %NUL-terminator (str[i]) cycle
72  i++
73  s = i
74  If isdigit(str[i]) || str[i] == '-' Then
79  If is_string_field(field) Then Return -EINVAL
82  If str[i] == '-' Then i++
86  When isalnum(str[i]) cycle
87  i++
88  num = str + s
89  c = str[i]
90  If c != '\0' && Not Note: isspace() must return false for %NUL-terminator (c) Then Return -EINVAL
92  str[i] = '\0'
94  If is_signed Then ret = kstrtoll - convert a string to a long long*@s: The start of the string. The string must be null-terminated, and may also* include a single newline before its terminating null. The first character* may also be a plus sign or a minus sign.
96  Else ret = kstrtoull - convert a string to an unsigned long long*@s: The start of the string. The string must be null-terminated, and may also* include a single newline before its terminating null. The first character* may also be a plus sign, but not a minus sign.
98  str[i] = c
99  If ret Then Return ret
102  pv = val
103  Return i
104  Else if str[i] == '\'' || str[i] == '"' Then
105  q = str[i]
108  If Not is_string_field(field) Then Return -EINVAL
111  When str[i] cycle
112  If str[i] == '\\' && str[i + 1] Then
113  i++
114  Continue
116  If str[i] == q Then Break
119  If Not str[i] Then Return -EINVAL
123  s++
124  len = i - s
125  If len >= Should handle KSYM_SYMBOL_LEN Then Return -EINVAL
128  pv = str + s
129  str[i] = 0
131  i++
132  Return i
135  Return -EINVAL
Caller
NameDescribe
parse_entryCaller is responsible to free the *pentry.