Skip to content

Commit

Permalink
nfs: simplify two-level sysctl registration for nfs_cb_sysctls
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
  • Loading branch information
mcgrof committed Apr 13, 2023
1 parent d2235a7 commit a2189b7
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions fs/nfs/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,9 @@ static struct ctl_table nfs_cb_sysctls[] = {
{ }
};

static struct ctl_table nfs_cb_sysctl_dir[] = {
{
.procname = "nfs",
.mode = 0555,
.child = nfs_cb_sysctls,
},
{ }
};

static struct ctl_table nfs_cb_sysctl_root[] = {
{
.procname = "fs",
.mode = 0555,
.child = nfs_cb_sysctl_dir,
},
{ }
};

int nfs_register_sysctl(void)
{
nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
nfs_callback_sysctl_table = register_sysctl("fs/nfs", nfs_cb_sysctls);
if (nfs_callback_sysctl_table == NULL)
return -ENOMEM;
return 0;
Expand Down

0 comments on commit a2189b7

Please sign in to comment.