]> www.vanbest.org Git - sasc-ng.git/commitdiff
sasc: add dvbloopback kernel 2.6.38 fixes
authorleslie <unknown>
Thu, 8 Sep 2011 22:55:13 +0000 (06:55 +0800)
committerleslie <unknown>
Thu, 8 Sep 2011 22:55:13 +0000 (06:55 +0800)
contrib/sasc-ng/dvbloopback/module/dvb_loopback.c
contrib/sasc-ng/dvbloopback/module/dvblb_forward.c

index 2c477eb4ca836d10606b52692a5171a5ac75e66f..5299dbe3b7b4e8ac5f33332a6a1ace12fd372e12 100644 (file)
@@ -118,10 +118,17 @@ static void rvfree(void *mem, unsigned long size)
 /* This is a copy of dvb_usercopy.  We need to do this because it isn't exported
    by dvbdev
 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+static int dvblb_usercopy(struct file *file,
+                    unsigned int cmd, unsigned long arg,
+                    int (*func)(struct file *file,
+                    unsigned int cmd, void *arg))
+#else
 static int dvblb_usercopy(struct inode *inode, struct file *file,
                     unsigned int cmd, unsigned long arg,
                     int (*func)(struct inode *inode, struct file *file,
                     unsigned int cmd, void *arg))
+#endif
 {
        char    sbuf[128];
        void    *mbuf = NULL;
@@ -180,7 +187,11 @@ static int dvblb_usercopy(struct inode *inode, struct file *file,
        }
 
        /* call driver */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+       if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
+#else
        if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD)
+#endif
                err = -EINVAL;
 
        if (err < 0)
@@ -663,8 +674,13 @@ static ssize_t dvblb_read (struct file *f, char * buf, size_t count, loff_t *off
    dvb_generic_ioctl) which is called by dvblb_ioctl for device-0.  It is
    used to forward ioctl commands back to the userspace application
 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+static int dvblb_looped_ioctl(struct file *f,
+       unsigned int cmd, void *parg)
+#else
 static int dvblb_looped_ioctl(struct inode *inode, struct file *f,
        unsigned int cmd, void *parg)
+#endif
 {
        int ret;
         struct dvb_device *dvbdev, **filemap;
@@ -692,8 +708,13 @@ static int dvblb_looped_ioctl(struct inode *inode, struct file *f,
        return ret;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+static long dvblb_ioctl(struct file *f,
+       unsigned int cmd, unsigned long arg)
+#else
 static int dvblb_ioctl(struct inode *inode, struct file *f,
        unsigned int cmd, unsigned long arg)
+#endif
 {
        void * parg = (void *)arg;
        struct dvb_device *dvbdev, **filemap;
@@ -723,8 +744,13 @@ static int dvblb_ioctl(struct inode *inode, struct file *f,
                if (lbdev->forward_dev)
                        return dvblb_forward_ioctl(lbdev, f, cmd, arg);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+               return dvblb_usercopy (f, cmd, arg,
+                                      dvbdev->kernel_ioctl);
+#else
                return dvblb_usercopy (inode, f, cmd, arg,
                                       dvbdev->kernel_ioctl);
+#endif
        }
        /* This is the userspace control device */
        dprintk2("dvblb_ioctl %d%s%d fd:%d cmd:%x\n",lbdev->parent->adapter.num,
@@ -978,7 +1004,11 @@ static struct file_operations dvbdev_looped_fops = {
        .write          = dvblb_write,
        .poll           = dvblb_poll,
        .mmap           = dvblb_mmap,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+       .unlocked_ioctl = dvblb_ioctl,
+#else
        .ioctl          = dvblb_ioctl,
+#endif
 };
 
 static struct dvb_device dvbdev_looped = {
@@ -998,7 +1028,11 @@ static struct file_operations dvbdev_userspace_fops = {
        .write          = dvblb_write,
        .poll           = dvblb_poll,
        .mmap           = dvblb_mmap,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+       .unlocked_ioctl = dvblb_ioctl,
+#else
        .ioctl          = dvblb_ioctl,
+#endif
 };
 
 static struct dvb_device dvbdev_userspace = {
index dcb4107d8d8953fe8c6dc63a1d9e2d7083f3e90e..65492089dae84bc492511c7ea384389ca0340a35 100644 (file)
@@ -166,9 +166,15 @@ int dvblb_forward_ioctl(struct dvblb_devinfo *lbdev, struct file *f,
        struct file *ftmp = find_forwardmap(lbdev, f->private_data);
        if (!ftmp || IS_ERR(ftmp))
                return -EFAULT;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+       if (lbdev->forward_dev->fops &&lbdev->forward_dev->fops->unlocked_ioctl)
+               return lbdev->forward_dev->fops->unlocked_ioctl(
+                          ftmp, cmd, arg);
+#else
        if (lbdev->forward_dev->fops &&lbdev->forward_dev->fops->ioctl)
                return lbdev->forward_dev->fops->ioctl(
                           ftmp->f_dentry->d_inode, ftmp, cmd, arg);
+#endif
        return -EFAULT;
 }