Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MNmIv-0007SV-Qf for qemu-devel@nongnu.org; Mon, 06 Jul 2009 07:24:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MNmIr-0007KH-Am for qemu-devel@nongnu.org; Mon, 06 Jul 2009 07:24:13 -0400 Received: from [199.232.76.173] (port=54209 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MNmIq-0007Jw-VY for qemu-devel@nongnu.org; Mon, 06 Jul 2009 07:24:09 -0400 Received: from smtp.eu.citrix.com ([62.200.22.115]:12343) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MNmIq-0001Of-K1 for qemu-devel@nongnu.org; Mon, 06 Jul 2009 07:24:08 -0400 From: Bique Alexandre Subject: Re: [Qemu-devel] [PATCH 4/5] ATAPI pass through v2: bring the new ATAPI pass throug feature Date: Mon, 6 Jul 2009 12:23:22 +0100 References: <200907011932.09210.alexandre.bique@citrix.com> <20090705081533.GA32124@lst.de> In-Reply-To: <20090705081533.GA32124@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200907061223.22474.alexandre.bique@citrix.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: "qemu-devel@nongnu.org" On Sunday 05 July 2009 09:15:33 Christoph Hellwig wrote: > On Wed, Jul 01, 2009 at 07:32:09PM +0100, Bique Alexandre wrote: > > This patch brings the new ATAPI pass through feature. > > I really don't understand the need for the BDRV_TYPE_CDROM_PT block > device type. The use of BDRV_TYPE_* is mostly a hint for ide/scsi > what kind of device where dealing with, and a passthrough CDROM should > be different from a real one. I think we should just make any drive > that points to a hardware CDROM device use the passthrough code, similar > to how you'll get a hardware passthrough SCSI CDROM if you point the > -drive option to a /dev/sr* device for a host CDROM. In the beginning I was using bsg, so it was not a classical device on which you read/write/etc... It's useful there: @@ -2856,8 +2921,16 @@ static void ide_init2(IDEState *ide_state, if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { s->is_cdrom = 1; + s->atapi_cmd = ide_atapi_cmd; bdrv_set_change_cb(s->bs, cdrom_change_cb, s); } +#if CONFIG_ATAPI_PT + else if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM_PT) { + s->is_cdrom = 1; + s->atapi_cmd = ide_atapi_pt_cmd; + bdrv_set_change_cb(s->bs, cdrom_change_cb, s); + } +#endif /* CONFIG_ATAPI_PT */ } s->drive_serial = drive_serial++; strncpy(s->drive_serial_str, drive_get_serial(s->bs), So I need a flag somewhere to initialize IDEState as a CD-ROM pass through. Even if the emulation code and the pass through code uses the same device, they don't use it the same way: - read/write/seek/... (emulation) - ioctl (pass through) I think that it's good to keep a way to use the emulation code over the CD-ROM device. I'll look at a better way to do this. If you have any suggestion ? :-) Thanks Christoph. -- Alexandre Bique