qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org, kraxel@redhat.com
Subject: Re: [PATCH for-10.1 09/10] ui/vdagent: add migration support
Date: Fri, 9 May 2025 12:38:13 +0100	[thread overview]
Message-ID: <aB3pJXHoHsJz2p5Y@redhat.com> (raw)
In-Reply-To: <20250311155932.1472092-10-marcandre.lureau@redhat.com>

On Tue, Mar 11, 2025 at 07:59:31PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  ui/vdagent.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 139 insertions(+)
> 
> diff --git a/ui/vdagent.c b/ui/vdagent.c
> index 125c659af7..cc5738a6ea 100644
> --- a/ui/vdagent.c
> +++ b/ui/vdagent.c
> @@ -10,6 +10,7 @@
>  #include "ui/clipboard.h"
>  #include "ui/console.h"
>  #include "ui/input.h"
> +#include "migration/vmstate.h"
>  #include "trace.h"


> +static int put_cbinfo(QEMUFile *f, void *pv, size_t size,
> +                      const VMStateField *field, JSONWriter *vmdesc)
> +{
> +    VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(pv);
> +    struct CBInfoArray cbinfo = { 0, };

Just ' = {}' should be sufficient to initialize all fields.

> +    int i;
> +
> +    if (!have_clipboard(vd)) {
> +        return 0;
> +    }
> +
> +    for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) {
> +        if (qemu_clipboard_peer_owns(&vd->cbpeer, i)) {
> +             cbinfo.cbinfo[cbinfo.n++] = *qemu_clipboard_info(i);
> +        }
> +    }
> +
> +    return vmstate_save_state(f, &vmstate_cbinfo_array, &cbinfo, vmdesc);
> +}
> +
> +static int get_cbinfo(QEMUFile *f, void *pv, size_t size,
> +                      const VMStateField *field)
> +{
> +    VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(pv);
> +    struct CBInfoArray cbinfo = { 0, };

Likewise.

> +    int i, ret;
> +
> +    if (!have_clipboard(vd)) {
> +        return 0;
> +    }
> +
> +    vdagent_clipboard_peer_register(vd);
> +
> +    ret = vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0);
> +    if (ret) {
> +        return ret;
> +    }
> +
> +    for (i = 0; i < cbinfo.n; i++) {
> +        g_autoptr(QemuClipboardInfo) info = qemu_clipboard_info_new(&vd->cbpeer, cbinfo.cbinfo[i].selection);
> +        /* this will steal clipboard data pointer from cbinfo.types */
> +        memcpy(info->types, cbinfo.cbinfo[i].types, sizeof(cbinfo.cbinfo[i].types));
> +        qemu_clipboard_update(info);
> +    }
> +
> +    return 0;
> +}


Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-05-09 11:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 15:59 [PATCH for-10.1 00/10] Support vdagent migration marcandre.lureau
2025-03-11 15:59 ` [PATCH for-10.1 01/10] ui/gtk: warn if setting the clipboard failed marcandre.lureau
2025-05-09 11:24   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 02/10] ui/clipboard: use int for selection field marcandre.lureau
2025-05-09 11:25   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 03/10] ui/clipboard: split out QemuClipboardContent marcandre.lureau
2025-05-09 11:25   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 04/10] ui/clipboard: add vmstate_cbinfo marcandre.lureau
2025-05-09 11:26   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 05/10] ui/clipboard: delay clipboard update when not running marcandre.lureau
2025-05-09 11:29   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 06/10] ui/vdagent: replace Buffer with GByteArray marcandre.lureau
2025-05-09 11:30   ` Daniel P. Berrangé
2025-05-09 14:49     ` Marc-André Lureau
2025-03-11 15:59 ` [PATCH for-10.1 07/10] ui/vdagent: keep "connected" state marcandre.lureau
2025-05-09 11:31   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 08/10] ui/vdagent: factor out clipboard peer registration marcandre.lureau
2025-05-09 11:32   ` Daniel P. Berrangé
2025-03-11 15:59 ` [PATCH for-10.1 09/10] ui/vdagent: add migration support marcandre.lureau
2025-05-09 11:38   ` Daniel P. Berrangé [this message]
2025-03-11 15:59 ` [PATCH for-10.1 10/10] ui/vdagent: remove migration blocker marcandre.lureau
2025-03-20  8:38   ` Prasad Pandit
2025-03-20  9:05     ` Marc-André Lureau
2025-05-09 11:39   ` Daniel P. Berrangé
2025-03-11 16:12 ` [PATCH for-10.1 00/10] Support vdagent migration Daniel P. Berrangé
2025-05-06 10:38   ` Marc-André Lureau

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=aB3pJXHoHsJz2p5Y@redhat.com \
    --to=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).