qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Naphtali Sprei <nsprei@redhat.com>
To: qemu-devel@nongnu.org
Cc: Naphtali Sprei <nsprei@redhat.com>
Subject: [Qemu-devel] [PATCH 2/3] Ask for read-write permissions when opening files
Date: Thu, 21 Jan 2010 14:40:39 +0200	[thread overview]
Message-ID: <1264077641-17902-6-git-send-email-nsprei@redhat.com> (raw)
In-Reply-To: <1264077641-17902-5-git-send-email-nsprei@redhat.com>

Found some places that seems needs this explicitly, now that
read-write is not the default.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
---
 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);
-- 
1.6.3.3

  reply	other threads:[~2010-01-21 12:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 12:40 [Qemu-devel] [PATCH 0/3] Even more read-write/read-only fixes and cleanup Naphtali Sprei
2010-01-21 12:40 ` [Qemu-devel] [PATCH 0/3] *** SUBJECT HERE *** Naphtali Sprei
2010-01-21 12:40   ` Naphtali Sprei
2010-01-21 12:40     ` [Qemu-devel] [PATCH 1/3] No need anymoe for bdrv_set_read_only Naphtali Sprei
2010-01-21 12:40       ` [Qemu-devel] [PATCH 1/3] No need anymore " Naphtali Sprei
2010-01-21 12:40         ` Naphtali Sprei [this message]
2010-01-21 12:40           ` [Qemu-devel] [PATCH 2/3] Ask for read-write permissions when opening files where needed Naphtali Sprei
2010-01-21 12:40             ` [Qemu-devel] [PATCH 3/3] Read-only device changed to opens it's file for read-only Naphtali Sprei
2010-01-26 22:05       ` [Qemu-devel] [PATCH 1/3] No need anymoe for bdrv_set_read_only Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264077641-17902-6-git-send-email-nsprei@redhat.com \
    --to=nsprei@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).