~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/net/irda/irsysctl.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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  *      
 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.
 18  *  
 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.
 22  *     
 23  ********************************************************************/
 24 
 25 #include <linux/config.h>
 26 #include <linux/mm.h>
 27 #include <linux/ctype.h>
 28 #include <linux/sysctl.h>
 29 #include <asm/segment.h>
 30 
 31 #include <net/irda/irda.h>
 32 #include <net/irda/irias_object.h>
 33 
 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 };
 37 
 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;
 47 
 48 #ifdef CONFIG_IRDA_DEBUG
 49 extern unsigned int irda_debug;
 50 #endif
 51 
 52 static int do_devname(ctl_table *table, int write, struct file *filp,
 53                       void *buffer, size_t *lenp)
 54 {
 55         int ret;
 56 
 57         ret = proc_dostring(table, write, filp, buffer, lenp);
 58         if (ret == 0 && write) {
 59                 struct ias_value *val;
 60 
 61                 val = irias_new_string_value(sysctl_devname);
 62                 if (val)
 63                         irias_object_change_attribute("Device", "DeviceName", val);
 64         }
 65         return ret;
 66 }
 67 
 68 /* One file */
 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 },
 79 #endif
 80 #ifdef CONFIG_IRDA_FAST_RR
 81         { SLOTS, "fast_poll_increase", &sysctl_fast_poll_increase,
 82           sizeof(int), 0644, NULL, &proc_dointvec },
 83 #endif
 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 },
 94         { 0 }
 95 };
 96 
 97 /* One directory */
 98 static ctl_table irda_net_table[] = {
 99         { NET_IRDA, "irda", NULL, 0, 0555, irda_table },
100         { 0 }
101 };
102 
103 /* The parent directory */
104 static ctl_table irda_root_table[] = {
105         { CTL_NET, "net", NULL, 0, 0555, irda_net_table },
106         { 0 }
107 };
108 
109 static struct ctl_table_header *irda_table_header;
110 
111 /*
112  * Function irda_sysctl_register (void)
113  *
114  *    Register our sysctl interface
115  *
116  */
117 int irda_sysctl_register(void)
118 {
119         irda_table_header = register_sysctl_table(irda_root_table, 0);
120         if (!irda_table_header)
121                 return -ENOMEM;
122 
123         return 0;
124 }
125 
126 /*
127  * Function irda_sysctl_unregister (void)
128  *
129  *    Unregister our sysctl interface
130  *
131  */
132 void irda_sysctl_unregister(void) 
133 {
134         unregister_sysctl_table(irda_table_header);
135 }
136 
137 
138 
139 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.