2 * linux/net/sunrpc/sysctl.c
4 * Sysctl interface to sunrpc module.
6 * I would prefer to register the sunrpc table below sys/net, but that's
7 * impossible at the moment.
10 #include <linux/types.h>
11 #include <linux/linkage.h>
12 #include <linux/ctype.h>
14 #include <linux/sysctl.h>
15 #include <linux/module.h>
17 #include <asm/uaccess.h>
18 #include <linux/sunrpc/types.h>
19 #include <linux/sunrpc/sched.h>
20 #include <linux/sunrpc/stats.h>
23 * Declare the debug flags here
25 unsigned int rpc_debug
;
26 unsigned int nfs_debug
;
27 unsigned int nfsd_debug
;
28 unsigned int nlm_debug
;
32 static struct ctl_table_header
*sunrpc_table_header
;
33 static ctl_table sunrpc_table
[];
36 rpc_register_sysctl(void)
38 if (!sunrpc_table_header
)
39 sunrpc_table_header
= register_sysctl_table(sunrpc_table
);
43 rpc_unregister_sysctl(void)
45 if (sunrpc_table_header
) {
46 unregister_sysctl_table(sunrpc_table_header
);
47 sunrpc_table_header
= NULL
;
52 proc_dodebug(ctl_table
*table
, int write
, struct file
*file
,
53 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
55 char tmpbuf
[20], c
, *s
;
60 if ((*ppos
&& !write
) || !*lenp
) {
68 if (!access_ok(VERIFY_READ
, buffer
, left
))
71 while (left
&& __get_user(c
, p
) >= 0 && isspace(c
))
76 if (left
> sizeof(tmpbuf
) - 1)
78 if (copy_from_user(tmpbuf
, p
, left
))
82 for (s
= tmpbuf
, value
= 0; '0' <= *s
&& *s
<= '9'; s
++, left
--)
83 value
= 10 * value
+ (*s
- '0');
84 if (*s
&& !isspace(*s
))
86 while (left
&& isspace(*s
))
88 *(unsigned int *) table
->data
= value
;
89 /* Display the RPC tasks on writing to rpc_debug */
90 if (table
->ctl_name
== CTL_RPCDEBUG
) {
94 if (!access_ok(VERIFY_WRITE
, buffer
, left
))
96 len
= sprintf(tmpbuf
, "%d", *(unsigned int *) table
->data
);
99 if (__copy_to_user(buffer
, tmpbuf
, len
))
101 if ((left
-= len
) > 0) {
102 if (put_user('\n', (char __user
*)buffer
+ len
))
115 static ctl_table debug_table
[] = {
117 .ctl_name
= CTL_RPCDEBUG
,
118 .procname
= "rpc_debug",
120 .maxlen
= sizeof(int),
122 .proc_handler
= &proc_dodebug
125 .ctl_name
= CTL_NFSDEBUG
,
126 .procname
= "nfs_debug",
128 .maxlen
= sizeof(int),
130 .proc_handler
= &proc_dodebug
133 .ctl_name
= CTL_NFSDDEBUG
,
134 .procname
= "nfsd_debug",
136 .maxlen
= sizeof(int),
138 .proc_handler
= &proc_dodebug
141 .ctl_name
= CTL_NLMDEBUG
,
142 .procname
= "nlm_debug",
144 .maxlen
= sizeof(int),
146 .proc_handler
= &proc_dodebug
151 static ctl_table sunrpc_table
[] = {
153 .ctl_name
= CTL_SUNRPC
,
154 .procname
= "sunrpc",