Commit 0f6588b3 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Joel Granados

scripts: check-sysctl-docs: adapt to new API

The script expects the old sysctl_register_paths() API which was removed
some time ago. Adapt it to work with the new
sysctl_register()/sysctl_register_sz()/sysctl_register_init() APIs.
Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Reviewed-by: default avatarJoel Granados <j.granados@samsung.com>
Signed-off-by: default avatarJoel Granados <j.granados@samsung.com>
parent cec030ec
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# Example invocation: # Example invocation:
# scripts/check-sysctl-docs -vtable="kernel" \ # scripts/check-sysctl-docs -vtable="kernel" \
# Documentation/admin-guide/sysctl/kernel.rst \ # Documentation/admin-guide/sysctl/kernel.rst \
# $(git grep -l register_sysctl_) # $(git grep -l register_sysctl)
# #
# Specify -vdebug=1 to see debugging information # Specify -vdebug=1 to see debugging information
...@@ -20,14 +20,10 @@ BEGIN { ...@@ -20,14 +20,10 @@ BEGIN {
} }
# The following globals are used: # The following globals are used:
# children: maps ctl_table names and procnames to child ctl_table names
# documented: maps documented entries (each key is an entry) # documented: maps documented entries (each key is an entry)
# entries: maps ctl_table names and procnames to counts (so # entries: maps ctl_table names and procnames to counts (so
# enumerating the subkeys for a given ctl_table lists its # enumerating the subkeys for a given ctl_table lists its
# procnames) # procnames)
# files: maps procnames to source file names
# paths: maps ctl_path names to paths
# curpath: the name of the current ctl_path struct
# curtable: the name of the current ctl_table struct # curtable: the name of the current ctl_table struct
# curentry: the name of the current proc entry (procname when parsing # curentry: the name of the current proc entry (procname when parsing
# a ctl_table, constructed path when parsing a ctl_path) # a ctl_table, constructed path when parsing a ctl_path)
...@@ -94,44 +90,23 @@ FNR == NR { ...@@ -94,44 +90,23 @@ FNR == NR {
# Stage 2: process each file and find all sysctl tables # Stage 2: process each file and find all sysctl tables
BEGINFILE { BEGINFILE {
delete children
delete entries delete entries
delete paths
curpath = ""
curtable = "" curtable = ""
curentry = "" curentry = ""
if (debug) print "Processing file " FILENAME if (debug) print "Processing file " FILENAME
} }
/^static struct ctl_path/ { /^static( const)? struct ctl_table/ {
match($0, /static struct ctl_path ([^][]+)/, tables) match($0, /static( const)? struct ctl_table ([^][]+)/, tables)
curpath = tables[1] curtable = tables[2]
if (debug) print "Processing path " curpath
}
/^static struct ctl_table/ {
match($0, /static struct ctl_table ([^][]+)/, tables)
curtable = tables[1]
if (debug) print "Processing table " curtable if (debug) print "Processing table " curtable
} }
/^};$/ { /^};$/ {
curpath = ""
curtable = "" curtable = ""
curentry = "" curentry = ""
} }
curpath && /\.procname[\t ]*=[\t ]*".+"/ {
match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names)
if (curentry) {
curentry = curentry "/" names[1]
} else {
curentry = names[1]
}
if (debug) print "Setting path " curpath " to " curentry
paths[curpath] = curentry
}
curtable && /\.procname[\t ]*=[\t ]*".+"/ { curtable && /\.procname[\t ]*=[\t ]*".+"/ {
match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names) match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names)
curentry = names[1] curentry = names[1]
...@@ -140,10 +115,14 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ { ...@@ -140,10 +115,14 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ {
file[curentry] = FILENAME file[curentry] = FILENAME
} }
/\.child[\t ]*=/ { /register_sysctl.*/ {
child = trimpunct($NF) match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables)
if (debug) print "Linking child " child " to table " curtable " entry " curentry if (debug) print "Registering table " tables[3] " at " tables[2]
children[curtable][curentry] = child if (tables[2] == table) {
for (entry in entries[tables[3]]) {
printentry(entry)
}
}
} }
END { END {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment