From: Roman Kiryanov <r...@google.com> 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 <r...@google.com> --- 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