Messages in this thread Patch in this message | | | Subject | [PATCH 5/14] multiple device *read* opens support | Date | Wed, 8 Oct 2003 15:28:53 +0200 | From | Michael Hunold (LinuxTV.org CVS maintainer) <> |
| |
- [DVB] allow multiple read device opens diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h --- xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h 2003-09-10 11:28:41.000000000 +0200 +++ linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.h 2003-08-25 12:16:12.000000000 +0200 @@ -55,12 +58,18 @@ struct dvb_device { struct list_head list_head; struct file_operations *fops; + + + struct dvb_adapter *adapter; int type; u32 id; - int users; + /* in theory, 'users' can vanish now, + but I don't want to change too much now... */ + int readers; int writers; + int users; /* don't really need those !? -- FIXME: use video_usercopy */ int (*kernel_ioctl)(struct inode *inode, struct file *file, diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c --- xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c 2003-09-10 11:29:20.000000000 +0200 +++ linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvbdev.c 2003-08-21 10:53:19.000000000 +0200 @@ -112,7 +121,11 @@ if (!dvbdev->users) return -EBUSY; - if ((file->f_flags & O_ACCMODE) != O_RDONLY) { + if ((file->f_flags & O_ACCMODE) == O_RDONLY) { + if (!dvbdev->readers) + return -EBUSY; + dvbdev->readers--; + } else { if (!dvbdev->writers) return -EBUSY; dvbdev->writers--; @@ -130,8 +143,11 @@ if (!dvbdev) return -ENODEV; - if ((file->f_flags & O_ACCMODE) != O_RDONLY) + if ((file->f_flags & O_ACCMODE) == O_RDONLY) { + dvbdev->readers++; + } else { dvbdev->writers++; + } dvbdev->users++; return 0; diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c --- xx-linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c 2003-09-10 11:28:54.000000000 +0200 +++ linux-2.6.0-test5/drivers/media/dvb/dvb-core/dvb_frontend.c 2003-09-09 09:24:21.000000000 +0200 @@ -870,6 +886,7 @@ static const struct dvb_device dvbdev_template = { .users = ~0, .writers = 1, + .readers = (~0)-1, .fops = &dvb_frontend_fops, .kernel_ioctl = dvb_frontend_ioctl };
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |