From patchwork Wed Jun 6 17:35:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 163406 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 45184B6F86 for ; Thu, 7 Jun 2012 03:35:59 +1000 (EST) Received: from localhost ([::1]:54874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScK9F-0004tT-1R for incoming@patchwork.ozlabs.org; Wed, 06 Jun 2012 13:35:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScK8s-0004bz-8q for qemu-devel@nongnu.org; Wed, 06 Jun 2012 13:35:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ScK8h-0001rW-FO for qemu-devel@nongnu.org; Wed, 06 Jun 2012 13:35:33 -0400 Received: from oxygen.pond.sub.org ([78.46.104.156]:39393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ScK8h-0001qC-9G for qemu-devel@nongnu.org; Wed, 06 Jun 2012 13:35:23 -0400 Received: from blackfin.pond.sub.org (p57B0FC93.dip.t-dialin.net [87.176.252.147]) by oxygen.pond.sub.org (Postfix) with ESMTPA id ABE14A5A48; Wed, 6 Jun 2012 19:35:20 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id C159260095; Wed, 6 Jun 2012 19:35:19 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 6 Jun 2012 19:35:18 +0200 Message-Id: <1339004119-3245-2-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1339004119-3245-1-git-send-email-armbru@redhat.com> References: <1339004119-3245-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.46.104.156 Cc: kwolf@redhat.com, stefano.stabellini@eu.citrix.com Subject: [Qemu-devel] [PATCH v2 1/2] xen: Don't change -drive if=xen device name during machine init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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);