[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] vmstate: Add VMSTATE_OPAQUE to save/load comple
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH] vmstate: Add VMSTATE_OPAQUE to save/load complex data structures |
Date: |
Thu, 23 May 2019 11:22:26 +0100 |
User-agent: |
Mutt/1.11.4 (2019-03-13) |
* rkir--- via Qemu-devel (address@hidden) wrote:
> From: Roman Kiryanov <address@hidden>
>
> 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 <address@hidden>
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 / address@hidden / Manchester, UK