@@ -59,9 +59,9 @@ def proto_break_down(self):
59
59
Break down helper function protocol into smaller chunks: return type,
60
60
name, distincts arguments.
61
61
"""
62
- arg_re = re .compile ('((\w+ )*?(\w+|...))( (\**)(\w+))?$' )
62
+ arg_re = re .compile (r '((\w+ )*?(\w+|...))( (\**)(\w+))?$' )
63
63
res = {}
64
- proto_re = re .compile ('(.+) (\**)(\w+)\(((([^,]+)(, )?){1,5})\)$' )
64
+ proto_re = re .compile (r '(.+) (\**)(\w+)\(((([^,]+)(, )?){1,5})\)$' )
65
65
66
66
capture = proto_re .match (self .proto )
67
67
res ['ret_type' ] = capture .group (1 )
@@ -114,11 +114,11 @@ def parse_helper(self):
114
114
return Helper (proto = proto , desc = desc , ret = ret )
115
115
116
116
def parse_symbol (self ):
117
- p = re .compile (' \* ?(BPF\w+)$' )
117
+ p = re .compile (r ' \* ?(BPF\w+)$' )
118
118
capture = p .match (self .line )
119
119
if not capture :
120
120
raise NoSyscallCommandFound
121
- end_re = re .compile (' \* ?NOTES$' )
121
+ end_re = re .compile (r ' \* ?NOTES$' )
122
122
end = end_re .match (self .line )
123
123
if end :
124
124
raise NoSyscallCommandFound
@@ -133,15 +133,15 @@ def parse_proto(self):
133
133
# - Same as above, with "const" and/or "struct" in front of type
134
134
# - "..." (undefined number of arguments, for bpf_trace_printk())
135
135
# There is at least one term ("void"), and at most five arguments.
136
- p = re .compile (' \* ?((.+) \**\w+\((((const )?(struct )?(\w+|\.\.\.)( \**\w+)?)(, )?){1,5}\))$' )
136
+ p = re .compile (r ' \* ?((.+) \**\w+\((((const )?(struct )?(\w+|\.\.\.)( \**\w+)?)(, )?){1,5}\))$' )
137
137
capture = p .match (self .line )
138
138
if not capture :
139
139
raise NoHelperFound
140
140
self .line = self .reader .readline ()
141
141
return capture .group (1 )
142
142
143
143
def parse_desc (self , proto ):
144
- p = re .compile (' \* ?(?:\t | {5,8})Description$' )
144
+ p = re .compile (r ' \* ?(?:\t| {5,8})Description$' )
145
145
capture = p .match (self .line )
146
146
if not capture :
147
147
raise Exception ("No description section found for " + proto )
@@ -154,7 +154,7 @@ def parse_desc(self, proto):
154
154
if self .line == ' *\n ' :
155
155
desc += '\n '
156
156
else :
157
- p = re .compile (' \* ?(?:\t | {5,8})(?:\t | {8})(.*)' )
157
+ p = re .compile (r ' \* ?(?:\t| {5,8})(?:\t| {8})(.*)' )
158
158
capture = p .match (self .line )
159
159
if capture :
160
160
desc_present = True
@@ -167,7 +167,7 @@ def parse_desc(self, proto):
167
167
return desc
168
168
169
169
def parse_ret (self , proto ):
170
- p = re .compile (' \* ?(?:\t | {5,8})Return$' )
170
+ p = re .compile (r ' \* ?(?:\t| {5,8})Return$' )
171
171
capture = p .match (self .line )
172
172
if not capture :
173
173
raise Exception ("No return section found for " + proto )
@@ -180,7 +180,7 @@ def parse_ret(self, proto):
180
180
if self .line == ' *\n ' :
181
181
ret += '\n '
182
182
else :
183
- p = re .compile (' \* ?(?:\t | {5,8})(?:\t | {8})(.*)' )
183
+ p = re .compile (r ' \* ?(?:\t| {5,8})(?:\t| {8})(.*)' )
184
184
capture = p .match (self .line )
185
185
if capture :
186
186
ret_present = True
@@ -219,12 +219,12 @@ def parse_enum_syscall(self):
219
219
self .seek_to ('enum bpf_cmd {' ,
220
220
'Could not find start of bpf_cmd enum' , 0 )
221
221
# Searches for either one or more BPF\w+ enums
222
- bpf_p = re .compile ('\s*(BPF\w+)+' )
222
+ bpf_p = re .compile (r '\s*(BPF\w+)+' )
223
223
# Searches for an enum entry assigned to another entry,
224
224
# for e.g. BPF_PROG_RUN = BPF_PROG_TEST_RUN, which is
225
225
# not documented hence should be skipped in check to
226
226
# determine if the right number of syscalls are documented
227
- assign_p = re .compile ('\s*(BPF\w+)\s*=\s*(BPF\w+)' )
227
+ assign_p = re .compile (r '\s*(BPF\w+)\s*=\s*(BPF\w+)' )
228
228
bpf_cmd_str = ''
229
229
while True :
230
230
capture = assign_p .match (self .line )
@@ -239,7 +239,7 @@ def parse_enum_syscall(self):
239
239
break
240
240
self .line = self .reader .readline ()
241
241
# Find the number of occurences of BPF\w+
242
- self .enum_syscalls = re .findall ('(BPF\w+)+' , bpf_cmd_str )
242
+ self .enum_syscalls = re .findall (r '(BPF\w+)+' , bpf_cmd_str )
243
243
244
244
def parse_desc_helpers (self ):
245
245
self .seek_to (helpersDocStart ,
@@ -263,7 +263,7 @@ def parse_define_helpers(self):
263
263
self .seek_to ('#define ___BPF_FUNC_MAPPER(FN, ctx...)' ,
264
264
'Could not find start of eBPF helper definition list' )
265
265
# Searches for one FN(\w+) define or a backslash for newline
266
- p = re .compile ('\s*FN\((\w+), (\d+), ##ctx\)|\\ \\ ' )
266
+ p = re .compile (r '\s*FN\((\w+), (\d+), ##ctx\)|\\\\' )
267
267
fn_defines_str = ''
268
268
i = 0
269
269
while True :
@@ -278,7 +278,7 @@ def parse_define_helpers(self):
278
278
break
279
279
self .line = self .reader .readline ()
280
280
# Find the number of occurences of FN(\w+)
281
- self .define_unique_helpers = re .findall ('FN\(\w+, \d+, ##ctx\)' , fn_defines_str )
281
+ self .define_unique_helpers = re .findall (r 'FN\(\w+, \d+, ##ctx\)' , fn_defines_str )
282
282
283
283
def validate_helpers (self ):
284
284
last_helper = ''
@@ -425,7 +425,7 @@ def get_last_doc_update(self, delimiter):
425
425
try :
426
426
cmd = ['git' , 'log' , '-1' , '--pretty=format:%cs' , '--no-patch' ,
427
427
'-L' ,
428
- '/{}/,/\* \//:include/uapi/linux/bpf.h' .format (delimiter )]
428
+ '/{}/,/\\ * \ \ //:include/uapi/linux/bpf.h' .format (delimiter )]
429
429
date = subprocess .run (cmd , cwd = linuxRoot ,
430
430
capture_output = True , check = True )
431
431
return date .stdout .decode ().rstrip ()
@@ -516,7 +516,7 @@ def print_footer(self):
516
516
programs that are compatible with the GNU Privacy License (GPL).
517
517
518
518
In order to use such helpers, the eBPF program must be loaded with the correct
519
- license string passed (via **attr**) to the **bpf**\ () system call, and this
519
+ license string passed (via **attr**) to the **bpf**\\ () system call, and this
520
520
generally translates into the C source code of the program containing a line
521
521
similar to the following:
522
522
@@ -550,7 +550,7 @@ def print_footer(self):
550
550
* The bpftool utility can be used to probe the availability of helper functions
551
551
on the system (as well as supported program and map types, and a number of
552
552
other parameters). To do so, run **bpftool feature probe** (see
553
- **bpftool-feature**\ (8) for details). Add the **unprivileged** keyword to
553
+ **bpftool-feature**\\ (8) for details). Add the **unprivileged** keyword to
554
554
list features available to unprivileged users.
555
555
556
556
Compatibility between helper functions and program types can generally be found
@@ -562,23 +562,23 @@ def print_footer(self):
562
562
requirement for GPL license is also in those **struct bpf_func_proto**.
563
563
564
564
Compatibility between helper functions and map types can be found in the
565
- **check_map_func_compatibility**\ () function in file *kernel/bpf/verifier.c*.
565
+ **check_map_func_compatibility**\\ () function in file *kernel/bpf/verifier.c*.
566
566
567
567
Helper functions that invalidate the checks on **data** and **data_end**
568
568
pointers for network processing are listed in function
569
- **bpf_helper_changes_pkt_data**\ () in file *net/core/filter.c*.
569
+ **bpf_helper_changes_pkt_data**\\ () in file *net/core/filter.c*.
570
570
571
571
SEE ALSO
572
572
========
573
573
574
- **bpf**\ (2),
575
- **bpftool**\ (8),
576
- **cgroups**\ (7),
577
- **ip**\ (8),
578
- **perf_event_open**\ (2),
579
- **sendmsg**\ (2),
580
- **socket**\ (7),
581
- **tc-bpf**\ (8)'''
574
+ **bpf**\\ (2),
575
+ **bpftool**\\ (8),
576
+ **cgroups**\\ (7),
577
+ **ip**\\ (8),
578
+ **perf_event_open**\\ (2),
579
+ **sendmsg**\\ (2),
580
+ **socket**\\ (7),
581
+ **tc-bpf**\\ (8)'''
582
582
print (footer )
583
583
584
584
def print_proto (self , helper ):
@@ -598,7 +598,7 @@ def print_proto(self, helper):
598
598
one_arg = '{}{}' .format (comma , a ['type' ])
599
599
if a ['name' ]:
600
600
if a ['star' ]:
601
- one_arg += ' {}**\ ' .format (a ['star' ].replace ('*' , '\\ *' ))
601
+ one_arg += ' {}**\\ ' .format (a ['star' ].replace ('*' , '\\ *' ))
602
602
else :
603
603
one_arg += '** '
604
604
one_arg += '*{}*\\ **' .format (a ['name' ])
0 commit comments