]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/media/dvb/dvb-core/dvbdev.h
NFS: use correct fs type for v4 submounts and referrals
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / dvb-core / dvbdev.h
1 /*
2  * dvbdev.h
3  *
4  * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
5  *                    for convergence integrated media GmbH
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Lesser Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  *
21  */
22
23 #ifndef _DVBDEV_H_
24 #define _DVBDEV_H_
25
26 #include <linux/types.h>
27 #include <linux/poll.h>
28 #include <linux/fs.h>
29 #include <linux/list.h>
30 #include <linux/smp_lock.h>
31
32 #define DVB_MAJOR 212
33
34 #define DVB_MAX_ADAPTERS 8
35
36 #define DVB_UNSET (-1)
37
38 #define DVB_DEVICE_VIDEO      0
39 #define DVB_DEVICE_AUDIO      1
40 #define DVB_DEVICE_SEC        2
41 #define DVB_DEVICE_FRONTEND   3
42 #define DVB_DEVICE_DEMUX      4
43 #define DVB_DEVICE_DVR        5
44 #define DVB_DEVICE_CA         6
45 #define DVB_DEVICE_NET        7
46 #define DVB_DEVICE_OSD        8
47
48 #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
49         static short adapter_nr[] = \
50                 {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
51         module_param_array(adapter_nr, short, NULL, 0444); \
52         MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
53
54 struct dvb_adapter {
55         int num;
56         struct list_head list_head;
57         struct list_head device_list;
58         const char *name;
59         u8 proposed_mac [6];
60         void* priv;
61
62         struct device *device;
63
64         struct module *module;
65 };
66
67
68 struct dvb_device {
69         struct list_head list_head;
70         struct file_operations *fops;
71         struct dvb_adapter *adapter;
72         int type;
73         u32 id;
74
75         /* in theory, 'users' can vanish now,
76            but I don't want to change too much now... */
77         int readers;
78         int writers;
79         int users;
80
81         wait_queue_head_t         wait_queue;
82         /* don't really need those !? -- FIXME: use video_usercopy  */
83         int (*kernel_ioctl)(struct inode *inode, struct file *file,
84                             unsigned int cmd, void *arg);
85
86         void *priv;
87 };
88
89
90 extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
91                                 struct module *module, struct device *device,
92                                 short *adapter_nums);
93 extern int dvb_unregister_adapter (struct dvb_adapter *adap);
94
95 extern int dvb_register_device (struct dvb_adapter *adap,
96                                 struct dvb_device **pdvbdev,
97                                 const struct dvb_device *template,
98                                 void *priv,
99                                 int type);
100
101 extern void dvb_unregister_device (struct dvb_device *dvbdev);
102
103 extern int dvb_generic_open (struct inode *inode, struct file *file);
104 extern int dvb_generic_release (struct inode *inode, struct file *file);
105 extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
106                               unsigned int cmd, unsigned long arg);
107
108 /* we don't mess with video_usercopy() any more,
109 we simply define out own dvb_usercopy(), which will hopefully become
110 generic_usercopy()  someday... */
111
112 extern int dvb_usercopy(struct inode *inode, struct file *file,
113                             unsigned int cmd, unsigned long arg,
114                             int (*func)(struct inode *inode, struct file *file,
115                             unsigned int cmd, void *arg));
116
117 /** generic DVB attach function. */
118 #ifdef CONFIG_MEDIA_ATTACH
119 #define dvb_attach(FUNCTION, ARGS...) ({ \
120         void *__r = NULL; \
121         typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
122         if (__a) { \
123                 __r = (void *) __a(ARGS); \
124                 if (__r == NULL) \
125                         symbol_put(FUNCTION); \
126         } else { \
127                 printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
128         } \
129         __r; \
130 })
131
132 #else
133 #define dvb_attach(FUNCTION, ARGS...) ({ \
134         FUNCTION(ARGS); \
135 })
136
137 #endif
138
139 #endif /* #ifndef _DVBDEV_H_ */