summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJohannes Stezenbach <devnull@localhost>2004-04-14 17:10:56 +0000
committerJohannes Stezenbach <devnull@localhost>2004-04-14 17:10:56 +0000
commitcea421d04b89cee8285b93d46326bbefb58566b7 (patch)
treec3b5c9d2f4cf206b6947b0a8da1554787cb84466 /linux
parent98bd04299fa94ff61e8e2e1e3b8bee3cd924bb4c (diff)
downloadmediapointer-dvb-s2-cea421d04b89cee8285b93d46326bbefb58566b7.tar.gz
mediapointer-dvb-s2-cea421d04b89cee8285b93d46326bbefb58566b7.tar.bz2
- rename FEEDTYPE_SEC/TS to DVB_NET_FEEDTYPE_MPE/ULE
- add binary compatibility cruft - return feedtype in NET_GET_IF - check feedtype for validity in NET_ADD_IF - fix a copy&paste bug in dvb_net_add_if() 2.4 vs. 2.6 - formatting and coding style fixes
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c71
-rw-r--r--linux/include/linux/dvb/net.h23
2 files changed, 71 insertions, 23 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index a108db354..147ca7b3a 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -730,7 +730,7 @@ static int dvb_net_feed_start(struct net_device *dev)
priv->secfilter=0;
priv->tsfeed = 0;
- if (priv->feedtype == FEEDTYPE_SEC) {
+ if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) {
dprintk("%s: alloc secfeed\n", __FUNCTION__);
ret=demux->allocate_section_feed(demux, &priv->secfeed,
dvb_net_sec_callback);
@@ -776,8 +776,7 @@ static int dvb_net_feed_start(struct net_device *dev)
dprintk("%s: start filtering\n", __FUNCTION__);
priv->secfeed->start_filtering(priv->secfeed);
- }
- else {
+ } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) {
struct timespec timeout = { 0, 30000000 }; // 30 msec
/* we have payloads encapsulated in TS */
@@ -806,18 +805,19 @@ static int dvb_net_feed_start(struct net_device *dev)
dprintk("%s: start filtering\n", __FUNCTION__);
priv->tsfeed->start_filtering(priv->tsfeed);
- }
+ } else
+ return -EINVAL;
return 0;
}
-static void dvb_net_feed_stop(struct net_device *dev)
+static int dvb_net_feed_stop(struct net_device *dev)
{
struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv;
int i;
dprintk("%s\n", __FUNCTION__);
- if (priv->feedtype == FEEDTYPE_SEC) {
+ if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) {
if (priv->secfeed) {
if (priv->secfeed->is_filtering) {
dprintk("%s: stop secfeed\n", __FUNCTION__);
@@ -845,8 +845,7 @@ static void dvb_net_feed_stop(struct net_device *dev)
priv->secfeed = 0;
} else
printk("%s: no feed to stop\n", dev->name);
- }
- else {
+ } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) {
if (priv->tsfeed) {
if (priv->tsfeed->is_filtering) {
dprintk("%s: stop tsfeed\n", __FUNCTION__);
@@ -857,7 +856,9 @@ static void dvb_net_feed_stop(struct net_device *dev)
}
else
printk("%s: no ts feed to stop\n", dev->name);
- }
+ } else
+ return -EINVAL;
+ return 0;
}
@@ -966,8 +967,7 @@ static int dvb_net_stop(struct net_device *dev)
struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv;
priv->in_use--;
- dvb_net_feed_stop(dev);
- return 0;
+ return dvb_net_feed_stop(dev);
}
static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
@@ -1028,6 +1028,8 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
int result;
int if_num;
+ if (feedtype != DVB_NET_FEEDTYPE_MPE && feedtype != DVB_NET_FEEDTYPE_ULE)
+ return -EINVAL;
if ((if_num = get_if(dvbnet)) < 0)
return -EINVAL;
@@ -1053,6 +1055,10 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
priv->pid = pid;
priv->rx_mode = RX_MODE_UNI;
priv->host = dvbnet;
+ priv->need_pusi = 1;
+ priv->tscc = 0;
+ priv->feedtype = feedtype;
+ reset_ule(priv);
INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net);
INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net);
@@ -1073,6 +1079,8 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
int result;
int if_num;
+ if (feedtype != DVB_NET_FEEDTYPE_MPE && feedtype != DVB_NET_FEEDTYPE_ULE)
+ return -EINVAL;
if ((if_num = get_if(dvbnet)) < 0)
return -EINVAL;
@@ -1095,11 +1103,7 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
priv->need_pusi = 1;
priv->tscc = 0;
priv->feedtype = feedtype;
- reset_ule( priv );
- priv->need_pusi = 1;
- priv->tscc = 0;
- priv->feedtype = feedtype;
- reset_ule( priv );
+ reset_ule(priv);
INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net);
INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net);
@@ -1195,12 +1199,47 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
#endif
priv_data=(struct dvb_net_priv*)netdev->priv;
dvbnetif->pid=priv_data->pid;
+ dvbnetif->feedtype=priv_data->feedtype;
break;
}
case NET_REMOVE_IF:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
return dvb_net_remove_if(dvbnet, (int) (long) parg);
+
+ /* binary compatiblity cruft */
+ case __NET_ADD_IF_OLD:
+ {
+ struct __dvb_net_if_old *dvbnetif=(struct __dvb_net_if_old *)parg;
+ int result;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ result=dvb_net_add_if(dvbnet, dvbnetif->pid, DVB_NET_FEEDTYPE_MPE);
+ if (result<0)
+ return result;
+ dvbnetif->if_num=result;
+ break;
+ }
+ case __NET_GET_IF_OLD:
+ {
+ struct net_device *netdev;
+ struct dvb_net_priv *priv_data;
+ struct __dvb_net_if_old *dvbnetif=(struct __dvb_net_if_old *)parg;
+
+ if (dvbnetif->if_num >= DVB_NET_DEVICES_MAX ||
+ !dvbnet->state[dvbnetif->if_num])
+ return -EINVAL;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ netdev = &dvbnet->device[dvbnetif->if_num];
+#else
+ netdev = dvbnet->device[dvbnetif->if_num];
+#endif
+ priv_data=(struct dvb_net_priv*)netdev->priv;
+ dvbnetif->pid=priv_data->pid;
+ break;
+ }
default:
return -ENOTTY;
}
diff --git a/linux/include/linux/dvb/net.h b/linux/include/linux/dvb/net.h
index ba44c6188..f9ec12062 100644
--- a/linux/include/linux/dvb/net.h
+++ b/linux/include/linux/dvb/net.h
@@ -1,4 +1,4 @@
-/*
+/*
* net.h
*
* Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
@@ -31,14 +31,23 @@ struct dvb_net_if {
__u16 pid;
__u16 if_num;
__u8 feedtype;
-#define FEEDTYPE_SEC 0
-#define FEEDTYPE_TS 1
+#define DVB_NET_FEEDTYPE_MPE 0 /* multi protocol encapsulation */
+#define DVB_NET_FEEDTYPE_ULE 1 /* ultra lightweight encapsulation */
};
-#define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if)
-#define NET_REMOVE_IF _IO('o', 53)
-#define NET_GET_IF _IOWR('o', 54, struct dvb_net_if)
+#define NET_ADD_IF _IOWR('o', 52, struct dvb_net_if)
+#define NET_REMOVE_IF _IO('o', 53)
+#define NET_GET_IF _IOWR('o', 54, struct dvb_net_if)
-#endif /*_DVBNET_H_*/
+/* binary compatibility cruft: */
+struct __dvb_net_if_old {
+ __u16 pid;
+ __u16 if_num;
+};
+#define __NET_ADD_IF_OLD _IOWR('o', 52, struct __dvb_net_if_old)
+#define __NET_GET_IF_OLD _IOWR('o', 54, struct __dvb_net_if_old)
+
+
+#endif /*_DVBNET_H_*/