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>
21 #include <linux/sunrpc/xprt.h>
24 * Declare the debug flags here
26 unsigned int rpc_debug;
27 unsigned int nfs_debug;
28 unsigned int nfsd_debug;
29 unsigned int nlm_debug;
33 static struct ctl_table_header *sunrpc_table_header;
34 static ctl_table sunrpc_table[];
37 rpc_register_sysctl(void)
39 if (!sunrpc_table_header) {
40 sunrpc_table_header = register_sysctl_table(sunrpc_table, 1);
42 if (sunrpc_table[0].de)
43 sunrpc_table[0].de->owner = THIS_MODULE;
50 rpc_unregister_sysctl(void)
52 if (sunrpc_table_header) {
53 unregister_sysctl_table(sunrpc_table_header);
54 sunrpc_table_header = NULL;
59 proc_dodebug(ctl_table *table, int write, struct file *file,
60 void __user *buffer, size_t *lenp, loff_t *ppos)
62 char tmpbuf[20], c, *s;
67 if ((*ppos && !write) || !*lenp) {
75 if (!access_ok(VERIFY_READ, buffer, left))
78 while (left && __get_user(c, p) >= 0 && isspace(c))
83 if (left > sizeof(tmpbuf) - 1)
85 if (copy_from_user(tmpbuf, p, left))
89 for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--)
90 value = 10 * value + (*s - '0');
91 if (*s && !isspace(*s))
93 while (left && isspace(*s))
95 *(unsigned int *) table->data = value;
96 /* Display the RPC tasks on writing to rpc_debug */
97 if (table->ctl_name == CTL_RPCDEBUG) {
101 if (!access_ok(VERIFY_WRITE, buffer, left))
103 len = sprintf(tmpbuf, "%d", *(unsigned int *) table->data);
106 if (__copy_to_user(buffer, tmpbuf, len))
108 if ((left -= len) > 0) {
109 if (put_user('\n', (char __user *)buffer + len))
122 static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE;
123 static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE;
124 static unsigned int xprt_min_resvport_limit = RPC_MIN_RESVPORT;
125 static unsigned int xprt_max_resvport_limit = RPC_MAX_RESVPORT;
127 static ctl_table debug_table[] = {
129 .ctl_name = CTL_RPCDEBUG,
130 .procname = "rpc_debug",
132 .maxlen = sizeof(int),
134 .proc_handler = &proc_dodebug
137 .ctl_name = CTL_NFSDEBUG,
138 .procname = "nfs_debug",
140 .maxlen = sizeof(int),
142 .proc_handler = &proc_dodebug
145 .ctl_name = CTL_NFSDDEBUG,
146 .procname = "nfsd_debug",
148 .maxlen = sizeof(int),
150 .proc_handler = &proc_dodebug
153 .ctl_name = CTL_NLMDEBUG,
154 .procname = "nlm_debug",
156 .maxlen = sizeof(int),
158 .proc_handler = &proc_dodebug
161 .ctl_name = CTL_SLOTTABLE_UDP,
162 .procname = "udp_slot_table_entries",
163 .data = &xprt_udp_slot_table_entries,
164 .maxlen = sizeof(unsigned int),
166 .proc_handler = &proc_dointvec_minmax,
167 .strategy = &sysctl_intvec,
168 .extra1 = &min_slot_table_size,
169 .extra2 = &max_slot_table_size
172 .ctl_name = CTL_SLOTTABLE_TCP,
173 .procname = "tcp_slot_table_entries",
174 .data = &xprt_tcp_slot_table_entries,
175 .maxlen = sizeof(unsigned int),
177 .proc_handler = &proc_dointvec_minmax,
178 .strategy = &sysctl_intvec,
179 .extra1 = &min_slot_table_size,
180 .extra2 = &max_slot_table_size
183 .ctl_name = CTL_MIN_RESVPORT,
184 .procname = "min_resvport",
185 .data = &xprt_min_resvport,
186 .maxlen = sizeof(unsigned int),
188 .proc_handler = &proc_dointvec_minmax,
189 .strategy = &sysctl_intvec,
190 .extra1 = &xprt_min_resvport_limit,
191 .extra2 = &xprt_max_resvport_limit
194 .ctl_name = CTL_MAX_RESVPORT,
195 .procname = "max_resvport",
196 .data = &xprt_max_resvport,
197 .maxlen = sizeof(unsigned int),
199 .proc_handler = &proc_dointvec_minmax,
200 .strategy = &sysctl_intvec,
201 .extra1 = &xprt_min_resvport_limit,
202 .extra2 = &xprt_max_resvport_limit
207 static ctl_table sunrpc_table[] = {
209 .ctl_name = CTL_SUNRPC,
210 .procname = "sunrpc",