From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [PATCH 1/2] xen: Don't change -drive if=xen device name during machine init
Date: Tue, 5 Jun 2012 14:51:07 +0200 [thread overview]
Message-ID: <1338900668-6093-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1338900668-6093-1-git-send-email-armbru@redhat.com>
A "top" BlockDriverState has a non-empty device_name. If the user
doesn't specify one with -drive parameter id, the system supplies a
default name.
xen_config_dev_blk() changes this name, during machine initialization.
Naughty. Don't do that.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/xen_devconfig.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c
index 41accbb..7b7b0a2 100644
--- a/hw/xen_devconfig.c
+++ b/hw/xen_devconfig.c
@@ -94,16 +94,15 @@ static int xen_config_dev_all(char *fe, char *be)
int xen_config_dev_blk(DriveInfo *disk)
{
- char fe[256], be[256];
+ char fe[256], be[256], device_name[32];
int vdev = 202 * 256 + 16 * disk->unit;
int cdrom = disk->media_cd;
const char *devtype = cdrom ? "cdrom" : "disk";
const char *mode = cdrom ? "r" : "w";
- snprintf(disk->bdrv->device_name, sizeof(disk->bdrv->device_name),
- "xvd%c", 'a' + disk->unit);
+ snprintf(device_name, sizeof(device_name), "xvd%c", 'a' + disk->unit);
xen_be_printf(NULL, 1, "config disk %d [%s]: %s\n",
- disk->unit, disk->bdrv->device_name, disk->bdrv->filename);
+ disk->unit, device_name, disk->bdrv->filename);
xen_config_dev_dirs("vbd", "qdisk", vdev, fe, be, sizeof(fe));
/* frontend */
@@ -111,7 +110,7 @@ int xen_config_dev_blk(DriveInfo *disk)
xenstore_write_str(fe, "device-type", devtype);
/* backend */
- xenstore_write_str(be, "dev", disk->bdrv->device_name);
+ xenstore_write_str(be, "dev", device_name);
xenstore_write_str(be, "type", "file");
xenstore_write_str(be, "params", disk->bdrv->filename);
xenstore_write_str(be, "mode", mode);
--
1.7.6.5
next prev parent reply other threads:[~2012-06-05 12:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-05 12:51 [Qemu-devel] [PATCH 0/2] xen: Clean up BlockDriverState use Markus Armbruster
2012-06-05 12:51 ` Markus Armbruster [this message]
2012-06-05 12:51 ` [Qemu-devel] [PATCH 2/2] xen: Don't peek behind the BlockDriverState abstraction Markus Armbruster
2012-06-05 16:59 ` Stefano Stabellini
2012-06-06 11:39 ` Markus Armbruster
2012-06-06 12:23 ` Stefano Stabellini
2012-06-06 11:52 ` Peter Maydell
2012-06-06 12:55 ` Markus Armbruster
2012-06-07 0:07 ` Peter Maydell
2012-06-07 8:13 ` Markus Armbruster
2012-06-07 12:49 ` Peter Maydell
2012-06-13 7:35 ` Markus Armbruster
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=1338900668-6093-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
/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).