From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHEt1-00087b-WA for qemu-devel@nongnu.org; Fri, 21 Oct 2011 09:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RHEt0-00043k-J9 for qemu-devel@nongnu.org; Fri, 21 Oct 2011 09:11:47 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:60864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHEt0-00043I-GB for qemu-devel@nongnu.org; Fri, 21 Oct 2011 09:11:46 -0400 Received: by gyg10 with SMTP id 10so4662568gyg.4 for ; Fri, 21 Oct 2011 06:11:46 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4EA16F8C.30508@redhat.com> Date: Fri, 21 Oct 2011 15:11:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1318503845-11473-1-git-send-email-pbonzini@redhat.com> <1318503845-11473-12-git-send-email-pbonzini@redhat.com> <4EA15AC0.6060708@redhat.com> In-Reply-To: <4EA15AC0.6060708@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/35] scsi-disk: support READ DVD STRUCTURE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On 10/21/2011 01:42 PM, Kevin Wolf wrote: >> > + if (s->qdev.type != TYPE_ROM || !bdrv_is_inserted(s->bs)) { >> > + return -1; >> > + } >> > + if (s->tray_open || !bdrv_is_inserted(s->bs)) { >> > + scsi_check_condition(r, SENSE_CODE(NO_MEDIUM)); >> > + return -1; >> > + } > You are checking twice for bdrv_is_inserted, which one do you really mean? The first is bogus. > Also, format = 0xff should work even without a medium. Will move the tray_open/bdrv_is_inserted/media_is_cd tests within the "if (format != 0xff)". >> > + if (media_is_cd(s)) { >> > + scsi_check_condition(r, SENSE_CODE(INCOMPATIBLE_FORMAT)); >> > + return -1; >> > + } >> > + if (media != 0) { >> > + scsi_check_condition(r, SENSE_CODE(INCOMPATIBLE_FORMAT)); >> > + return -1; >> > + } media != 0 should return INVALID_FIELD too. Paolo