[TCP]: Fix TCP_OFF() bug check introduced by previous change.
[linux/fpc-iii.git] / net / irda / irsysctl.c
blob1b1c4193359ae9e580c304bbd4800f565a976eb1
1 /*********************************************************************
2 *
3 * Filename: irsysctl.c
4 * Version: 1.0
5 * Description: Sysctl interface for IrDA
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Sun May 24 22:12:06 1998
9 * Modified at: Fri Jun 4 02:50:15 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
12 * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com>
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge.
24 ********************************************************************/
26 #include <linux/config.h>
27 #include <linux/mm.h>
28 #include <linux/ctype.h>
29 #include <linux/sysctl.h>
30 #include <linux/init.h>
32 #include <net/irda/irda.h> /* irda_debug */
33 #include <net/irda/irias_object.h>
35 #define NET_IRDA 412 /* Random number */
36 enum { DISCOVERY=1, DEVNAME, DEBUG, FAST_POLL, DISCOVERY_SLOTS,
37 DISCOVERY_TIMEOUT, SLOT_TIMEOUT, MAX_BAUD_RATE, MIN_TX_TURN_TIME,
38 MAX_TX_DATA_SIZE, MAX_TX_WINDOW, MAX_NOREPLY_TIME, WARN_NOREPLY_TIME,
39 LAP_KEEPALIVE_TIME };
41 extern int sysctl_discovery;
42 extern int sysctl_discovery_slots;
43 extern int sysctl_discovery_timeout;
44 extern int sysctl_slot_timeout;
45 extern int sysctl_fast_poll_increase;
46 extern char sysctl_devname[];
47 extern int sysctl_max_baud_rate;
48 extern int sysctl_min_tx_turn_time;
49 extern int sysctl_max_tx_data_size;
50 extern int sysctl_max_tx_window;
51 extern int sysctl_max_noreply_time;
52 extern int sysctl_warn_noreply_time;
53 extern int sysctl_lap_keepalive_time;
55 /* this is needed for the proc_dointvec_minmax - Jean II */
56 static int max_discovery_slots = 16; /* ??? */
57 static int min_discovery_slots = 1;
58 /* IrLAP 6.13.2 says 25ms to 10+70ms - allow higher since some devices
59 * seems to require it. (from Dag's comment) */
60 static int max_slot_timeout = 160;
61 static int min_slot_timeout = 20;
62 static int max_max_baud_rate = 16000000; /* See qos.c - IrLAP spec */
63 static int min_max_baud_rate = 2400;
64 static int max_min_tx_turn_time = 10000; /* See qos.c - IrLAP spec */
65 static int min_min_tx_turn_time;
66 static int max_max_tx_data_size = 2048; /* See qos.c - IrLAP spec */
67 static int min_max_tx_data_size = 64;
68 static int max_max_tx_window = 7; /* See qos.c - IrLAP spec */
69 static int min_max_tx_window = 1;
70 static int max_max_noreply_time = 40; /* See qos.c - IrLAP spec */
71 static int min_max_noreply_time = 3;
72 static int max_warn_noreply_time = 3; /* 3s == standard */
73 static int min_warn_noreply_time = 1; /* 1s == min WD_TIMER */
74 static int max_lap_keepalive_time = 10000; /* 10s */
75 static int min_lap_keepalive_time = 100; /* 100us */
76 /* For other sysctl, I've no idea of the range. Maybe Dag could help
77 * us on that - Jean II */
79 static int do_devname(ctl_table *table, int write, struct file *filp,
80 void __user *buffer, size_t *lenp, loff_t *ppos)
82 int ret;
84 ret = proc_dostring(table, write, filp, buffer, lenp, ppos);
85 if (ret == 0 && write) {
86 struct ias_value *val;
88 val = irias_new_string_value(sysctl_devname);
89 if (val)
90 irias_object_change_attribute("Device", "DeviceName", val);
92 return ret;
95 /* One file */
96 static ctl_table irda_table[] = {
98 .ctl_name = DISCOVERY,
99 .procname = "discovery",
100 .data = &sysctl_discovery,
101 .maxlen = sizeof(int),
102 .mode = 0644,
103 .proc_handler = &proc_dointvec
106 .ctl_name = DEVNAME,
107 .procname = "devname",
108 .data = sysctl_devname,
109 .maxlen = 65,
110 .mode = 0644,
111 .proc_handler = &do_devname,
112 .strategy = &sysctl_string
114 #ifdef CONFIG_IRDA_DEBUG
116 .ctl_name = DEBUG,
117 .procname = "debug",
118 .data = &irda_debug,
119 .maxlen = sizeof(int),
120 .mode = 0644,
121 .proc_handler = &proc_dointvec
123 #endif
124 #ifdef CONFIG_IRDA_FAST_RR
126 .ctl_name = FAST_POLL,
127 .procname = "fast_poll_increase",
128 .data = &sysctl_fast_poll_increase,
129 .maxlen = sizeof(int),
130 .mode = 0644,
131 .proc_handler = &proc_dointvec
133 #endif
135 .ctl_name = DISCOVERY_SLOTS,
136 .procname = "discovery_slots",
137 .data = &sysctl_discovery_slots,
138 .maxlen = sizeof(int),
139 .mode = 0644,
140 .proc_handler = &proc_dointvec_minmax,
141 .strategy = &sysctl_intvec,
142 .extra1 = &min_discovery_slots,
143 .extra2 = &max_discovery_slots
146 .ctl_name = DISCOVERY_TIMEOUT,
147 .procname = "discovery_timeout",
148 .data = &sysctl_discovery_timeout,
149 .maxlen = sizeof(int),
150 .mode = 0644,
151 .proc_handler = &proc_dointvec
154 .ctl_name = SLOT_TIMEOUT,
155 .procname = "slot_timeout",
156 .data = &sysctl_slot_timeout,
157 .maxlen = sizeof(int),
158 .mode = 0644,
159 .proc_handler = &proc_dointvec_minmax,
160 .strategy = &sysctl_intvec,
161 .extra1 = &min_slot_timeout,
162 .extra2 = &max_slot_timeout
165 .ctl_name = MAX_BAUD_RATE,
166 .procname = "max_baud_rate",
167 .data = &sysctl_max_baud_rate,
168 .maxlen = sizeof(int),
169 .mode = 0644,
170 .proc_handler = &proc_dointvec_minmax,
171 .strategy = &sysctl_intvec,
172 .extra1 = &min_max_baud_rate,
173 .extra2 = &max_max_baud_rate
176 .ctl_name = MIN_TX_TURN_TIME,
177 .procname = "min_tx_turn_time",
178 .data = &sysctl_min_tx_turn_time,
179 .maxlen = sizeof(int),
180 .mode = 0644,
181 .proc_handler = &proc_dointvec_minmax,
182 .strategy = &sysctl_intvec,
183 .extra1 = &min_min_tx_turn_time,
184 .extra2 = &max_min_tx_turn_time
187 .ctl_name = MAX_TX_DATA_SIZE,
188 .procname = "max_tx_data_size",
189 .data = &sysctl_max_tx_data_size,
190 .maxlen = sizeof(int),
191 .mode = 0644,
192 .proc_handler = &proc_dointvec_minmax,
193 .strategy = &sysctl_intvec,
194 .extra1 = &min_max_tx_data_size,
195 .extra2 = &max_max_tx_data_size
198 .ctl_name = MAX_TX_WINDOW,
199 .procname = "max_tx_window",
200 .data = &sysctl_max_tx_window,
201 .maxlen = sizeof(int),
202 .mode = 0644,
203 .proc_handler = &proc_dointvec_minmax,
204 .strategy = &sysctl_intvec,
205 .extra1 = &min_max_tx_window,
206 .extra2 = &max_max_tx_window
209 .ctl_name = MAX_NOREPLY_TIME,
210 .procname = "max_noreply_time",
211 .data = &sysctl_max_noreply_time,
212 .maxlen = sizeof(int),
213 .mode = 0644,
214 .proc_handler = &proc_dointvec_minmax,
215 .strategy = &sysctl_intvec,
216 .extra1 = &min_max_noreply_time,
217 .extra2 = &max_max_noreply_time
220 .ctl_name = WARN_NOREPLY_TIME,
221 .procname = "warn_noreply_time",
222 .data = &sysctl_warn_noreply_time,
223 .maxlen = sizeof(int),
224 .mode = 0644,
225 .proc_handler = &proc_dointvec_minmax,
226 .strategy = &sysctl_intvec,
227 .extra1 = &min_warn_noreply_time,
228 .extra2 = &max_warn_noreply_time
231 .ctl_name = LAP_KEEPALIVE_TIME,
232 .procname = "lap_keepalive_time",
233 .data = &sysctl_lap_keepalive_time,
234 .maxlen = sizeof(int),
235 .mode = 0644,
236 .proc_handler = &proc_dointvec_minmax,
237 .strategy = &sysctl_intvec,
238 .extra1 = &min_lap_keepalive_time,
239 .extra2 = &max_lap_keepalive_time
241 { .ctl_name = 0 }
244 /* One directory */
245 static ctl_table irda_net_table[] = {
247 .ctl_name = NET_IRDA,
248 .procname = "irda",
249 .maxlen = 0,
250 .mode = 0555,
251 .child = irda_table
253 { .ctl_name = 0 }
256 /* The parent directory */
257 static ctl_table irda_root_table[] = {
259 .ctl_name = CTL_NET,
260 .procname = "net",
261 .maxlen = 0,
262 .mode = 0555,
263 .child = irda_net_table
265 { .ctl_name = 0 }
268 static struct ctl_table_header *irda_table_header;
271 * Function irda_sysctl_register (void)
273 * Register our sysctl interface
276 int __init irda_sysctl_register(void)
278 irda_table_header = register_sysctl_table(irda_root_table, 0);
279 if (!irda_table_header)
280 return -ENOMEM;
282 return 0;
286 * Function irda_sysctl_unregister (void)
288 * Unregister our sysctl interface
291 void __exit irda_sysctl_unregister(void)
293 unregister_sysctl_table(irda_table_header);