1 /*********************************************************************
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.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge.
23 ********************************************************************/
25 #include <linux/config.h>
27 #include <linux/ctype.h>
28 #include <linux/sysctl.h>
29 #include <asm/segment.h>
31 #include <net/irda/irda.h>
32 #include <net/irda/irias_object.h>
34 #define NET_IRDA 412 /* Random number */
35 enum { DISCOVERY
=1, DEVNAME
, COMPRESSION
, DEBUG
, SLOTS
, DISCOVERY_TIMEOUT
,
36 SLOT_TIMEOUT
, MAX_BAUD_RATE
, MAX_INACTIVE_TIME
};
38 extern int sysctl_discovery
;
39 extern int sysctl_discovery_slots
;
40 extern int sysctl_discovery_timeout
;
41 extern int sysctl_slot_timeout
;
42 extern int sysctl_fast_poll_increase
;
43 int sysctl_compression
= 0;
44 extern char sysctl_devname
[];
45 extern int sysctl_max_baud_rate
;
46 extern int sysctl_max_inactive_time
;
48 #ifdef CONFIG_IRDA_DEBUG
49 extern unsigned int irda_debug
;
52 static int do_devname(ctl_table
*table
, int write
, struct file
*filp
,
53 void *buffer
, size_t *lenp
)
57 ret
= proc_dostring(table
, write
, filp
, buffer
, lenp
);
58 if (ret
== 0 && write
) {
59 struct ias_value
*val
;
61 val
= irias_new_string_value(sysctl_devname
);
63 irias_object_change_attribute("Device", "DeviceName", val
);
69 static ctl_table irda_table
[] = {
70 { DISCOVERY
, "discovery", &sysctl_discovery
,
71 sizeof(int), 0644, NULL
, &proc_dointvec
},
72 { DEVNAME
, "devname", sysctl_devname
,
73 65, 0644, NULL
, &do_devname
, &sysctl_string
},
74 { COMPRESSION
, "compression", &sysctl_compression
,
75 sizeof(int), 0644, NULL
, &proc_dointvec
},
76 #ifdef CONFIG_IRDA_DEBUG
77 { DEBUG
, "debug", &irda_debug
,
78 sizeof(int), 0644, NULL
, &proc_dointvec
},
80 #ifdef CONFIG_IRDA_FAST_RR
81 { SLOTS
, "fast_poll_increase", &sysctl_fast_poll_increase
,
82 sizeof(int), 0644, NULL
, &proc_dointvec
},
84 { SLOTS
, "discovery_slots", &sysctl_discovery_slots
,
85 sizeof(int), 0644, NULL
, &proc_dointvec
},
86 { DISCOVERY_TIMEOUT
, "discovery_timeout", &sysctl_discovery_timeout
,
87 sizeof(int), 0644, NULL
, &proc_dointvec
},
88 { SLOT_TIMEOUT
, "slot_timeout", &sysctl_slot_timeout
,
89 sizeof(int), 0644, NULL
, &proc_dointvec
},
90 { MAX_BAUD_RATE
, "max_baud_rate", &sysctl_max_baud_rate
,
91 sizeof(int), 0644, NULL
, &proc_dointvec
},
92 { MAX_INACTIVE_TIME
, "max_inactive_time", &sysctl_max_inactive_time
,
93 sizeof(int), 0644, NULL
, &proc_dointvec
},
98 static ctl_table irda_net_table
[] = {
99 { NET_IRDA
, "irda", NULL
, 0, 0555, irda_table
},
103 /* The parent directory */
104 static ctl_table irda_root_table
[] = {
105 { CTL_NET
, "net", NULL
, 0, 0555, irda_net_table
},
109 static struct ctl_table_header
*irda_table_header
;
112 * Function irda_sysctl_register (void)
114 * Register our sysctl interface
117 int irda_sysctl_register(void)
119 irda_table_header
= register_sysctl_table(irda_root_table
, 0);
120 if (!irda_table_header
)
127 * Function irda_sysctl_unregister (void)
129 * Unregister our sysctl interface
132 void irda_sysctl_unregister(void)
134 unregister_sysctl_table(irda_table_header
);