Received: from eggs.gnu.org ([2001:4830:134:3::10]:56441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhPXR-0006eu-FQ for qemu-devel@nongnu.org; Mon, 05 May 2014 16:31:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhPXJ-0000rV-KS for qemu-devel@nongnu.org; Mon, 05 May 2014 16:31:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhPXJ-0000r2-Co for qemu-devel@nongnu.org; Mon, 05 May 2014 16:30:53 -0400 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.14.4/8.14.4) with ESMTP id s45KUp9p021306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 5 May 2014 16:30:52 -0400 From: Juan Quintela Date: Mon, 5 May 2014 22:30:01 +0200 Message-Id: <1399321834-31310-4-git-send-email-quintela@redhat.com> In-Reply-To: <1399321834-31310-1-git-send-email-quintela@redhat.com> References: <1399321834-31310-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 03/36] vmstate: add VMSTATE_VALIDATE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" From: "Michael S. Tsirkin" Validate state using VMS_ARRAY with num = 0 and VMS_MUST_EXIST Signed-off-by: Michael S. Tsirkin Signed-off-by: Juan Quintela --- include/migration/vmstate.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index de970ab..5b71370 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -204,6 +204,14 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = vmstate_offset_value(_state, _field, _type), \ } +/* Validate state using a boolean predicate. */ +#define VMSTATE_VALIDATE(_name, _test) { \ + .name = (_name), \ + .field_exists = (_test), \ + .flags = VMS_ARRAY | VMS_MUST_EXIST, \ + .num = 0, /* 0 elements: no data, only run _test */ \ +} + #define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \ .name = (stringify(_field)), \ .version_id = (_version), \ -- 1.9.0