]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /********************************************************************* |
6819bc2e | 2 | * |
1da177e4 LT |
3 | * Filename: irproc.c |
4 | * Version: 1.0 | |
5 | * Description: Various entries in the /proc file system | |
6 | * Status: Experimental. | |
7 | * Author: Thomas Davis, <[email protected]> | |
8 | * Created at: Sat Feb 21 21:33:24 1998 | |
9 | * Modified at: Sun Nov 14 08:54:54 1999 | |
10 | * Modified by: Dag Brattli <[email protected]> | |
11 | * | |
12 | * Copyright (c) 1998-1999, Dag Brattli <[email protected]> | |
6819bc2e | 13 | * Copyright (c) 1998, Thomas Davis, <[email protected]>, |
1da177e4 | 14 | * All Rights Reserved. |
6819bc2e YH |
15 | * |
16 | * This program is free software; you can redistribute it and/or | |
17 | * modify it under the terms of the GNU General Public License as | |
18 | * published by the Free Software Foundation; either version 2 of | |
1da177e4 | 19 | * the License, or (at your option) any later version. |
6819bc2e YH |
20 | * |
21 | * I, Thomas Davis, provide no warranty for any of this software. | |
22 | * This material is provided "AS-IS" and at no charge. | |
23 | * | |
1da177e4 LT |
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> | |
457c4cbc | 31 | #include <net/net_namespace.h> |
1da177e4 LT |
32 | |
33 | #include <net/irda/irda.h> | |
34 | #include <net/irda/irlap.h> | |
35 | #include <net/irda/irlmp.h> | |
36 | ||
5ca1b998 SH |
37 | extern const struct file_operations discovery_seq_fops; |
38 | extern const struct file_operations irlap_seq_fops; | |
39 | extern const struct file_operations irlmp_seq_fops; | |
40 | extern const struct file_operations irttp_seq_fops; | |
41 | extern const struct file_operations irias_seq_fops; | |
1da177e4 LT |
42 | |
43 | struct irda_entry { | |
44 | const char *name; | |
5ca1b998 | 45 | const struct file_operations *fops; |
1da177e4 LT |
46 | }; |
47 | ||
48 | struct proc_dir_entry *proc_irda; | |
49 | EXPORT_SYMBOL(proc_irda); | |
6819bc2e | 50 | |
5ca1b998 | 51 | static const struct irda_entry irda_dirs[] = { |
1da177e4 LT |
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 | * Function irda_proc_register (void) | |
61 | * | |
62 | * Register irda entry in /proc file system | |
63 | * | |
64 | */ | |
6819bc2e | 65 | void __init irda_proc_register(void) |
1da177e4 LT |
66 | { |
67 | int i; | |
1da177e4 | 68 | |
457c4cbc | 69 | proc_irda = proc_mkdir("irda", init_net.proc_net); |
1da177e4 LT |
70 | if (proc_irda == NULL) |
71 | return; | |
1da177e4 | 72 | |
5e47879f | 73 | for (i = 0; i < ARRAY_SIZE(irda_dirs); i++) |
6385969b DM |
74 | (void) proc_create(irda_dirs[i].name, 0, proc_irda, |
75 | irda_dirs[i].fops); | |
1da177e4 LT |
76 | } |
77 | ||
78 | /* | |
79 | * Function irda_proc_unregister (void) | |
80 | * | |
81 | * Unregister irda entry in /proc file system | |
82 | * | |
83 | */ | |
75a69ac6 | 84 | void irda_proc_unregister(void) |
1da177e4 LT |
85 | { |
86 | int i; | |
87 | ||
6819bc2e YH |
88 | if (proc_irda) { |
89 | for (i=0; i<ARRAY_SIZE(irda_dirs); i++) | |
90 | remove_proc_entry(irda_dirs[i].name, proc_irda); | |
1da177e4 | 91 | |
457c4cbc | 92 | remove_proc_entry("irda", init_net.proc_net); |
6819bc2e YH |
93 | proc_irda = NULL; |
94 | } | |
1da177e4 LT |
95 | } |
96 | ||
97 |