On Thu, Nov 06, 2025 at 12:35:05PM -0600, Eric Blake wrote: > On Wed, Nov 05, 2025 at 02:06:06PM -0600, Eric Blake wrote: > > On Mon, Nov 03, 2025 at 02:10:56PM -0600, Eric Blake wrote: > > > Make it easier to get from the sioc listening to a single address on > > > behalf of a NetListener back to its owning object, which will be > > > beneficial in an upcoming patch that teaches NetListener how to > > > interact with AioContext. > > > > > > Signed-off-by: Eric Blake <[email protected]> > > > --- > > > include/io/channel-socket.h | 1 + > > > io/channel-socket.c | 1 + > > > io/net-listener.c | 1 + > > > 3 files changed, 3 insertions(+) > > > > > > diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h > > > index a88cf8b3a9f..eee686f3b4d 100644 > > > --- a/include/io/channel-socket.h > > > +++ b/include/io/channel-socket.h > > > @@ -49,6 +49,7 @@ struct QIOChannelSocket { > > > socklen_t remoteAddrLen; > > > ssize_t zero_copy_queued; > > > ssize_t zero_copy_sent; > > > + struct QIONetListener *listener; > > > > Commenting on my own patch: > > > > After re-reading docs/devel/style.rst, I can see that this particular > > forward declaration of QIONetListener is not consistent with the > > guidelines. I have to have a forward reference, since the style guide > > also forbids circular inclusion (net-listener.h already includes > > channel-socket.h, so channel-socket.h cannot include net-listener.h); > > but it may be better for me to move the forward reference into > > include/qemu/typedefs.h rather than inlining it how I did here. > > Then again, include/qemu/typedefs.h states "For struct types used in > only a few headers, judicious use of the struct tag instead of the > typedef name is commonly preferable." > > So, to keep it simpler, I'll just justify my choice in the commit message.
I would really rather we avoided the bi-directional pointer linkage entirely. AFAICT, this is only required because the later patch is passing a QIOChannelSocket as the opaque data parametr for a callback. It would be preferrable if we would instead pass a standalonme data struct containing the QIOChannelSocket + QIONetListener, and then avoid this back-linkage. 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 :|
