nfs: simplify two-level sysctl registration for nfs4_cb_sysctls
authorLuis Chamberlain <mcgrof@kernel.org>
Fri, 10 Mar 2023 22:58:41 +0000 (14:58 -0800)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 11 Apr 2023 14:18:18 +0000 (10:18 -0400)
There is no need to declare two tables to just create directories,
this can be easily be done with a prefix path with register_sysctl().

Simplify this registration.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4sysctl.c

index c394e4447100d7e25f61ec61d5129369dff4b8e5..e776200e9a115e7af40d989c79a1ec845007b9e9 100644 (file)
@@ -37,27 +37,10 @@ static struct ctl_table nfs4_cb_sysctls[] = {
        { }
 };
 
-static struct ctl_table nfs4_cb_sysctl_dir[] = {
-       {
-               .procname = "nfs",
-               .mode = 0555,
-               .child = nfs4_cb_sysctls,
-       },
-       { }
-};
-
-static struct ctl_table nfs4_cb_sysctl_root[] = {
-       {
-               .procname = "fs",
-               .mode = 0555,
-               .child = nfs4_cb_sysctl_dir,
-       },
-       { }
-};
-
 int nfs4_register_sysctl(void)
 {
-       nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root);
+       nfs4_callback_sysctl_table = register_sysctl("fs/nfs",
+                                                    nfs4_cb_sysctls);
        if (nfs4_callback_sysctl_table == NULL)
                return -ENOMEM;
        return 0;