summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2025-02-10 11:18:07 +0100
committerJonathan Corbet <corbet@lwn.net>2025-02-10 11:19:57 -0700
commit2a21d80dfb4135b4766d8ff3231a3ea1c19bcc83 (patch)
tree0715cfdad627141e1e9414313e21cc491f53df4e /scripts/lib
parentcc93e4829a14339575383fb3cd7d3e858faabc2a (diff)
downloadlinux-stable-2a21d80dfb4135b4766d8ff3231a3ea1c19bcc83.tar.gz
linux-stable-2a21d80dfb4135b4766d8ff3231a3ea1c19bcc83.tar.bz2
linux-stable-2a21d80dfb4135b4766d8ff3231a3ea1c19bcc83.zip
scripts/get_abi.pl: Add filtering capabilities to rest output
This way, Sphinx ABI extension can parse symbols only once, while keep displaying results in separate files. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/41e108e816e46434aa596e5c0d25d227cb9f0fe5.1739182025.git.mchehab+huawei@kernel.org
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/abi/abi_parser.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/lib/abi/abi_parser.py b/scripts/lib/abi/abi_parser.py
index 1db6c54fc65a..b20d5c9d920e 100644
--- a/scripts/lib/abi/abi_parser.py
+++ b/scripts/lib/abi/abi_parser.py
@@ -160,6 +160,7 @@ class AbiParser:
self.data[fdata.key] = {
"what": [content],
"file": [fdata.file_ref],
+ "path": fdata.ftype,
"line_no": fdata.ln,
}
@@ -182,8 +183,6 @@ class AbiParser:
if new_what:
fdata.label = ""
- self.data[fdata.key]["type"] = fdata.ftype
-
if "description" in self.data[fdata.key]:
self.data[fdata.key]["description"] += "\n\n"
@@ -299,6 +298,7 @@ class AbiParser:
fdata.nametag = {}
fdata.nametag["what"] = [f"File {path}/{basename}"]
fdata.nametag["type"] = "File"
+ fdata.nametag["path"] = fdata.ftype
fdata.nametag["file"] = [fdata.file_ref]
fdata.nametag["line_no"] = 1
fdata.nametag["description"] = ""
@@ -427,7 +427,8 @@ class AbiParser:
return new_desc + "\n\n"
- def doc(self, output_in_txt=False, show_file=True):
+ def doc(self, output_in_txt=False, show_symbols=True, show_file=True,
+ filter_path=None):
"""Print ABI at stdout"""
part = None
@@ -435,12 +436,20 @@ class AbiParser:
key=lambda x: (x[1].get("type", ""),
x[1].get("what"))):
- wtype = v.get("type", "Var")
+ wtype = v.get("type", "Symbol")
file_ref = v.get("file")
names = v.get("what", [""])
- if not show_file and wtype == "File":
- continue
+ if wtype == "File":
+ if not show_file:
+ continue
+ else:
+ if not show_symbols:
+ continue
+
+ if filter_path:
+ if v.get("path") != filter_path:
+ continue
msg = ""