From patchwork Sun Jan 17 14:48:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naphtali Sprei X-Patchwork-Id: 43029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id ABA1FB7CD5 for ; Mon, 18 Jan 2010 01:50:59 +1100 (EST) Received: from localhost ([127.0.0.1]:59637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWWSu-0003Cz-PB for incoming@patchwork.ozlabs.org; Sun, 17 Jan 2010 09:50:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWWQg-0002Sa-Iv for qemu-devel@nongnu.org; Sun, 17 Jan 2010 09:48:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWWQb-0002Po-Ks for qemu-devel@nongnu.org; Sun, 17 Jan 2010 09:48:37 -0500 Received: from [199.232.76.173] (port=53795 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWWQb-0002Pl-I4 for qemu-devel@nongnu.org; Sun, 17 Jan 2010 09:48:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20621) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWWQa-0008UE-T4 for qemu-devel@nongnu.org; Sun, 17 Jan 2010 09:48:33 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0HEmVUE017758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 17 Jan 2010 09:48:32 -0500 Received: from localhost.localdomain (dhcp-0-60.tlv.redhat.com [10.35.0.60]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0HEmSil022902; Sun, 17 Jan 2010 09:48:30 -0500 From: Naphtali Sprei To: qemu-devel@nongnu.org Date: Sun, 17 Jan 2010 16:48:12 +0200 Message-Id: <1263739695-13043-2-git-send-email-nsprei@redhat.com> In-Reply-To: <1263739695-13043-1-git-send-email-nsprei@redhat.com> References: <1263739695-13043-1-git-send-email-nsprei@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Naphtali Sprei Subject: [Qemu-devel] [PATCH v2 1/4] Make CDROM a read-only drive X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Naphtali Sprei --- vl.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index 06cb40d..76ef8ca 100644 --- a/vl.c +++ b/vl.c @@ -2233,6 +2233,13 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, } (void)bdrv_set_read_only(dinfo->bdrv, 1); } + /* + * cdrom is read-only. Set it now, after above interface checking + * since readonly attribute not explicitly required, so no error. + */ + if (media == MEDIA_CDROM) { + (void)bdrv_set_read_only(dinfo->bdrv, 1); + } if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) { fprintf(stderr, "qemu: could not open disk image %s: %s\n",