From patchwork Thu Jan 21 12:40:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naphtali Sprei X-Patchwork-Id: 43434 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 1FB41B7CB9 for ; Thu, 21 Jan 2010 23:58:06 +1100 (EST) Received: from localhost ([127.0.0.1]:40209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXwX1-0006R2-Az for incoming@patchwork.ozlabs.org; Thu, 21 Jan 2010 07:53:03 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXwLd-00034A-8R for qemu-devel@nongnu.org; Thu, 21 Jan 2010 07:41:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXwLY-00030B-G1 for qemu-devel@nongnu.org; Thu, 21 Jan 2010 07:41:16 -0500 Received: from [199.232.76.173] (port=37382 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXwLY-0002zx-8X for qemu-devel@nongnu.org; Thu, 21 Jan 2010 07:41:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12704) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXwLX-00081c-4U for qemu-devel@nongnu.org; Thu, 21 Jan 2010 07:41:11 -0500 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 o0LCfASI001410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Jan 2010 07:41:10 -0500 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 o0LCewTT029585; Thu, 21 Jan 2010 07:41:08 -0500 From: Naphtali Sprei To: qemu-devel@nongnu.org Date: Thu, 21 Jan 2010 14:40:40 +0200 Message-Id: <1264077641-17902-7-git-send-email-nsprei@redhat.com> In-Reply-To: <1264077641-17902-6-git-send-email-nsprei@redhat.com> References: <1264077641-17902-1-git-send-email-nsprei@redhat.com> <1264077641-17902-2-git-send-email-nsprei@redhat.com> <1264077641-17902-3-git-send-email-nsprei@redhat.com> <1264077641-17902-4-git-send-email-nsprei@redhat.com> <1264077641-17902-5-git-send-email-nsprei@redhat.com> <1264077641-17902-6-git-send-email-nsprei@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Naphtali Sprei Subject: [Qemu-devel] [PATCH 2/3] Ask for read-write permissions when opening files where needed 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 Found some places that seems needs this explicitly, now that read-write is not the default. Signed-off-by: Naphtali Sprei --- block/qcow2.c | 2 +- block/vvfat.c | 2 +- qemu-img.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 6622eba..91835f1 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -961,7 +961,7 @@ static int qcow_create2(const char *filename, int64_t total_size, if (prealloc) { BlockDriverState *bs; bs = bdrv_new(""); - bdrv_open(bs, filename, BDRV_O_CACHE_WB); + bdrv_open(bs, filename, BDRV_O_CACHE_WB | BDRV_O_RDWR); preallocate(bs); bdrv_close(bs); } diff --git a/block/vvfat.c b/block/vvfat.c index 063f731..8e12f92 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2787,7 +2787,7 @@ static int enable_write_target(BDRVVVFATState *s) if (bdrv_create(bdrv_qcow, s->qcow_filename, options) < 0) return -1; s->qcow = bdrv_new(""); - if (s->qcow == NULL || bdrv_open(s->qcow, s->qcow_filename, 0) < 0) + if (s->qcow == NULL || bdrv_open(s->qcow, s->qcow_filename, BDRV_O_RDWR) < 0) return -1; #ifndef _WIN32 diff --git a/qemu-img.c b/qemu-img.c index 3cea8ce..cbba4fc 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1116,7 +1116,7 @@ static int img_rebase(int argc, char **argv) if (!bs) error("Not enough memory"); - flags = BRDV_O_FLAGS | (unsafe ? BDRV_O_NO_BACKING : 0); + flags = BRDV_O_FLAGS | BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0); if (bdrv_open2(bs, filename, flags, NULL) < 0) { error("Could not open '%s'", filename); } @@ -1157,7 +1157,7 @@ static int img_rebase(int argc, char **argv) } bs_new_backing = bdrv_new("new_backing"); - if (bdrv_open2(bs_new_backing, out_baseimg, BRDV_O_FLAGS, + if (bdrv_open2(bs_new_backing, out_baseimg, BRDV_O_FLAGS | BDRV_O_RDWR, new_backing_drv)) { error("Could not open new backing file '%s'", backing_name);