1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <linux/miscdevice.h>
27#include <linux/proc_fs.h>
28#include <linux/seq_file.h>
29#include <linux/module.h>
30#include <linux/init.h>
31#include <net/net_namespace.h>
32
33#include <net/irda/irda.h>
34#include <net/irda/irlap.h>
35#include <net/irda/irlmp.h>
36
37extern const struct file_operations discovery_seq_fops;
38extern const struct file_operations irlap_seq_fops;
39extern const struct file_operations irlmp_seq_fops;
40extern const struct file_operations irttp_seq_fops;
41extern const struct file_operations irias_seq_fops;
42
43struct irda_entry {
44 const char *name;
45 const struct file_operations *fops;
46};
47
48struct proc_dir_entry *proc_irda;
49EXPORT_SYMBOL(proc_irda);
50
51static const struct irda_entry irda_dirs[] = {
52 {"discovery", &discovery_seq_fops},
53 {"irttp", &irttp_seq_fops},
54 {"irlmp", &irlmp_seq_fops},
55 {"irlap", &irlap_seq_fops},
56 {"irias", &irias_seq_fops},
57};
58
59
60
61
62
63
64
65void __init irda_proc_register(void)
66{
67 int i;
68
69 proc_irda = proc_mkdir("irda", init_net.proc_net);
70 if (proc_irda == NULL)
71 return;
72
73 for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
74 (void) proc_create(irda_dirs[i].name, 0, proc_irda,
75 irda_dirs[i].fops);
76}
77
78
79
80
81
82
83
84void irda_proc_unregister(void)
85{
86 int i;
87
88 if (proc_irda) {
89 for (i=0; i<ARRAY_SIZE(irda_dirs); i++)
90 remove_proc_entry(irda_dirs[i].name, proc_irda);
91
92 remove_proc_entry("irda", init_net.proc_net);
93 proc_irda = NULL;
94 }
95}
96
97
98