sysctl.c (9a64e8e0ace51b309fdcff4b4754b3649250382a) sysctl.c (fe2c6338fd2c6f383c4d4164262f35c8f3708e1f)
1/*
2 * linux/net/sunrpc/sysctl.c
3 *
4 * Sysctl interface to sunrpc module.
5 *
6 * I would prefer to register the sunrpc table below sys/net, but that's
7 * impossible at the moment.
8 */

--- 26 unchanged lines hidden (view full) ---

35EXPORT_SYMBOL_GPL(nfsd_debug);
36
37unsigned int nlm_debug;
38EXPORT_SYMBOL_GPL(nlm_debug);
39
40#ifdef RPC_DEBUG
41
42static struct ctl_table_header *sunrpc_table_header;
1/*
2 * linux/net/sunrpc/sysctl.c
3 *
4 * Sysctl interface to sunrpc module.
5 *
6 * I would prefer to register the sunrpc table below sys/net, but that's
7 * impossible at the moment.
8 */

--- 26 unchanged lines hidden (view full) ---

35EXPORT_SYMBOL_GPL(nfsd_debug);
36
37unsigned int nlm_debug;
38EXPORT_SYMBOL_GPL(nlm_debug);
39
40#ifdef RPC_DEBUG
41
42static struct ctl_table_header *sunrpc_table_header;
43static ctl_table sunrpc_table[];
43static struct ctl_table sunrpc_table[];
44
45void
46rpc_register_sysctl(void)
47{
48 if (!sunrpc_table_header)
49 sunrpc_table_header = register_sysctl_table(sunrpc_table);
50}
51
52void
53rpc_unregister_sysctl(void)
54{
55 if (sunrpc_table_header) {
56 unregister_sysctl_table(sunrpc_table_header);
57 sunrpc_table_header = NULL;
58 }
59}
60
44
45void
46rpc_register_sysctl(void)
47{
48 if (!sunrpc_table_header)
49 sunrpc_table_header = register_sysctl_table(sunrpc_table);
50}
51
52void
53rpc_unregister_sysctl(void)
54{
55 if (sunrpc_table_header) {
56 unregister_sysctl_table(sunrpc_table_header);
57 sunrpc_table_header = NULL;
58 }
59}
60
61static int proc_do_xprt(ctl_table *table, int write,
61static int proc_do_xprt(struct ctl_table *table, int write,
62 void __user *buffer, size_t *lenp, loff_t *ppos)
63{
64 char tmpbuf[256];
65 size_t len;
66
67 if ((*ppos && !write) || !*lenp) {
68 *lenp = 0;
69 return 0;
70 }
71 len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
72 return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
73}
74
75static int
62 void __user *buffer, size_t *lenp, loff_t *ppos)
63{
64 char tmpbuf[256];
65 size_t len;
66
67 if ((*ppos && !write) || !*lenp) {
68 *lenp = 0;
69 return 0;
70 }
71 len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
72 return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
73}
74
75static int
76proc_dodebug(ctl_table *table, int write,
76proc_dodebug(struct ctl_table *table, int write,
77 void __user *buffer, size_t *lenp, loff_t *ppos)
78{
79 char tmpbuf[20], c, *s;
80 char __user *p;
81 unsigned int value;
82 size_t left, len;
83
84 if ((*ppos && !write) || !*lenp) {

--- 45 unchanged lines hidden (view full) ---

130
131done:
132 *lenp -= left;
133 *ppos += *lenp;
134 return 0;
135}
136
137
77 void __user *buffer, size_t *lenp, loff_t *ppos)
78{
79 char tmpbuf[20], c, *s;
80 char __user *p;
81 unsigned int value;
82 size_t left, len;
83
84 if ((*ppos && !write) || !*lenp) {

--- 45 unchanged lines hidden (view full) ---

130
131done:
132 *lenp -= left;
133 *ppos += *lenp;
134 return 0;
135}
136
137
138static ctl_table debug_table[] = {
138static struct ctl_table debug_table[] = {
139 {
140 .procname = "rpc_debug",
141 .data = &rpc_debug,
142 .maxlen = sizeof(int),
143 .mode = 0644,
144 .proc_handler = proc_dodebug
145 },
146 {

--- 21 unchanged lines hidden (view full) ---

168 .procname = "transports",
169 .maxlen = 256,
170 .mode = 0444,
171 .proc_handler = proc_do_xprt,
172 },
173 { }
174};
175
139 {
140 .procname = "rpc_debug",
141 .data = &rpc_debug,
142 .maxlen = sizeof(int),
143 .mode = 0644,
144 .proc_handler = proc_dodebug
145 },
146 {

--- 21 unchanged lines hidden (view full) ---

168 .procname = "transports",
169 .maxlen = 256,
170 .mode = 0444,
171 .proc_handler = proc_do_xprt,
172 },
173 { }
174};
175
176static ctl_table sunrpc_table[] = {
176static struct ctl_table sunrpc_table[] = {
177 {
178 .procname = "sunrpc",
179 .mode = 0555,
180 .child = debug_table
181 },
182 { }
183};
184
185#endif
177 {
178 .procname = "sunrpc",
179 .mode = 0555,
180 .child = debug_table
181 },
182 { }
183};
184
185#endif