From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: rkir@google.com, quintela@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vmstate: Add VMSTATE_OPAQUE to save/load complex data structures
Date: Thu, 23 May 2019 11:22:26 +0100 [thread overview]
Message-ID: <20190523102225.GA2994@work-vm> (raw)
In-Reply-To: <20190522222224.244714-1-rkir@google.com>
* rkir--- via Qemu-devel (qemu-devel@nongnu.org) wrote:
> From: Roman Kiryanov <rkir@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 <rkir@google.com>
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 / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2019-05-23 10:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 22:22 [Qemu-devel] [PATCH] vmstate: Add VMSTATE_OPAQUE to save/load complex data structures rkir--- via Qemu-devel
2019-05-23 10:22 ` Dr. David Alan Gilbert [this message]
2019-05-23 17:00 ` Roman Kiryanov via Qemu-devel
2019-05-24 9:03 ` Peter Maydell
2019-05-24 17:00 ` Roman Kiryanov via Qemu-devel
2019-05-24 17:29 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190523102225.GA2994@work-vm \
--to=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=rkir@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.