qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 6/7] block: push bdrv_change_backing_file error checking up from drivers
Date: Thu,  5 Apr 2012 17:43:00 +0200	[thread overview]
Message-ID: <1333640581-25649-7-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1333640581-25649-1-git-send-email-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block.c       |    5 +++++
 block/qcow2.c |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block.c b/block.c
index e806ad8..e293882 100644
--- a/block.c
+++ b/block.c
@@ -1403,6 +1403,11 @@ int bdrv_change_backing_file(BlockDriverState *bs,
 {
     BlockDriver *drv = bs->drv;
 
+    /* Backing file format doesn't make sense without a backing file */
+    if (backing_fmt && !backing_file) {
+        return -EINVAL;
+    }
+
     if (drv->bdrv_change_backing_file != NULL) {
         return drv->bdrv_change_backing_file(bs, backing_file, backing_fmt);
     } else {
diff --git a/block/qcow2.c b/block/qcow2.c
index 70d3141..342d8ff 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -843,11 +843,6 @@ fail:
 static int qcow2_change_backing_file(BlockDriverState *bs,
     const char *backing_file, const char *backing_fmt)
 {
-    /* Backing file format doesn't make sense without a backing file */
-    if (backing_fmt && !backing_file) {
-        return -EINVAL;
-    }
-
     pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: "");
     pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: "");
 
-- 
1.7.9.3

  parent reply	other threads:[~2012-04-05 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 15:42 [Qemu-devel] [PATCH 0/7] Miscellaneous fixes for block and snapshots Paolo Bonzini
2012-04-05 15:42 ` [Qemu-devel] [PATCH 1/7] block: add mode argument to blockdev-snapshot-sync Paolo Bonzini
2012-04-05 15:42 ` [Qemu-devel] [PATCH 2/7] block: fail live snapshot if disk has no medium Paolo Bonzini
2012-04-05 15:42 ` [Qemu-devel] [PATCH 3/7] block: fix snapshot with QED format Paolo Bonzini
2012-04-05 15:42 ` [Qemu-devel] [PATCH 5/7] block: pass new base image format to bdrv_change_backing_file Paolo Bonzini
2012-04-05 15:43 ` Paolo Bonzini [this message]
2012-04-05 15:43 ` [Qemu-devel] [PATCH 7/7] block: update in-memory backing file and format Paolo Bonzini

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=1333640581-25649-7-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@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).