[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 02/20] block: Drop private ioctl-only members

From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v6 02/20] block: Drop private ioctl-only members of BlockRequest
Date: Fri, 6 May 2016 12:37:28 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 05.05.2016 um 01:55 hat Eric Blake geschrieben:
> I was thrown by the fact that the public type BlockRequest had
> an anonymous union, but no obvious discriminator.  Turns out
> that the only client of the second branch of the union was code
> internal to io.c, and that with a slight abuse of QEMUIOVector*
> to pass a void* pointer, we can make the public interface less
> confusing.
> (Yes, I know that strict C doesn't guarantee that you can cast
> void* to the wrong type and then back to void* - it only
> guarantees the reverse direction of the original pointer to
> void* and back to the original type - but we already have other
> assumptions throughout the qemu code base that assume that all
> pointers are interchangeable in representation).
> Signed-off-by: Eric Blake <address@hidden>

Do you really think abusing fields makes things clearer than using a
union? We could just add comments instead that tell which branch is used
for what. And after my patch "block: Remove bdrv_aio_multiwrite()", I
think the struct isn't part of a public interface any more anyway.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]