From patchwork Wed Jul 20 10:09:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 105658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7AE98B6F6B for ; Wed, 20 Jul 2011 21:53:35 +1000 (EST) Received: from localhost ([::1]:45166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjVLH-0006Tf-AA for incoming@patchwork.ozlabs.org; Wed, 20 Jul 2011 07:53:31 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjTj0-00055g-J6 for qemu-devel@nongnu.org; Wed, 20 Jul 2011 06:09:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjTiy-0001xM-MJ for qemu-devel@nongnu.org; Wed, 20 Jul 2011 06:09:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjTiy-0001wx-7h for qemu-devel@nongnu.org; Wed, 20 Jul 2011 06:09:52 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6KA9oFE013819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Jul 2011 06:09:50 -0400 Received: from rincewind.home.kraxel.org (vpn1-5-220.ams2.redhat.com [10.36.5.220]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6KA9kAP032063; Wed, 20 Jul 2011 06:09:48 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 3ECA0405B6; Wed, 20 Jul 2011 12:09:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 20 Jul 2011 12:09:32 +0200 Message-Id: <1311156579-9814-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1311156579-9814-1-git-send-email-kraxel@redhat.com> References: <1311156579-9814-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/9] vmstate: complain about devices without vmstate 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 Signed-off-by: Gerd Hoffmann --- hw/hw.h | 2 ++ hw/qdev.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index df6ca65..d839af1 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -336,6 +336,8 @@ struct VMStateDescription { const VMStateSubsection *subsections; }; +#define VMSD_NONE ((const VMStateDescription*)1) + extern const VMStateInfo vmstate_info_bool; extern const VMStateInfo vmstate_info_int8; diff --git a/hw/qdev.c b/hw/qdev.c index 292b52f..fafbbae 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -283,7 +283,12 @@ int qdev_init(DeviceState *dev) qdev_free(dev); return rc; } - if (dev->info->vmsd) { + if (dev->info->vmsd == NULL) { + /* TODO: fixup qemu source code, then make this an assert() */ + error_report("WARNING: device %s has no vmstate\n", dev->info->name); + } else if (dev->info->vmsd == VMSD_NONE) { + /* device doesn't need vmstate */; + } else { vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev, dev->instance_id_alias, dev->alias_required_for_version);