[PATCH 03/11] SUNRPC: sysctl root for debug table introduced

From: Stanislav Kinsbursky
Date: Wed Dec 14 2011 - 05:48:12 EST


Sysctl root is required for handliong sysctl dentries per network namespace
context. IOW, it's "lookup" method will be used to find per-net sysctl's set in
further patches.
Also this patch modifies sysctl registering helpers to make them use new sysctl
root.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@xxxxxxxxxxxxx>

---
net/sunrpc/sysctl.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index 64c0034..f6e7da2 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -39,6 +39,9 @@ EXPORT_SYMBOL_GPL(nlm_debug);

#ifdef RPC_DEBUG

+#include <linux/nsproxy.h>
+#include <net/net_namespace.h>
+
static struct ctl_table_header *sunrpc_table_header;
static ctl_table debug_table[];

@@ -47,18 +50,24 @@ struct ctl_path sunrpc_path[] = {
{ },
};

+static struct ctl_table_root sunrpc_debug_root = {
+};
+
struct ctl_table_header *register_sunrpc_sysctl(struct ctl_table *table)
{
- return register_sysctl_paths(sunrpc_path, table);
-
+ return __register_sysctl_paths(&sunrpc_debug_root, current->nsproxy,
+ sunrpc_path, table);
}
EXPORT_SYMBOL_GPL(register_sunrpc_sysctl);

void
rpc_register_sysctl(void)
{
- if (!sunrpc_table_header)
+ if (!sunrpc_table_header) {
+ setup_sysctl_set(&sunrpc_debug_root.default_set, NULL, NULL);
+ register_sysctl_root(&sunrpc_debug_root);
sunrpc_table_header = register_sunrpc_sysctl(debug_table);
+ }
}

void
@@ -66,6 +75,7 @@ rpc_unregister_sysctl(void)
{
if (sunrpc_table_header) {
unregister_sysctl_table(sunrpc_table_header);
+ unregister_sysctl_root(&sunrpc_debug_root);
sunrpc_table_header = NULL;
}
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/