linux/net/sunrpc/sysctl.c
<<
alue2.1/spav2. 2.1/form2. 2.1a alue2. href="../linux+v3.329/net/sunrpc/sysctl.c">alue2.1img src="../.static/gfx/right.png" alt=">>">al1/spav2.al1spav class="lxr_search">aluealue2.1input typ hidden" nam navtarget" on> ">alue2.1input typ text" nam search" id search">alue2.1buttptityp submit">Searchalue2.Prefs. 2.1/a>al1/spav2.ue2. .1/div2.ue2. .1form ac v="ajax+*" method="post" onsubmit="return false;">al1input typ hidden" nam ajax_lookup" id ajax_lookup" on> ">aue2. .1/form2.aue2. .1div class="headingbottpm">. 1div id file_contents"2
. .11/a>1spav class="comment">/*1/spav2.. .21/a>1spav class="comment"> * linux/net/sunrpc/sysctl.c1/spav2.. .31/a>1spav class="comment"> *1/spav2.. .41/a>1spav class="comment"> * Sysctl interface to sunrpc module.1/spav2.. .51/a>1spav class="comment"> *1/spav2.. .61/a>1spav class="comment"> * I would prefer to register the sunrpc table below sys/net, but that's1/spav2.. .71/a>1spav class="comment"> * impossible at the moment.1/spav2.. .81/a>1spav class="comment"> */1/spav2.. .91/a>a. 
	  a>#include <linux/typ s.h  a>>a. 11  a>#include <linux/linkage.h  a>>a. 12  a>#include <linux/ctyp .h  a>>a. 13  a>#include <linux/fs.h  a>>a. 14  a>#include <linux/sysctl.h  a>>a. 15  a>#include <linux/module.h  a>>a. 161/a>a. 17  a>#include <asm/uaccess.h  a>>a. 18  a>#include <linux/sunrpc/typ s.h  a>>a. 19  a>#include <linux/sunrpc/sched.h  a>>a. 2	  a>#include <linux/sunrpc/stats.h  a>>a. 21  a>#include <linux/sunrpc/svc_xprt.h  a>>a. 221/a>a. 23  a>#include "netns.h  a>"a. 241/a>a. 251/a>1spav class="comment">/*1/spav2.. 261/a>1spav class="comment"> * Declare the debug flags here1/spav2.. 271/a>1spav class="comment"> */1/spav2.. 28  a>unsigned int2. .1a href="+code=rpc_debug" class="sref">rpc_debug  a>;a. 29  a>1a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL  a>(1a href="+code=rpc_debug" class="sref">rpc_debug  a>);a. 301/a>a. 31  a>unsigned int2. .1a href="+code=nfs_debug" class="sref">nfs_debug  a>;a. 32  a>1a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL  a>(1a href="+code=nfs_debug" class="sref">nfs_debug  a>);a. 331/a>a. 34  a>unsigned int2. .1a href="+code=nfsd_debug" class="sref">nfsd_debug  a>;a. 35  a>1a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL  a>(1a href="+code=nfsd_debug" class="sref">nfsd_debug  a>);a. 361/a>a. 37  a>unsigned int2. .1a href="+code=nlm_debug" class="sref">nlm_debug  a>;a. 38  a>1a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL  a>(1a href="+code=nlm_debug" class="sref">nlm_debug  a>);a. 391/a>a. 4	  a>#ifdef.1a href="+code=RPC_DEBUG" class="sref">RPC_DEBUG1/a>a. 411/a>a. 42  a>static struct.1a href="+code=ctl_table_header" class="sref">ctl_table_header  a> *1a href="+code=sunrpc_table_header" class="sref">sunrpc_table_header  a>;a. 43  a>static 1a href="+code=ctl_table" class="sref">ctl_table  a>                1a href="+code=sunrpc_table" class="sref">sunrpc_table  a>[];a. 441/a>a. 45  a>voida. 46  a>1a href="+code=rpc_register_sysctl" class="sref">rpc_register_sysctl  a>(void)a. 47  a>{a. 48  a>        if (!1a href="+code=sunrpc_table_header" class="sref">sunrpc_table_header  a>)a. 49  a>                1a href="+code=sunrpc_table_header" class="sref">sunrpc_table_header  a> =.1a href="+code=register_sysctl_table" class="sref">register_sysctl_table  a>(1a href="+code=sunrpc_table" class="sref">sunrpc_table  a>);a. 5	  a>}a. 511/a>a. 52  a>voida. 53  a>1a href="+code=rpc_unregister_sysctl" class="sref">rpc_unregister_sysctl  a>(void)a. 54  a>{a. 55  a>        if (1a href="+code=sunrpc_table_header" class="sref">sunrpc_table_header  a>) {a. 56  a>                1a href="+code=unregister_sysctl_table" class="sref">unregister_sysctl_table  a>(1a href="+code=sunrpc_table_header" class="sref">sunrpc_table_header  a>);a. 57  a>                1a href="+code=sunrpc_table_header" class="sref">sunrpc_table_header  a> =.1a href="+code=NULL" class="sref">NULL  a>;a. 58  a>        }a. 59  a>}a. 601/a>a. 61  a>static int21a href="+code=proc_do_xprt" class="sref">proc_do_xprt  a>(1a href="+code=ctl_table" class="sref">ctl_table  a> *1a href="+code=table" class="sref">table  a>, int21a href="+code=write" class="sref">write  a>,a. 62  a>                        void21a href="+code=__user" class="sref">__user  a> *1a href="+code=buffer" class="sref">buffer  a>, 1a href="+code=size_t" class="sref">size_t  a> *1a href="+code=lenp" class="sref">lenp  a>, 1a href="+code=loff_t" class="sref">loff_t  a> *1a href="+code=ppos" class="sref">ppos  a>)a. 63  a>{a. 64  a>        char 1a href="+code=tmpbuf" class="sref">tmpbuf  a>[256];a. 65  a>        1a href="+code=size_t" class="sref">size_t  a> 1a href="+code=len" class="sref">len  a>;a. 661/a>a. 67  a>        if ((*1a href="+code=ppos" class="sref">ppos  a> && !1a href="+code=write" class="sref">write  a>) || !*1a href="+code=lenp" class="sref">lenp  a>) {a. 68  a>                *1a href="+code=lenp" class="sref">lenp  a> =.0;a. 69  a>                return 0;a. 70  a>        }a. 71  a>        1a href="+code=len" class="sref">len  a> =.1a href="+code=svc_print_xprts" class="sref">svc_print_xprts  a>(1a href="+code=tmpbuf" class="sref">tmpbuf  a>, sizeof(1a href="+code=tmpbuf" class="sref">tmpbuf  a>));a. 72  a>        return 1a href="+code=simple_read_from_buffer" class="sref">simple_read_from_buffer  a>(1a href="+code=buffer" class="sref">buffer  a>, *1a href="+code=lenp" class="sref">lenp  a>, 1a href="+code=ppos" class="sref">ppos  a>, 1a href="+code=tmpbuf" class="sref">tmpbuf  a>, 1a href="+code=len" class="sref">len  a>);a. 73  a>}a. 741/a>a. 75  a>static inta. 76  a>1a href="+code=proc_dodebug" class="sref">proc_dodebug  a>(1a href="+code=ctl_table" class="sref">ctl_table  a> *1a href="+code=table" class="sref">table  a>, int21a href="+code=write" class="sref">write  a>,a. 77  a>                                void21a href="+code=__user" class="sref">__user  a> *1a href="+code=buffer" class="sref">buffer  a>, 1a href="+code=size_t" class="sref">size_t  a> *1a href="+code=lenp" class="sref">lenp  a>, 1a href="+code=loff_t" class="sref">loff_t  a> *1a href="+code=ppos" class="sref">ppos  a>)a. 78  a>{a. 79  a>        char            1a href="+code=tmpbuf" class="sref">tmpbuf  a>[20], 1a href="+code=c" class="sref">c  a>, *1a href="+code=s" class="sref">s  a>;a. 80  a>        char 1a href="+code=__user" class="sref">__user  a> *1a href="+code=p" class="sref">p  a>;a. 81  a>        unsigned int2. .1a href="+code=on>
 " class="sref">on>
   a>;a. 82  a>        1a href="+code=size_t" class="sref">size_t  a>          1a href="+code=left" class="sref">left  a>, 1a href="+code=len" class="sref">len  a>;a. 831/a>a. 84  a>        if ((*1a href="+code=ppos" class="sref">ppos  a> && !1a href="+code=write" class="sref">write  a>) || !*1a href="+code=lenp" class="sref">lenp  a>) {a. 85  a>                *1a href="+code=lenp" class="sref">lenp  a> =.0;a. 86  a>                return 0;a. 87  a>        }a. 881/a>a. 89  a>        1a href="+code=left" class="sref">left  a> =.*1a href="+code=lenp" class="sref">lenp  a>;a. 901/a>a. 91  a>        if (1a href="+code=write" class="sref">write  a>) {a. 92  a>                if (!1a href="+code=access_ok" class="sref">access_ok  a>(1a href="+code=VERIFY_READ" class="sref">VERIFY_READ  a>, 1a href="+code=buffer" class="sref">buffer  a>, 1a href="+code=left" class="sref">left  a>))a. 93  a>                        return -1a href="+code=EFAULT" class="sref">EFAULT  a>;a. 94  a>                1a href="+code=p" class="sref">p  a> =.1a href="+code=buffer" class="sref">buffer  a>;a. 95  a>                while (1a href="+code=left" class="sref">left  a> && 1a href="+code=__get_user" class="sref">__get_user  a>(1a href="+code=c" class="sref">c  a>, 1a href="+code=p" class="sref">p  a>) >=.0 && 1a href="+code=isspace" class="sref">isspace  a>(1a href="+code=c" class="sref">c  a>))a. 96  a>                        1a href="+code=left" class="sref">left  a>--, 1a href="+code=p" class="sref">p  a>++;a. 97  a>                if (!1a href="+code=left" class="sref">left  a>)a. 98  a>                        goto 1a href="+code=done" class="sref">done  a>;a. 991/a>a.100  a>                if (1a href="+code=left" class="sref">left  a> > sizeof(1a href="+code=tmpbuf" class="sref">tmpbuf  a>) - 1)a.101  a>                        return -1a href="+code=EINVAL" class="sref">EINVAL  a>;a.102  a>                if (1a href="+code=copy_from_user" class="sref">copy_from_user  a>(1a href="+code=tmpbuf" class="sref">tmpbuf  a>, 1a href="+code=p" class="sref">p  a>, 1a href="+code=left" class="sref">left  a>))a.103  a>                        return -1a href="+code=EFAULT" class="sref">EFAULT  a>;a.104  a>                1a href="+code=tmpbuf" class="sref">tmpbuf  a>[1a href="+code=left" class="sref">left  a>] =.1spav class="string">'\0'1/spav2;a.1051/a>a.106  a>                for (1a href="+code=s" class="sref">s  a> =.1a href="+code=tmpbuf" class="sref">tmpbuf  a>, 1a href="+code=on>
 " class="sref">on>
   a> =.0;.1spav class="string">'0'1/spav2 <=.*1a href="+code=s" class="sref">s  a> && *1a href="+code=s" class="sref">s  a> <=.1spav class="string">'9'1/spav2; 1a href="+code=s" class="sref">s  a>++, 1a href="+code=left" class="sref">left  a>--)a.107  a>                        1a href="+code=on>
 " class="sref">on>
   a> =.10 * 1a href="+code=on>
 " class="sref">on>
   a> + (*1a href="+code=s" class="sref">s  a> -.1spav class="string">'0'1/spav2);a.108  a>                if (*1a href="+code=s" class="sref">s  a> && !1a href="+code=isspace" class="sref">isspace  a>(*1a href="+code=s" class="sref">s  a>))a.109  a>                        return -1a href="+code=EINVAL" class="sref">EINVAL  a>;a.110  a>                while (1a href="+code=left" class="sref">left  a> && 1a href="+code=isspace" class="sref">isspace  a>(*1a href="+code=s" class="sref">s  a>))a.111  a>                        1a href="+code=left" class="sref">left  a>--, 1a href="+code=s" class="sref">s  a>++;a.112  a>                *(unsigned int2*).1a href="+code=table" class="sref">table  a>->1a href="+code=data" class="sref">data  a> =.1a href="+code=on>
 " class="sref">on>
   a>;a.113  a>                1spav class="comment">/* Display the RPC tasks on writing to rpc_debug */1/spav2..114  a>                if (1a href="+code=strcmp" class="sref">strcmp  a>(1a href="+code=table" class="sref">table  a>->1a href="+code=procnam " class="sref">procnam   a>, 1spav class="string">"rpc_debug".115  a>                        1a href="+code=rpc_show_tasks" class="sref">rpc_show_tasks  a>(&1a href="+code=init_net" class="sref">init_net  a>);a.116  a>        } else {a.117  a>                if (!1a href="+code=access_ok" class="sref">access_ok  a>(1a href="+code=VERIFY_WRITE" class="sref">VERIFY_WRITE  a>, 1a href="+code=buffer" class="sref">buffer  a>, 1a href="+code=left" class="sref">left  a>))a.118  a>                        return -1a href="+code=EFAULT" class="sref">EFAULT  a>;a.119  a>                1a href="+code=len" class="sref">len  a> =.1a href="+code=sprintf" class="sref">sprintf  a>(1a href="+code=tmpbuf" class="sref">tmpbuf  a>, 1spav class="string">"%d"table  a>->1a href="+code=data" class="sref">data  a>);a.120  a>                if (1a href="+code=len" class="sref">len  a> > 1a href="+code=left" class="sref">left  a>)a.121  a>                        1a href="+code=len" class="sref">len  a> =.1a href="+code=left" class="sref">left  a>;a.122  a>                if (1a href="+code=__copy_to_user" class="sref">__copy_to_user  a>(1a href="+code=buffer" class="sref">buffer  a>, 1a href="+code=tmpbuf" class="sref">tmpbuf  a>, 1a href="+code=len" class="sref">len  a>))a.123  a>                        return -1a href="+code=EFAULT" class="sref">EFAULT  a>;a.124  a>                if ((1a href="+code=left" class="sref">left  a> -=.1a href="+code=len" class="sref">len  a>) > 0) {a.125  a>                        if (1a href="+code=put_user" class="sref">put_user  a>(1spav class="string">'\n'1/spav2, (char 1a href="+code=__user" class="sref">__user  a> *)1a href="+code=buffer" class="sref">buffer  a> + 1a href="+code=len" class="sref">len  a>))a.126  a>                                return -1a href="+code=EFAULT" class="sref">EFAULT  a>;a.127  a>                        1a href="+code=left" class="sref">left  a>--;a.128  a>                }a.129  a>        }a.1301/a>a.131  a>1a href="+code=done" class="sref">done  a>:a.132  a>        *1a href="+code=lenp" class="sref">lenp  a> -=.1a href="+code=left" class="sref">left  a>;a.133  a>        *1a href="+code=ppos" class="sref">ppos  a> +=.*1a href="+code=lenp" class="sref">lenp  a>;a.134  a>        return 0;a.135  a>}a.1361/a>a.137  a>a.138  a>static 1a href="+code=ctl_table" class="sref">ctl_table  a> 1a href="+code=debug_table" class="sref">debug_table  a>[] =.{a.139  a>        {a.140  a>                .1a href="+code=procnam " class="sref">procnam   a>       =.1spav class="string">"rpc_debug".141  a>                .1a href="+code=data" class="sref">data  a>           = &1a href="+code=rpc_debug" class="sref">rpc_debug  a>,a.142  a>                .1a href="+code=maxlen" class="sref">maxlen  a>         = sizeof(int),a.143  a>                .1a href="+code=mode" class="sref">mode  a>           = 0644,a.144  a>                .1a href="+code=proc_handler" class="sref">proc_handler  a>   =.1a href="+code=proc_dodebug" class="sref">proc_dodebug  a>a.145  a>        },a.146  a>        {a.147  a>                .1a href="+code=procnam " class="sref">procnam   a>       =.1spav class="string">"nfs_debug".148  a>                .1a href="+code=data" class="sref">data  a>           = &1a href="+code=nfs_debug" class="sref">nfs_debug  a>,a.149  a>                .1a href="+code=maxlen" class="sref">maxlen  a>         = sizeof(int),a.150  a>                .1a href="+code=mode" class="sref">mode  a>           = 0644,a.151  a>                .1a href="+code=proc_handler" class="sref">proc_handler  a>   =.1a href="+code=proc_dodebug" class="sref">proc_dodebug  a>a.152  a>        },a.153  a>        {a.154  a>                .1a href="+code=procnam " class="sref">procnam   a>       =.1spav class="string">"nfsd_debug".155  a>                .1a href="+code=data" class="sref">data  a>           = &1a href="+code=nfsd_debug" class="sref">nfsd_debug  a>,a.156  a>                .1a href="+code=maxlen" class="sref">maxlen  a>         = sizeof(int),a.157  a>                .1a href="+code=mode" class="sref">mode  a>           = 0644,a.158  a>                .1a href="+code=proc_handler" class="sref">proc_handler  a>   =.1a href="+code=proc_dodebug" class="sref">proc_dodebug  a>a.159  a>        },a.160  a>        {a.161  a>                .1a href="+code=procnam " class="sref">procnam   a>       =.1spav class="string">"nlm_debug".162  a>                .1a href="+code=data" class="sref">data  a>           = &1a href="+code=nlm_debug" class="sref">nlm_debug  a>,a.163  a>                .1a href="+code=maxlen" class="sref">maxlen  a>         = sizeof(int),a.164  a>                .1a href="+code=mode" class="sref">mode  a>           = 0644,a.165  a>                .1a href="+code=proc_handler" class="sref">proc_handler  a>   =.1a href="+code=proc_dodebug" class="sref">proc_dodebug  a>a.166  a>        },a.167  a>        {a.168  a>                .1a href="+code=procnam " class="sref">procnam   a>       =.1spav class="string">"transports".169  a>                .1a href="+code=maxlen" class="sref">maxlen  a>         = 256,a.170  a>                .1a href="+code=mode" class="sref">mode  a>           = 0444,a.171  a>                .1a href="+code=proc_handler" class="sref">proc_handler  a>   =.1a href="+code=proc_do_xprt" class="sref">proc_do_xprt  a>,a.172  a>        },a.173  a>        { }a.1741/a>};a.1751/a>a.176  a>static 1a href="+code=ctl_table" class="sref">ctl_table  a> 1a href="+code=sunrpc_table" class="sref">sunrpc_table  a>[] =.{a.177  a>        {a.178  a>                .1a href="+code=procnam " class="sref">procnam   a>       =.1spav class="string">"sunrpc".179  a>                .1a href="+code=mode" class="sref">mode  a>           = 0555,a.180  a>                .1a href="+code=child" class="sref">child  a>          =.1a href="+code=debug_table" class="sref">debug_table  a>a.181  a>        },a.182  a>        { }a.1831/a>};a.1841/a>a.185  a>#endifa.186  a>
The original LXR software by the LXR community a>, this experimental versoptiby lxr@linux.no a>. 1/div2.1div class="subfooter"> lxr.linux.no kindly hostediby Redpill Linpro AS a>, provider of Linux consulting and opera vs services since 1995. 1/div2. 1/body2.1/html2.