From patchwork Tue Sep 1 07:56:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 32725 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 029E2B7B74 for ; Tue, 1 Sep 2009 17:57:21 +1000 (EST) Received: from localhost ([127.0.0.1]:53883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiOEv-0006ul-Ov for incoming@patchwork.ozlabs.org; Tue, 01 Sep 2009 03:57:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiOE7-0006kK-Uv for qemu-devel@nongnu.org; Tue, 01 Sep 2009 03:56:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiOE2-0006iX-5d for qemu-devel@nongnu.org; Tue, 01 Sep 2009 03:56:26 -0400 Received: from [199.232.76.173] (port=47421 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiOE1-0006iS-SN for qemu-devel@nongnu.org; Tue, 01 Sep 2009 03:56:21 -0400 Received: from mx20.gnu.org ([199.232.41.8]:3475) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MiOE1-0008FO-Cr for qemu-devel@nongnu.org; Tue, 01 Sep 2009 03:56:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiOE0-0001LA-MC for qemu-devel@nongnu.org; Tue, 01 Sep 2009 03:56:20 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n817uJNH023741 for ; Tue, 1 Sep 2009 03:56:19 -0400 Received: from zweiblum.home.kraxel.org (vpn1-4-213.ams2.redhat.com [10.36.4.213]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n817uHKo030727; Tue, 1 Sep 2009 03:56:18 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 5837C700D7; Tue, 1 Sep 2009 09:56:16 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 1 Sep 2009 09:56:14 +0200 Message-Id: <1251791775-5358-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1251791775-5358-1-git-send-email-kraxel@redhat.com> References: <1251791775-5358-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Detected-Operating-System: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 3/4] qdev: integrate vmstate 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/qdev.c | 6 ++++++ hw/qdev.h | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index e045968..288f95b 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -218,12 +218,18 @@ int qdev_init(DeviceState *dev) return rc; if (dev->info->reset) qemu_register_reset(dev->info->reset, dev); + if (dev->info->vmsd) + vmstate_register(-1, dev->info->vmsd, dev); return 0; } /* Unlink device from bus and free the structure. */ void qdev_free(DeviceState *dev) { +#if 0 /* FIXME: need sane vmstate_unregister function */ + if (dev->info->vmsd) + vmstate_unregister(dev->info->vmsd, dev); +#endif if (dev->info->reset) qemu_unregister_reset(dev->info->reset, dev); LIST_REMOVE(dev, sibling); diff --git a/hw/qdev.h b/hw/qdev.h index fde29ea..103489d 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -113,6 +113,9 @@ struct DeviceInfo { /* callbacks */ QEMUResetHandler *reset; + /* device state */ + const VMStateDescription *vmsd; + /* Private to qdev / bus. */ qdev_initfn init; BusInfo *bus_info;