Merge branch 'usb-move' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
[linux-2.6] / net / rose / sysctl_net_rose.c
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * Copyright (C) 1996 Mike Shaver (shaver@zeroknowledge.com)
8  */
9 #include <linux/mm.h>
10 #include <linux/sysctl.h>
11 #include <linux/init.h>
12 #include <net/ax25.h>
13 #include <net/rose.h>
14
15 static int min_timer[]  = {1 * HZ};
16 static int max_timer[]  = {300 * HZ};
17 static int min_idle[]   = {0 * HZ};
18 static int max_idle[]   = {65535 * HZ};
19 static int min_route[1],       max_route[] = {1};
20 static int min_ftimer[] = {60 * HZ};
21 static int max_ftimer[] = {600 * HZ};
22 static int min_maxvcs[] = {1}, max_maxvcs[] = {254};
23 static int min_window[] = {1}, max_window[] = {7};
24
25 static struct ctl_table_header *rose_table_header;
26
27 static ctl_table rose_table[] = {
28         {
29                 .ctl_name       = NET_ROSE_RESTART_REQUEST_TIMEOUT,
30                 .procname       = "restart_request_timeout",
31                 .data           = &sysctl_rose_restart_request_timeout,
32                 .maxlen         = sizeof(int),
33                 .mode           = 0644,
34                 .proc_handler   = &proc_dointvec_minmax,
35                 .strategy       = &sysctl_intvec,
36                 .extra1         = &min_timer,
37                 .extra2         = &max_timer
38         },
39         {
40                 .ctl_name       = NET_ROSE_CALL_REQUEST_TIMEOUT,
41                 .procname       = "call_request_timeout",
42                 .data           = &sysctl_rose_call_request_timeout,
43                 .maxlen         = sizeof(int),
44                 .mode           = 0644,
45                 .proc_handler   = &proc_dointvec_minmax,
46                 .strategy       = &sysctl_intvec,
47                 .extra1         = &min_timer,
48                 .extra2         = &max_timer
49         },
50         {
51                 .ctl_name       = NET_ROSE_RESET_REQUEST_TIMEOUT,
52                 .procname       = "reset_request_timeout",
53                 .data           = &sysctl_rose_reset_request_timeout,
54                 .maxlen         = sizeof(int),
55                 .mode           = 0644,
56                 .proc_handler   = &proc_dointvec_minmax,
57                 .strategy       = &sysctl_intvec,
58                 .extra1         = &min_timer,
59                 .extra2         = &max_timer
60         },
61         {
62                 .ctl_name       = NET_ROSE_CLEAR_REQUEST_TIMEOUT,
63                 .procname       = "clear_request_timeout",
64                 .data           = &sysctl_rose_clear_request_timeout,
65                 .maxlen         = sizeof(int),
66                 .mode           = 0644,
67                 .proc_handler   = &proc_dointvec_minmax,
68                 .strategy       = &sysctl_intvec,
69                 .extra1         = &min_timer,
70                 .extra2         = &max_timer
71         },
72         {
73                 .ctl_name       = NET_ROSE_NO_ACTIVITY_TIMEOUT,
74                 .procname       = "no_activity_timeout",
75                 .data           = &sysctl_rose_no_activity_timeout,
76                 .maxlen         = sizeof(int),
77                 .mode           = 0644,
78                 .proc_handler   = &proc_dointvec_minmax,
79                 .strategy       = &sysctl_intvec,
80                 .extra1         = &min_idle,
81                 .extra2         = &max_idle
82         },
83         {
84                 .ctl_name       = NET_ROSE_ACK_HOLD_BACK_TIMEOUT,
85                 .procname       = "acknowledge_hold_back_timeout",
86                 .data           = &sysctl_rose_ack_hold_back_timeout,
87                 .maxlen         = sizeof(int),
88                 .mode           = 0644,
89                 .proc_handler   = &proc_dointvec_minmax,
90                 .strategy       = &sysctl_intvec,
91                 .extra1         = &min_timer,
92                 .extra2         = &max_timer
93         },
94         {
95                 .ctl_name       = NET_ROSE_ROUTING_CONTROL,
96                 .procname       = "routing_control",
97                 .data           = &sysctl_rose_routing_control,
98                 .maxlen         = sizeof(int),
99                 .mode           = 0644,
100                 .proc_handler   = &proc_dointvec_minmax,
101                 .strategy       = &sysctl_intvec,
102                 .extra1         = &min_route,
103                 .extra2         = &max_route
104         },
105         {
106                 .ctl_name       = NET_ROSE_LINK_FAIL_TIMEOUT,
107                 .procname       = "link_fail_timeout",
108                 .data           = &sysctl_rose_link_fail_timeout,
109                 .maxlen         = sizeof(int),
110                 .mode           = 0644,
111                 .proc_handler   = &proc_dointvec_minmax,
112                 .strategy       = &sysctl_intvec,
113                 .extra1         = &min_ftimer,
114                 .extra2         = &max_ftimer
115         },
116         {
117                 .ctl_name       = NET_ROSE_MAX_VCS,
118                 .procname       = "maximum_virtual_circuits",
119                 .data           = &sysctl_rose_maximum_vcs,
120                 .maxlen         = sizeof(int),
121                 .mode           = 0644,
122                 .proc_handler   = &proc_dointvec_minmax,
123                 .strategy       = &sysctl_intvec,
124                 .extra1         = &min_maxvcs,
125                 .extra2         = &max_maxvcs
126         },
127         {
128                 .ctl_name       = NET_ROSE_WINDOW_SIZE,
129                 .procname       = "window_size",
130                 .data           = &sysctl_rose_window_size,
131                 .maxlen         = sizeof(int),
132                 .mode           = 0644,
133                 .proc_handler   = &proc_dointvec_minmax,
134                 .strategy       = &sysctl_intvec,
135                 .extra1         = &min_window,
136                 .extra2         = &max_window
137         },
138         { .ctl_name = 0 }
139 };
140
141 static ctl_table rose_dir_table[] = {
142         {
143                 .ctl_name       = NET_ROSE,
144                 .procname       = "rose",
145                 .mode           = 0555,
146                 .child          = rose_table
147         },
148         { .ctl_name = 0 }
149 };
150
151 static ctl_table rose_root_table[] = {
152         {
153                 .ctl_name       = CTL_NET,
154                 .procname       = "net",
155                 .mode           = 0555,
156                 .child          = rose_dir_table
157         },
158         { .ctl_name = 0 }
159 };
160
161 void __init rose_register_sysctl(void)
162 {
163         rose_table_header = register_sysctl_table(rose_root_table);
164 }
165
166 void rose_unregister_sysctl(void)
167 {
168         unregister_sysctl_table(rose_table_header);
169 }