sysctl: remove "struct file *" argument of ->proc_handler
[safe/jmp/linux-2.6] / net / sunrpc / sysctl.c
index 1169798..42f9748 100644 (file)
 #include <linux/sunrpc/types.h>
 #include <linux/sunrpc/sched.h>
 #include <linux/sunrpc/stats.h>
+#include <linux/sunrpc/svc_xprt.h>
 
 /*
  * Declare the debug flags here
  */
 unsigned int   rpc_debug;
+EXPORT_SYMBOL_GPL(rpc_debug);
+
 unsigned int   nfs_debug;
+EXPORT_SYMBOL_GPL(nfs_debug);
+
 unsigned int   nfsd_debug;
+EXPORT_SYMBOL_GPL(nfsd_debug);
+
 unsigned int   nlm_debug;
+EXPORT_SYMBOL_GPL(nlm_debug);
 
 #ifdef RPC_DEBUG
 
@@ -36,7 +44,7 @@ void
 rpc_register_sysctl(void)
 {
        if (!sunrpc_table_header)
-               sunrpc_table_header = register_sysctl_table(sunrpc_table, 0);
+               sunrpc_table_header = register_sysctl_table(sunrpc_table);
 }
 
 void
@@ -48,8 +56,22 @@ rpc_unregister_sysctl(void)
        }
 }
 
+static int proc_do_xprt(ctl_table *table, int write,
+                       void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       char tmpbuf[256];
+       size_t len;
+
+       if ((*ppos && !write) || !*lenp) {
+               *lenp = 0;
+               return 0;
+       }
+       len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
+       return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
+}
+
 static int
-proc_dodebug(ctl_table *table, int write, struct file *file,
+proc_dodebug(ctl_table *table, int write,
                                void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        char            tmpbuf[20], c, *s;
@@ -87,9 +109,8 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
                        left--, s++;
                *(unsigned int *) table->data = value;
                /* Display the RPC tasks on writing to rpc_debug */
-               if (table->ctl_name == CTL_RPCDEBUG) {
+               if (strcmp(table->procname, "rpc_debug") == 0)
                        rpc_show_tasks();
-               }
        } else {
                if (!access_ok(VERIFY_WRITE, buffer, left))
                        return -EFAULT;
@@ -114,7 +135,6 @@ done:
 
 static ctl_table debug_table[] = {
        {
-               .ctl_name       = CTL_RPCDEBUG,
                .procname       = "rpc_debug",
                .data           = &rpc_debug,
                .maxlen         = sizeof(int),
@@ -122,7 +142,6 @@ static ctl_table debug_table[] = {
                .proc_handler   = &proc_dodebug
        },
        {
-               .ctl_name       = CTL_NFSDEBUG,
                .procname       = "nfs_debug",
                .data           = &nfs_debug,
                .maxlen         = sizeof(int),
@@ -130,7 +149,6 @@ static ctl_table debug_table[] = {
                .proc_handler   = &proc_dodebug
        },
        {
-               .ctl_name       = CTL_NFSDDEBUG,
                .procname       = "nfsd_debug",
                .data           = &nfsd_debug,
                .maxlen         = sizeof(int),
@@ -138,13 +156,18 @@ static ctl_table debug_table[] = {
                .proc_handler   = &proc_dodebug
        },
        {
-               .ctl_name       = CTL_NLMDEBUG,
                .procname       = "nlm_debug",
                .data           = &nlm_debug,
                .maxlen         = sizeof(int),
                .mode           = 0644,
                .proc_handler   = &proc_dodebug
        },
+       {
+               .procname       = "transports",
+               .maxlen         = 256,
+               .mode           = 0444,
+               .proc_handler   = &proc_do_xprt,
+       },
        { .ctl_name = 0 }
 };