scripts: check-sysctl-docs: handle per-namespace sysctls

Some sysctl tables are registered for each namespace.
(Like in ipc/ipc_sysctl.c)
These need special handling to track the variable assignments.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Joel Granados <j.granados@samsung.com>
Signed-off-by: Joel Granados <j.granados@samsung.com>
This commit is contained in:
Thomas Weißschuh 2024-02-19 21:19:24 +01:00 committed by Joel Granados
parent 8e88291043
commit 4f1136a55d

View File

@ -93,6 +93,7 @@ BEGINFILE {
delete entries delete entries
curtable = "" curtable = ""
curentry = "" curentry = ""
delete vars
if (debug) print "Processing file " FILENAME if (debug) print "Processing file " FILENAME
} }
@ -105,6 +106,7 @@ BEGINFILE {
/^};$/ { /^};$/ {
curtable = "" curtable = ""
curentry = "" curentry = ""
delete vars
} }
curtable && /\.procname[\t ]*=[\t ]*".+"/ { curtable && /\.procname[\t ]*=[\t ]*".+"/ {
@ -125,6 +127,24 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ {
} }
} }
/kmemdup.*/ {
match($0, /([^ \t]+) *= *kmemdup\(([^,]+) *,/, names)
if (debug) print "Found variable " names[1] " for table " names[2]
if (names[2] in entries) {
vars[names[1]] = names[2]
}
}
/__register_sysctl_table.*/ {
match($0, /__register_sysctl_table\([^,]+, *"([^"]+)" *, *([^,]+)/, tables)
if (debug) print "Registering variable table " tables[2] " at " tables[1]
if (tables[1] == table && tables[2] in vars) {
for (entry in entries[vars[tables[2]]]) {
printentry(entry)
}
}
}
END { END {
for (entry in documented) { for (entry in documented) {
if (!seen[entry]) { if (!seen[entry]) {