From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS60j-0001ts-9W for qemu-devel@nongnu.org; Mon, 24 Mar 2014 10:37:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WS60d-0008So-Ay for qemu-devel@nongnu.org; Mon, 24 Mar 2014 10:37:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WS60d-0008S5-3R for qemu-devel@nongnu.org; Mon, 24 Mar 2014 10:37:51 -0400 Date: Mon, 24 Mar 2014 16:37:58 +0200 From: "Michael S. Tsirkin" Message-ID: <1395671853-2685-3-git-send-email-mst@redhat.com> References: <1395671853-2685-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1395671853-2685-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [RFC v2 2/5] vmstate: add VMS_NONE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell The element with this flags value is skipped. Signed-off-by: Michael S. Tsirkin --- include/migration/vmstate.h | 1 + vmstate.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index e7e1705..3a1587e 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -88,6 +88,7 @@ struct VMStateInfo { }; enum VMStateFlags { + VMS_NONE = 0x000, VMS_SINGLE = 0x001, VMS_POINTER = 0x002, VMS_ARRAY = 0x004, diff --git a/vmstate.c b/vmstate.c index 18b3732..fe53735 100644 --- a/vmstate.c +++ b/vmstate.c @@ -13,7 +13,9 @@ static int vmstate_n_elems(void *opaque, VMStateField *field) { int n_elems = 1; - if (field->flags & VMS_ARRAY) { + if (!(field->flags & ~VMS_NONE)) { + n_elems = 0; + } else if (field->flags & VMS_ARRAY) { n_elems = field->num; } else if (field->flags & VMS_VARRAY_INT32) { n_elems = *(int32_t *)(opaque+field->num_offset); -- MST