* [PATCH v2] scripts: check-sysctl-docs: adapt to new API @ 2023-12-26 11:34 ` Thomas Weißschuh 2024-01-15 15:49 ` Joel Granados 0 siblings, 1 reply; 4+ messages in thread From: Thomas Weißschuh @ 2023-12-26 11:34 UTC (permalink / raw) To: Luis Chamberlain, Joel Granados; +Cc: linux-kernel, Thomas Weißschuh 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. In its reference invocation the script won't be able to parse the tables from ipc/ipc_sysctl.c as they are using dynamically built tables which are to complex to parse. Note that the script is already prepared for a potential constification of the ctl_table structs. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- Changes in v2: - Remove unused global variable "paths" - Remove docs for deleted variables "children" and "paths" - Link to v1: https://lore.kernel.org/r/20231220-sysctl-check-v1-1-420ced4a69d7@weissschuh.net --- scripts/check-sysctl-docs | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/scripts/check-sysctl-docs b/scripts/check-sysctl-docs index 4f163e0bf6a4..739afd766708 100755 --- a/scripts/check-sysctl-docs +++ b/scripts/check-sysctl-docs @@ -8,7 +8,7 @@ # Example invocation: # scripts/check-sysctl-docs -vtable="kernel" \ # Documentation/admin-guide/sysctl/kernel.rst \ -# $(git grep -l register_sysctl_) +# $(git grep -l register_sysctl) # # Specify -vdebug=1 to see debugging information @@ -20,14 +20,10 @@ BEGIN { } # 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) # entries: maps ctl_table names and procnames to counts (so # enumerating the subkeys for a given ctl_table lists its # 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 # curentry: the name of the current proc entry (procname when parsing # a ctl_table, constructed path when parsing a ctl_path) @@ -94,44 +90,23 @@ FNR == NR { # Stage 2: process each file and find all sysctl tables BEGINFILE { - delete children delete entries - delete paths - curpath = "" curtable = "" curentry = "" if (debug) print "Processing file " FILENAME } -/^static struct ctl_path/ { - match($0, /static struct ctl_path ([^][]+)/, tables) - curpath = tables[1] - if (debug) print "Processing path " curpath -} - -/^static struct ctl_table/ { - match($0, /static struct ctl_table ([^][]+)/, tables) - curtable = tables[1] +/^static( const)? struct ctl_table/ { + match($0, /static( const)? struct ctl_table ([^][]+)/, tables) + curtable = tables[2] if (debug) print "Processing table " curtable } /^};$/ { - curpath = "" curtable = "" 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 ]*".+"/ { match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names) curentry = names[1] @@ -140,10 +115,14 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ { file[curentry] = FILENAME } -/\.child[\t ]*=/ { - child = trimpunct($NF) - if (debug) print "Linking child " child " to table " curtable " entry " curentry - children[curtable][curentry] = child +/register_sysctl.*/ { + match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables) + if (debug) print "Registering table " tables[3] " at " tables[2] + if (tables[2] == table) { + for (entry in entries[tables[3]]) { + printentry(entry) + } + } } END { --- base-commit: de2ee5e9405e12600c81e39837362800cee433a2 change-id: 20231220-sysctl-check-8802651d945d Best regards, -- Thomas Weißschuh <linux@weissschuh.net> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scripts: check-sysctl-docs: adapt to new API 2023-12-26 11:34 ` [PATCH v2] scripts: check-sysctl-docs: adapt to new API Thomas Weißschuh @ 2024-01-15 15:49 ` Joel Granados 2024-01-15 21:20 ` Thomas Weißschuh 0 siblings, 1 reply; 4+ messages in thread From: Joel Granados @ 2024-01-15 15:49 UTC (permalink / raw) To: Thomas Weißschuh; +Cc: Luis Chamberlain, linux-kernel [-- Attachment #1: Type: text/plain, Size: 4603 bytes --] Hey Thomas I lost track of the thread here. Did you get my latest answer to your V1? https://lore.kernel.org/all/20231231143455.tvwb464awfzv5uti@localhost/ Best On Tue, Dec 26, 2023 at 12:34:38PM +0100, Thomas Weißschuh wrote: > 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. > > In its reference invocation the script won't be able to parse the tables > from ipc/ipc_sysctl.c as they are using dynamically built tables which > are to complex to parse. > > Note that the script is already prepared for a potential constification > of the ctl_table structs. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > --- > Changes in v2: > - Remove unused global variable "paths" > - Remove docs for deleted variables "children" and "paths" > - Link to v1: https://lore.kernel.org/r/20231220-sysctl-check-v1-1-420ced4a69d7@weissschuh.net > --- > scripts/check-sysctl-docs | 45 ++++++++++++--------------------------------- > 1 file changed, 12 insertions(+), 33 deletions(-) > > diff --git a/scripts/check-sysctl-docs b/scripts/check-sysctl-docs > index 4f163e0bf6a4..739afd766708 100755 > --- a/scripts/check-sysctl-docs > +++ b/scripts/check-sysctl-docs > @@ -8,7 +8,7 @@ > # Example invocation: > # scripts/check-sysctl-docs -vtable="kernel" \ > # Documentation/admin-guide/sysctl/kernel.rst \ > -# $(git grep -l register_sysctl_) > +# $(git grep -l register_sysctl) > # > # Specify -vdebug=1 to see debugging information > > @@ -20,14 +20,10 @@ BEGIN { > } > > # 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) > # entries: maps ctl_table names and procnames to counts (so > # enumerating the subkeys for a given ctl_table lists its > # 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 > # curentry: the name of the current proc entry (procname when parsing > # a ctl_table, constructed path when parsing a ctl_path) > @@ -94,44 +90,23 @@ FNR == NR { > > # Stage 2: process each file and find all sysctl tables > BEGINFILE { > - delete children > delete entries > - delete paths > - curpath = "" > curtable = "" > curentry = "" > if (debug) print "Processing file " FILENAME > } > > -/^static struct ctl_path/ { > - match($0, /static struct ctl_path ([^][]+)/, tables) > - curpath = tables[1] > - if (debug) print "Processing path " curpath > -} > - > -/^static struct ctl_table/ { > - match($0, /static struct ctl_table ([^][]+)/, tables) > - curtable = tables[1] > +/^static( const)? struct ctl_table/ { > + match($0, /static( const)? struct ctl_table ([^][]+)/, tables) > + curtable = tables[2] > if (debug) print "Processing table " curtable > } > > /^};$/ { > - curpath = "" > curtable = "" > 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 ]*".+"/ { > match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names) > curentry = names[1] > @@ -140,10 +115,14 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ { > file[curentry] = FILENAME > } > > -/\.child[\t ]*=/ { > - child = trimpunct($NF) > - if (debug) print "Linking child " child " to table " curtable " entry " curentry > - children[curtable][curentry] = child > +/register_sysctl.*/ { > + match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables) > + if (debug) print "Registering table " tables[3] " at " tables[2] > + if (tables[2] == table) { > + for (entry in entries[tables[3]]) { > + printentry(entry) > + } > + } > } > > END { > > --- > base-commit: de2ee5e9405e12600c81e39837362800cee433a2 > change-id: 20231220-sysctl-check-8802651d945d > > Best regards, > -- > Thomas Weißschuh <linux@weissschuh.net> > -- Joel Granados [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [PATCH v2] scripts: check-sysctl-docs: adapt to new API 2024-01-15 15:49 ` Joel Granados @ 2024-01-15 21:20 ` Thomas Weißschuh 2024-01-21 19:40 ` Joel Granados 0 siblings, 1 reply; 4+ messages in thread From: Thomas Weißschuh @ 2024-01-15 21:20 UTC (permalink / raw) To: Joel Granados; +Cc: Luis Chamberlain, linux-kernel Hey Joel, On 2024-01-15 16:49:07+0100, Joel Granados wrote: > Hey Thomas > > I lost track of the thread here. Did you get my latest answer to your V1? > https://lore.kernel.org/all/20231231143455.tvwb464awfzv5uti@localhost/ I got your last anwer. Unfortunately I didn't find much time to work on my sysctl patches recently. It should improve in the near future, though. Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scripts: check-sysctl-docs: adapt to new API 2024-01-15 21:20 ` Thomas Weißschuh @ 2024-01-21 19:40 ` Joel Granados 0 siblings, 0 replies; 4+ messages in thread From: Joel Granados @ 2024-01-21 19:40 UTC (permalink / raw) To: Thomas Weißschuh; +Cc: Luis Chamberlain, linux-kernel [-- Attachment #1: Type: text/plain, Size: 591 bytes --] On Mon, Jan 15, 2024 at 10:20:37PM +0100, Thomas Weißschuh wrote: > Hey Joel, > > On 2024-01-15 16:49:07+0100, Joel Granados wrote: > > Hey Thomas > > > > I lost track of the thread here. Did you get my latest answer to your V1? > > https://lore.kernel.org/all/20231231143455.tvwb464awfzv5uti@localhost/ > > I got your last anwer. > > Unfortunately I didn't find much time to work on my sysctl patches > recently. It should improve in the near future, though. Understood. Looking forward to your next versions, when you get back to it :) Best -- Joel Granados [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 659 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-22 11:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20231226113448eucas1p2790755bc45518304822dc9b24c93c2a3@eucas1p2.samsung.com>
2023-12-26 11:34 ` [PATCH v2] scripts: check-sysctl-docs: adapt to new API Thomas Weißschuh
2024-01-15 15:49 ` Joel Granados
2024-01-15 21:20 ` Thomas Weißschuh
2024-01-21 19:40 ` Joel Granados
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®