From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, kwolf@redhat.com,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>
Subject: Re: [PATCH v3 09/13] qio: Provide accessor around QIONetListener->sioc
Date: Thu, 13 Nov 2025 09:03:06 +0000 [thread overview]
Message-ID: <aRWeyr7xMovosK0X@redhat.com> (raw)
In-Reply-To: <20251112224032.864420-24-eblake@redhat.com>
On Wed, Nov 12, 2025 at 04:31:09PM -0600, Eric Blake wrote:
> An upcoming patch needs to pass more than just sioc as the opaque
> pointer to an AioContext; but since our AioContext code in general
> (and its QIO Channel wrapper code) lacks a notify callback present
> with GSource, we do not have the trivial option of just g_malloc'ing a
> small struct to hold all that data coupled with a notify of g_free.
> Instead, the data pointer must outlive the registered handler; in
> fact, having the data pointer have the same lifetime as QIONetListener
> is adequate.
>
> But the cleanest way to stick such a helper struct in QIONetListener
> will be to rearrange internal struct members. And that in turn means
> that all existing code that currently directly accesses
> listener->nsioc and listener->sioc[] should instead go through
> accessor functions, to be immune to the upcoming struct layout
> changes. So this patch adds accessor methods qio_net_listener_nsioc()
> and qio_net_listener_sioc(), and puts them to use.
>
> While at it, notice that the pattern of grabbing an sioc from the
> listener only to turn around can call
> qio_channel_socket_get_local_address is common enough to also warrant
> the helper of qio_net_listener_get_local_address, and fix a copy-paste
> error in the corresponding documentation.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> ---
> v2: new patch
> v3: fix off-by-one, also add qio_net_listener_get_local_address
> ---
> include/io/channel-socket.h | 2 +-
> include/io/net-listener.h | 42 +++++++++++++++++++++++++++++++++++++
> chardev/char-socket.c | 2 +-
> io/net-listener.c | 27 ++++++++++++++++++++++++
> migration/socket.c | 4 ++--
> ui/vnc.c | 34 ++++++++++++++++++------------
> 6 files changed, 94 insertions(+), 17 deletions(-)
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 :|
next prev parent reply other threads:[~2025-11-13 9:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251112224032.864420-15-eblake@redhat.com>
[not found] ` <20251112224032.864420-20-eblake@redhat.com>
2025-11-13 8:56 ` [PATCH v3 05/13] qio: Protect NetListener callback with mutex Daniel P. Berrangé
[not found] ` <20251112224032.864420-22-eblake@redhat.com>
2025-11-13 9:01 ` [PATCH v3 07/13] qio: Factor out helpers qio_net_listener_[un]watch Daniel P. Berrangé
[not found] ` <20251112224032.864420-23-eblake@redhat.com>
2025-11-13 9:01 ` [PATCH v3 08/13] chardev: Reuse channel's cached local address Daniel P. Berrangé
[not found] ` <20251112224032.864420-24-eblake@redhat.com>
2025-11-13 9:03 ` Daniel P. Berrangé [this message]
[not found] ` <20251112224032.864420-26-eblake@redhat.com>
2025-11-13 9:05 ` [PATCH v3 11/13] qio: Add QIONetListener API for using AioContext Daniel P. Berrangé
2025-11-13 1:11 [PATCH v3 for-10.2 00/13] Fix deadlock with bdrv_open of self-served NBD Eric Blake
2025-11-13 1:11 ` [PATCH v3 09/13] qio: Provide accessor around QIONetListener->sioc Eric Blake
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=aRWeyr7xMovosK0X@redhat.com \
--to=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-block@nongnu.org \
--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).