Re: [PATCH 0/2] sysctl: Remove register_sysctl_table from sources

From: Luis Chamberlain
Date: Thu May 18 2023 - 16:46:59 EST


On Thu, May 18, 2023 at 06:07:03PM +0200, Joel Granados wrote:
> This is part of the general push to deprecate register_sysctl_paths and
> register_sysctl_table. This patchset completely removes register_sysctl_table
> and replaces it with register_sysctl effectively transitioning 5 base paths
> ("kernel", "vm", "fs", "dev" and "debug") to the new call. Besides removing the
> actuall function, I also removed it from the checks done in check-sysctl-docs.
>
> Testing for this change was done in the same way as with previous sysctl
> replacement patches: I made sure that the result of `find /proc/sys/ | sha1sum`
> was the same before and after the patchset.
>
> Have pushed this through 0-day. Waiting on results..
>
> Feedback greatly appreciated.

Thanks so much! I merged this to sysctl-testing as build tests are ongoing. But
I incorporated these minor changes to your first patch as register_sysctl_init()
is more obvious about when we cannot care about the return value.

If the build tests come through I'll push to sysctl-next.

diff --git a/fs/sysctls.c b/fs/sysctls.c
index 228420f5fe1b..76a0aee8c229 100644
--- a/fs/sysctls.c
+++ b/fs/sysctls.c
@@ -31,11 +31,7 @@ static struct ctl_table fs_shared_sysctls[] = {

static int __init init_fs_sysctls(void)
{
- /*
- * We do not check the return code for register_sysctl because the
- * original call to register_sysctl_base always returned 0.
- */
- register_sysctl("fs", fs_shared_sysctls);
+ register_sysctl_init("fs", fs_shared_sysctls);
return 0;
}

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f784b0fe5689..fa2aa8bd32b6 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2350,10 +2350,10 @@ static struct ctl_table dev_table[] = {

int __init sysctl_init_bases(void)
{
- register_sysctl("kernel", kern_table);
- register_sysctl("vm", vm_table);
- register_sysctl("debug", debug_table);
- register_sysctl("dev", dev_table);
+ register_sysctl_init("kernel", kern_table);
+ register_sysctl_init("vm", vm_table);
+ register_sysctl_init("debug", debug_table);
+ register_sysctl_init("dev", dev_table);

return 0;
}