Skip to contentSkip to conversation

xfs: simplify two-level sysctl registration for xfs_table

PATCH In review Luis Chamberlain 2 participants 2 messages Mar 10, 2023 – Mar 12, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: simplify two-level sysctl registration for xfs_table

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.

---

This is not clear to some so I've updated the docs for the sysctl registration here:

https://lore.kernel.org/all/[email protected]/T/#u

 fs/xfs/xfs_sysctl.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
fs/xfs/xfs_sysctl.c +1 -19
index 546a6cd96729..fade33735393 100644
@@ -210,28 +210,10 @@ static struct ctl_table xfs_table[] = {
 	{}
 };
 
-static struct ctl_table xfs_dir_table[] = {
-	{
-		.procname	= "xfs",
-		.mode		= 0555,
-		.child		= xfs_table
-	},
-	{}
-};
-
-static struct ctl_table xfs_root_table[] = {
-	{
-		.procname	= "fs",
-		.mode		= 0555,
-		.child		= xfs_dir_table
-	},
-	{}
-};
-
 int
 xfs_sysctl_register(void)
 {
-	xfs_table_header = register_sysctl_table(xfs_root_table);
+	xfs_table_header = register_sysctl("fs/xfs", xfs_table);
 	if (!xfs_table_header)
 		return -ENOMEM;
 	return 0;
Signature · 1 line
2.39.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Luis Chamberlain

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.

---

Quoted 7 lines

This is not clear to some so I've updated the docs for the sysctl registration here:

https://lore.kernel.org/all/[email protected]/T/#u

 fs/xfs/xfs_sysctl.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

Looks fine.

Signature · 2 lines
Dave Chinner
[email protected]