aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/bpf_helpers_doc.py
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2018-05-17 08:43:56 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-05-17 11:34:43 -0400
commiteeacb7166df6ed1cffa923ea04c70043285783b8 (patch)
tree37bf2284966284cd02c6975e7841cc14aee90581 /scripts/bpf_helpers_doc.py
parentb9f672af148bf7a08a6031743156faffd58dbc7e (diff)
bpf: change eBPF helper doc parsing script to allow for smaller indent
Documentation for eBPF helpers can be parsed from bpf.h and eventually turned into a man page. Commit 6f96674dbd8c ("bpf: relax constraints on formatting for eBPF helper documentation") changed the script used to parse it, in order to allow for different indent style and to ease the work for writing documentation for future helpers. The script currently considers that the first tab can be replaced by 6 to 8 spaces. But the documentation for bpf_fib_lookup() uses a mix of tabs (for the "Description" part) and of spaces ("Return" part), and only has 5 space long indent for the latter. We probably do not want to change the values accepted by the script each time a new helper gets a new indent style. However, it is worth noting that with those 5 spaces, the "Description" and "Return" part *look* aligned in the generated patch and in `git show`, so it is likely other helper authors will use the same length. Therefore, allow for helper documentation to use 5 spaces only for the first indent level. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'scripts/bpf_helpers_doc.py')
-rwxr-xr-xscripts/bpf_helpers_doc.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/bpf_helpers_doc.py b/scripts/bpf_helpers_doc.py
index 8f59897fbda1..5010a4d5bfba 100755
--- a/scripts/bpf_helpers_doc.py
+++ b/scripts/bpf_helpers_doc.py
@@ -95,7 +95,7 @@ class HeaderParser(object):
95 return capture.group(1) 95 return capture.group(1)
96 96
97 def parse_desc(self): 97 def parse_desc(self):
98 p = re.compile(' \* ?(?:\t| {6,8})Description$') 98 p = re.compile(' \* ?(?:\t| {5,8})Description$')
99 capture = p.match(self.line) 99 capture = p.match(self.line)
100 if not capture: 100 if not capture:
101 # Helper can have empty description and we might be parsing another 101 # Helper can have empty description and we might be parsing another
@@ -109,7 +109,7 @@ class HeaderParser(object):
109 if self.line == ' *\n': 109 if self.line == ' *\n':
110 desc += '\n' 110 desc += '\n'
111 else: 111 else:
112 p = re.compile(' \* ?(?:\t| {6,8})(?:\t| {8})(.*)') 112 p = re.compile(' \* ?(?:\t| {5,8})(?:\t| {8})(.*)')
113 capture = p.match(self.line) 113 capture = p.match(self.line)
114 if capture: 114 if capture:
115 desc += capture.group(1) + '\n' 115 desc += capture.group(1) + '\n'
@@ -118,7 +118,7 @@ class HeaderParser(object):
118 return desc 118 return desc
119 119
120 def parse_ret(self): 120 def parse_ret(self):
121 p = re.compile(' \* ?(?:\t| {6,8})Return$') 121 p = re.compile(' \* ?(?:\t| {5,8})Return$')
122 capture = p.match(self.line) 122 capture = p.match(self.line)
123 if not capture: 123 if not capture:
124 # Helper can have empty retval and we might be parsing another 124 # Helper can have empty retval and we might be parsing another
@@ -132,7 +132,7 @@ class HeaderParser(object):
132 if self.line == ' *\n': 132 if self.line == ' *\n':
133 ret += '\n' 133 ret += '\n'
134 else: 134 else:
135 p = re.compile(' \* ?(?:\t| {6,8})(?:\t| {8})(.*)') 135 p = re.compile(' \* ?(?:\t| {5,8})(?:\t| {8})(.*)')
136 capture = p.match(self.line) 136 capture = p.match(self.line)
137 if capture: 137 if capture:
138 ret += capture.group(1) + '\n' 138 ret += capture.group(1) + '\n'