From: Michael S. Tsirkin Date: Thu, 3 Apr 2014 16:50:35 +0000 (+0300) Subject: vmstate: add VMSTATE_VALIDATE X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4082f0889ba04678fc14816c53e1b9251ea9207e;p=qmiga%2Fqemu.git vmstate: add VMSTATE_VALIDATE Validate state using VMS_ARRAY with num = 0 and VMS_MUST_EXIST Signed-off-by: Michael S. Tsirkin Signed-off-by: Juan Quintela --- diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index de970abedd..5b7137058d 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), \