Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtNA7-0006ng-Fw for qemu-devel@nongnu.org; Sun, 21 Mar 2010 11:33:59 -0400 Received: from [199.232.76.173] (port=56730 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtNA6-0006nY-QK for qemu-devel@nongnu.org; Sun, 21 Mar 2010 11:33:58 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NtNA5-0004XP-Nb for qemu-devel@nongnu.org; Sun, 21 Mar 2010 11:33:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26944) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NtNA5-0004XH-Ci for qemu-devel@nongnu.org; Sun, 21 Mar 2010 11:33:57 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2LFXt0h032417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 21 Mar 2010 11:33:56 -0400 Received: from localhost.localdomain (dhcp-0-60.tlv.redhat.com [10.35.0.60]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2LFXsP5023585 for ; Sun, 21 Mar 2010 11:33:55 -0400 From: Naphtali Sprei Date: Sun, 21 Mar 2010 17:33:53 +0200 Message-Id: <1269185633-31750-1-git-send-email-nsprei@redhat.com> Subject: [Qemu-devel] [PATCH] read-only: allow read-only CDROM with any interface List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Naphtali Sprei --- vl.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/vl.c b/vl.c index 2e38b77..d3863d7 100644 --- a/vl.c +++ b/vl.c @@ -1255,19 +1255,16 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, bdrv_flags &= ~BDRV_O_NATIVE_AIO; } - if (ro == 1) { + if (media == MEDIA_CDROM) { + ro = 1; + } + if (ro == 1 && + media != MEDIA_CDROM) { /* CDROM is fine for any interface, don't check */ if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY) { fprintf(stderr, "qemu: readonly flag not supported for drive with this interface\n"); return NULL; } } - /* - * cdrom is read-only. Set it now, after above interface checking - * since readonly attribute not explicitly required, so no error. - */ - if (media == MEDIA_CDROM) { - ro = 1; - } bdrv_flags |= ro ? 0 : BDRV_O_RDWR; if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) { -- 1.6.3.3