X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Fsunrpc%2Fsysctl.c;h=0f8c439b848a1eab04f0f21f2ea763863e424b2f;hb=8294fafdafc602ed11f401c44628fab8558c5cf5;hp=864b541bbf5171eb1a4b3338583af6dc2fe41c19;hpb=81f8320f624a785d77443ace83391d0fdee695f6;p=linux-2.6-omap-h63xx.git diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 864b541bbf5..0f8c439b848 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -18,14 +18,22 @@ #include #include #include +#include /* * 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 @@ -48,6 +56,30 @@ rpc_unregister_sysctl(void) } } +static int proc_do_xprt(ctl_table *table, int write, struct file *file, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + char tmpbuf[256]; + int len; + if ((*ppos && !write) || !*lenp) { + *lenp = 0; + return 0; + } + if (write) + return -EINVAL; + else { + len = svc_print_xprts(tmpbuf, sizeof(tmpbuf)); + if (!access_ok(VERIFY_WRITE, buffer, len)) + return -EFAULT; + + if (__copy_to_user(buffer, tmpbuf, len)) + return -EFAULT; + } + *lenp -= len; + *ppos += len; + return 0; +} + static int proc_dodebug(ctl_table *table, int write, struct file *file, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -87,9 +119,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; @@ -141,6 +172,12 @@ static ctl_table debug_table[] = { .mode = 0644, .proc_handler = &proc_dodebug }, + { + .procname = "transports", + .maxlen = 256, + .mode = 0444, + .proc_handler = &proc_do_xprt, + }, { .ctl_name = 0 } };