Re: [Qemu-devel] [PATCH v2] raw-posix: Detect CDROM via ioctl

2010-01-13 Thread Jamie Lokier
Christoph Hellwig wrote: > On Tue, Jan 12, 2010 at 10:29:11AM -0500, Cole Robinson wrote: > > static int cdrom_probe_device(const char *filename) > > { > > +int fd, ret, prio; > > + > > if (strstart(filename, "/dev/cd", NULL)) > > -return 100; > > -return 0; > > +prio

Re: [Qemu-devel] [PATCH v2] raw-posix: Detect CDROM via ioctl

2010-01-12 Thread Christoph Hellwig
On Tue, Jan 12, 2010 at 10:29:11AM -0500, Cole Robinson wrote: > static int cdrom_probe_device(const char *filename) > { > +int fd, ret, prio; > + > if (strstart(filename, "/dev/cd", NULL)) > -return 100; > -return 0; > +prio = 50; > + > +fd = open(filename, O_RDO

[Qemu-devel] [PATCH v2] raw-posix: Detect CDROM via ioctl

2010-01-12 Thread Cole Robinson
Current CDROM detection is hardcoded based on source file name. Make this smarter by attempting a CDROM specific ioctl. This makes '-cdrom /dev/sr0' succeed with no media present. v2: Give ioctl check higher priority than filename check Signed-off-by: Cole Robinson --- block/raw-posix.c | 19