aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irsysctl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/irda/irsysctl.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'net/irda/irsysctl.c')
-rw-r--r--net/irda/irsysctl.c297
1 files changed, 297 insertions, 0 deletions
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
new file mode 100644
index 000000000000..1b1c4193359a
--- /dev/null
+++ b/net/irda/irsysctl.c
@@ -0,0 +1,297 @@
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>
11 *
12 * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved.
13 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com>
14 *
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.
19 *
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.
23 *
24 ********************************************************************/
25
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>
31
32#include <net/irda/irda.h> /* irda_debug */
33#include <net/irda/irias_object.h>
34
35#define NET_IRDA 412 /* Random number */
36enum { 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 };
40
41extern int sysctl_discovery;
42extern int sysctl_discovery_slots;
43extern int sysctl_discovery_timeout;
44extern int sysctl_slot_timeout;
45extern int sysctl_fast_poll_increase;
46extern char sysctl_devname[];
47extern int sysctl_max_baud_rate;
48extern int sysctl_min_tx_turn_time;
49extern int sysctl_max_tx_data_size;
50extern int sysctl_max_tx_window;
51extern int sysctl_max_noreply_time;
52extern int sysctl_warn_noreply_time;
53extern int sysctl_lap_keepalive_time;
54
55/* this is needed for the proc_dointvec_minmax - Jean II */
56static int max_discovery_slots = 16; /* ??? */
57static 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) */
60static int max_slot_timeout = 160;
61static int min_slot_timeout = 20;
62static int max_max_baud_rate = 16000000; /* See qos.c - IrLAP spec */
63static int min_max_baud_rate = 2400;
64static int max_min_tx_turn_time = 10000; /* See qos.c - IrLAP spec */
65static int min_min_tx_turn_time;
66static int max_max_tx_data_size = 2048; /* See qos.c - IrLAP spec */
67static int min_max_tx_data_size = 64;
68static int max_max_tx_window = 7; /* See qos.c - IrLAP spec */
69static int min_max_tx_window = 1;
70static int max_max_noreply_time = 40; /* See qos.c - IrLAP spec */
71static int min_max_noreply_time = 3;
72static int max_warn_noreply_time = 3; /* 3s == standard */
73static int min_warn_noreply_time = 1; /* 1s == min WD_TIMER */
74static int max_lap_keepalive_time = 10000; /* 10s */
75static 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 */
78
79static int do_devname(ctl_table *table, int write, struct file *filp,
80 void __user *buffer, size_t *lenp, loff_t *ppos)
81{
82 int ret;
83
84 ret = proc_dostring(table, write, filp, buffer, lenp, ppos);
85 if (ret == 0 && write) {
86 struct ias_value *val;
87
88 val = irias_new_string_value(sysctl_devname);
89 if (val)
90 irias_object_change_attribute("Device", "DeviceName", val);
91 }
92 return ret;
93}
94
95/* One file */
96static ctl_table irda_table[] = {
97 {
98 .ctl_name = DISCOVERY,
99 .procname = "discovery",
100 .data = &sysctl_discovery,
101 .maxlen = sizeof(int),
102 .mode = 0644,
103 .proc_handler = &proc_dointvec
104 },
105 {
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
113 },
114#ifdef CONFIG_IRDA_DEBUG
115 {
116 .ctl_name = DEBUG,
117 .procname = "debug",
118 .data = &irda_debug,
119 .maxlen = sizeof(int),
120 .mode = 0644,
121 .proc_handler = &proc_dointvec
122 },
123#endif
124#ifdef CONFIG_IRDA_FAST_RR
125 {
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
132 },
133#endif
134 {
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
144 },
145 {
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
152 },
153 {
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
163 },
164 {
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
174 },
175 {
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
185 },
186 {
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
196 },
197 {
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
207 },
208 {
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
218 },
219 {
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
229 },
230 {
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
240 },
241 { .ctl_name = 0 }
242};
243
244/* One directory */
245static ctl_table irda_net_table[] = {
246 {
247 .ctl_name = NET_IRDA,
248 .procname = "irda",
249 .maxlen = 0,
250 .mode = 0555,
251 .child = irda_table
252 },
253 { .ctl_name = 0 }
254};
255
256/* The parent directory */
257static ctl_table irda_root_table[] = {
258 {
259 .ctl_name = CTL_NET,
260 .procname = "net",
261 .maxlen = 0,
262 .mode = 0555,
263 .child = irda_net_table
264 },
265 { .ctl_name = 0 }
266};
267
268static struct ctl_table_header *irda_table_header;
269
270/*
271 * Function irda_sysctl_register (void)
272 *
273 * Register our sysctl interface
274 *
275 */
276int __init irda_sysctl_register(void)
277{
278 irda_table_header = register_sysctl_table(irda_root_table, 0);
279 if (!irda_table_header)
280 return -ENOMEM;
281
282 return 0;
283}
284
285/*
286 * Function irda_sysctl_unregister (void)
287 *
288 * Unregister our sysctl interface
289 *
290 */
291void __exit irda_sysctl_unregister(void)
292{
293 unregister_sysctl_table(irda_table_header);
294}
295
296
297