Import 2.3.18pre1
[davej-history.git] / net / irda / irproc.c
blobcb361a7874bdf83022110aa69f6154fcea19b8e5
1 /*********************************************************************
2 *
3 * Filename: irproc.c
4 * Version: 1.0
5 * Description: Various entries in the /proc file system
6 * Status: Experimental.
7 * Author: Thomas Davis, <ratbert@radiks.net>
8 * Created at: Sat Feb 21 21:33:24 1998
9 * Modified at: Fri Jun 4 09:39:49 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
12 * Copyright (c) 1998-1999, Thomas Davis, <ratbert@radiks.net>,
13 * All Rights Reserved.
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 * I, Thomas Davis, provide no warranty for any of this software.
21 * This material is provided "AS-IS" and at no charge.
23 ********************************************************************/
25 #include <linux/miscdevice.h>
26 #include <linux/proc_fs.h>
28 #include <net/irda/irda.h>
29 #include <net/irda/irmod.h>
30 #include <net/irda/irlap.h>
31 #include <net/irda/irlmp.h>
33 extern int irda_device_proc_read(char *buf, char **start, off_t offset,
34 int len, int unused);
35 extern int irlap_proc_read(char *buf, char **start, off_t offset, int len,
36 int unused);
37 extern int irlmp_proc_read(char *buf, char **start, off_t offset, int len,
38 int unused);
39 extern int irttp_proc_read(char *buf, char **start, off_t offset, int len,
40 int unused);
41 extern int irias_proc_read(char *buf, char **start, off_t offset, int len,
42 int unused);
43 extern int discovery_proc_read(char *buf, char **start, off_t offset, int len,
44 int unused);
46 /* enum irda_directory_inos { */
47 /* PROC_IRDA_LAP = 1, */
48 /* PROC_IRDA_LMP, */
49 /* PROC_IRDA_TTP, */
50 /* PROC_IRDA_LPT, */
51 /* PROC_IRDA_COMM, */
52 /* PROC_IRDA_IRDA_DEVICE, */
53 /* PROC_IRDA_IRIAS */
54 /* }; */
56 struct irda_entry {
57 char *name;
58 int (*fn)(char*, char**, off_t, int, int);
61 struct proc_dir_entry *proc_irda;
63 static struct irda_entry dir[] = {
64 {"discovery", discovery_proc_read},
65 {"irda_device", irda_device_proc_read},
66 {"irttp", irttp_proc_read},
67 {"irlmp", irlmp_proc_read},
68 {"irlap", irlap_proc_read},
69 {"irias", irias_proc_read},
72 #define IRDA_ENTRIES_NUM (sizeof(dir)/sizeof(dir[0]))
75 * Function irda_proc_register (void)
77 * Register irda entry in /proc file system
80 void irda_proc_register(void)
82 int i;
84 proc_irda = create_proc_entry("net/irda", S_IFDIR, NULL);
85 #ifdef MODULE
86 proc_irda->fill_inode = &irda_proc_modcount;
87 #endif /* MODULE */
89 for (i=0;i<IRDA_ENTRIES_NUM;i++)
90 create_proc_entry(dir[i].name,0,proc_irda)->get_info=dir[i].fn;
94 * Function irda_proc_unregister (void)
96 * Unregister irda entry in /proc file system
99 void irda_proc_unregister(void)
101 int i;
103 for (i=0;i<IRDA_ENTRIES_NUM;i++)
104 remove_proc_entry(dir[i].name, proc_irda);
106 remove_proc_entry("net/irda", NULL);