From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwtNm-0003Sw-8C for qemu-devel@nongnu.org; Fri, 26 Aug 2011 06:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwtNk-0002YT-Qd for qemu-devel@nongnu.org; Fri, 26 Aug 2011 06:11:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwtNk-0002YJ-F5 for qemu-devel@nongnu.org; Fri, 26 Aug 2011 06:11:24 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7QABNVR022906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Aug 2011 06:11:23 -0400 From: Gerd Hoffmann Date: Fri, 26 Aug 2011 12:11:20 +0200 Message-Id: <1314353480-14169-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann ... to make vmstate id string truely unique with multiple host controllers, i.e. move from "1/usb-ptr" to "0000:00:01.3/1/usb-ptr" (usb tabled connected to piix3 uhci). Obvious problem with that is that it breaks migration from and to older versions, thats why it is RfC. I don't see any way to fix the issue without breaking though. So the question is how to deal with that best? Given that we plan to break the migration anyway for 1.0 one option would be to just wait a bit and merge this as part of the new migration protocol patch series. Comments? Signed-off-by: Gerd Hoffmann --- hw/usb-bus.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/hw/usb-bus.c b/hw/usb-bus.c index c0bbc7c..477d57f 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -342,7 +342,20 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) static char *usb_get_dev_path(DeviceState *qdev) { USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev); - return g_strdup(dev->port->path); + DeviceState *hcd = qdev->parent_bus->parent; + char *id = NULL; + + if (hcd && hcd->parent_bus && hcd->parent_bus->info->get_dev_path) { + id = hcd->parent_bus->info->get_dev_path(hcd); + } + if (id) { + int len = strlen(id)+strlen(dev->port->path)+2; + char *ret = g_malloc(len); + snprintf(ret, len, "%s/%s", id, dev->port->path); + return ret; + } else { + return g_strdup(dev->port->path); + } } static char *usb_get_fw_dev_path(DeviceState *qdev) -- 1.7.1