From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSOvJ-0001EG-8p for qemu-devel@nongnu.org; Tue, 25 Mar 2014 06:49:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSOvC-0002ip-WF for qemu-devel@nongnu.org; Tue, 25 Mar 2014 06:49:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSOvC-0002hT-Nj for qemu-devel@nongnu.org; Tue, 25 Mar 2014 06:49:30 -0400 Date: Tue, 25 Mar 2014 10:49:24 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20140325104923.GD2459@work-vm> References: <1395698484-22562-1-git-send-email-mst@redhat.com> <1395698484-22562-3-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1395698484-22562-3-git-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC v3 2/3] vmstate: add VMSTATE_TEST List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Peter Maydell , qemu-devel@nongnu.org * Michael S. Tsirkin (mst@redhat.com) wrote: > Can validate state using VMS_NONE and VMS_MUST_EXIST Old comment, VMS_NONE being dead. > Signed-off-by: Michael S. Tsirkin > --- > include/migration/vmstate.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > index de970ab..97629b7 100644 > --- a/include/migration/vmstate.h > +++ b/include/migration/vmstate.h > @@ -204,6 +204,12 @@ extern const VMStateInfo vmstate_info_bitmap; > .offset = vmstate_offset_value(_state, _field, _type), \ > } > > +#define VMSTATE_TEST(_name, _test) { \ > + .name = (_name), \ > + .field_exists = (_test), \ > + .flags = VMS_ARRAY | VMS_MUST_EXIST, \ Please comment this to say it's using the 0 sized array trick, (personally I'd explicitly set .num = 0 as well). Dave > +} > + > #define VMSTATE_POINTER(_field, _state, _version, _info, _type) { \ > .name = (stringify(_field)), \ > .version_id = (_version), \ > -- > MST > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK