From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayd9F-0000zt-H0 for qemu-devel@nongnu.org; Fri, 06 May 2016 06:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayd93-0002Qn-TC for qemu-devel@nongnu.org; Fri, 06 May 2016 06:38:12 -0400 Date: Fri, 6 May 2016 12:37:28 +0200 From: Kevin Wolf Message-ID: <20160506103728.GB5093@noname.redhat.com> References: <1462406126-22946-1-git-send-email-eblake@redhat.com> <1462406126-22946-3-git-send-email-eblake@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462406126-22946-3-git-send-email-eblake@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 02/20] block: Drop private ioctl-only members of BlockRequest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Stefan Hajnoczi , Fam Zheng , Max Reitz 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 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. Kevin