Re: [PATCH v2] sysctl: treewide: constify the ctl_table argument of proc_handlers
From: Thomas Weißschuh
Date: Mon Jul 15 2024 - 16:58:30 EST
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
> On Wed, Jun 19, 2024 at 12:09:00PM +0200, Thomas Weißschuh wrote:
> > Adapt the proc_hander function signature to make it clear that handlers
> > are not supposed to modify their ctl_table argument.
> >
> > This is also a prerequisite to moving the static ctl_table structs into
> > read-only data.
> >
> > The patch was mostly generated by coccinelle with the following script:
> >
> > @@
> > identifier func, ctl, write, buffer, lenp, ppos;
> > @@
> >
> > int func(
> > - struct ctl_table *ctl,
> > + const struct ctl_table *ctl,
> > int write, void *buffer, size_t *lenp, loff_t *ppos)
> > { ... }
> >
> > In addition to the scripted changes some other changes are done:
> >
> > * The "typedef proc_handler" in include/linux/sysctl.h is changed to use
> > the "const ctl_table".
> >
> > * The prototypes of non-static handlers in header-files are adapted
> > to match the changes of their respective definitions.
> >
> > * kernel/watchdog.c: proc_watchdog_common()
> > This is called from a proc_handler itself and is als calling back
> > into another proc_handler, making it necessary to change it as part
> > of the proc_handler migration.
> >
> > No functional change.
> >
> > Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> > ---
>
> The merge window is now open. I want to send this patch on the Wednesday
> of next week (jul 24).
Sounds good.
> @Thomas: Some questions
>
> 1. Are there any updates?
No.
> 2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires the
net/ and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge
conflicts or the preparation commits are missing, leading to compilation
errors.
> 3. Are you able to do the last update at the beginning of next week (Jul
> 22)?
Sure.
Thomas