* rkir--- via Qemu-devel ([email protected]) wrote:
> From: Roman Kiryanov <[email protected]>
>
> VMSTATE_OPAQUE allows passing user defined functions to save
> and load vmstate for cases when data structures do not fit
> into int/struct/array terms.
>
> Signed-off-by: Roman Kiryanov <[email protected]>
Hi Roman,
Thanks for the patch.
Can you give me an example of where you would use it? I've been
trying to get rid as many of the open-coded cases as possible
and try and make sure vmstate can handle it.
Having said that; would it be easier to pass the get/put functions
rather than the info ?
Dave
> ---
> include/migration/vmstate.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index 9224370ed5..2736daef17 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -737,6 +737,19 @@ extern const VMStateInfo vmstate_info_qtailq;
> .start = offsetof(_type, _next), \
> }
>
> +/* Provides a way to save/load complex data structures that do not
> + * fit into int/struct/array terms.
> + * _info: a user defined instance of VMStateInfo to handle saving and
> loading.
> + */
> +#define VMSTATE_OPAQUE(_name, _version, _info) { \
> + .name = _name, \
> + .version_id = (_version), \
> + .size = 0, \
> + .info = &(_info), \
> + .flags = VMS_SINGLE, \
> + .offset = 0, \
> +}
> +
> /* _f : field name
> _f_n : num of elements field_name
> _n : num of elements
> --
> 2.21.0.1020.gf2820cf01a-goog
>
>
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK