From patchwork Mon Jan 24 16:30:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 80214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9A032B710F for ; Tue, 25 Jan 2011 03:50:12 +1100 (EST) Received: from localhost ([127.0.0.1]:59158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhPcH-0002DG-TC for incoming@patchwork.ozlabs.org; Mon, 24 Jan 2011 11:50:10 -0500 Received: from [140.186.70.92] (port=49981 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhPJq-0001vc-Bh for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:31:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhPJo-0000Si-K3 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:31:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhPJo-0000SP-Ch for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:31:04 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OGV3dK013182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jan 2011 11:31:03 -0500 Received: from rincewind.home.kraxel.org (vpn1-5-238.ams2.redhat.com [10.36.5.238]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0OGV2VN022016; Mon, 24 Jan 2011 11:31:03 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 544EE413E5; Mon, 24 Jan 2011 17:30:56 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 24 Jan 2011 17:30:53 +0100 Message-Id: <1295886655-32312-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1295886655-32312-1-git-send-email-kraxel@redhat.com> References: <1295886655-32312-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 6/8] usb hub: add migration support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/usb-hub.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/hw/usb-hub.c b/hw/usb-hub.c index 78698ca..3dd31ba 100644 --- a/hw/usb-hub.c +++ b/hw/usb-hub.c @@ -544,11 +544,35 @@ static int usb_hub_initfn(USBDevice *dev) return 0; } +static const VMStateDescription vmstate_usb_hub_port = { + .name = "usb-hub-port", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField []) { + VMSTATE_UINT16(wPortStatus, USBHubPort), + VMSTATE_UINT16(wPortChange, USBHubPort), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_usb_hub = { + .name = "usb-hub", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField []) { + VMSTATE_USB_DEVICE(dev, USBHubState), + VMSTATE_STRUCT_ARRAY(ports, USBHubState, NUM_PORTS, 0, + vmstate_usb_hub_port, USBHubPort), + VMSTATE_END_OF_LIST() + } +}; + static struct USBDeviceInfo hub_info = { .product_desc = "QEMU USB Hub", .qdev.name = "usb-hub", .qdev.fw_name = "hub", .qdev.size = sizeof(USBHubState), + .qdev.vmsd = &vmstate_usb_hub, .usb_desc = &desc_hub, .init = usb_hub_initfn, .handle_packet = usb_hub_handle_packet,