From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3X13-0000FC-W0 for qemu-devel@nongnu.org; Thu, 19 May 2016 19:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3X0x-0001sI-N0 for qemu-devel@nongnu.org; Thu, 19 May 2016 19:06:04 -0400 Received: from resqmta-po-09v.sys.comcast.net ([2001:558:fe16:19:96:114:154:168]:47470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3X0x-0001s8-HT for qemu-devel@nongnu.org; Thu, 19 May 2016 19:05:59 -0400 From: Eric Blake Date: Thu, 19 May 2016 17:05:50 -0600 Message-Id: <1463699150-19445-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH v7] block: Move BlockRequest type to io.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Fam Zheng , Kevin Wolf , Max Reitz , "open list:Block I/O path" 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, now that commit 91c6e4b killed public multiwrite, so move it into io.c and improve the comments. Signed-off-by: Eric Blake --- v7: new title, keep anonymous union but move struct's location v6 was here: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg00562.html include/block/block.h | 21 --------------------- block/io.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index a8c15e3..a8fc458 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -329,27 +329,6 @@ BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs, void bdrv_aio_cancel(BlockAIOCB *acb); void bdrv_aio_cancel_async(BlockAIOCB *acb); -typedef struct BlockRequest { - /* Fields to be filled by caller */ - union { - struct { - int64_t sector; - int nb_sectors; - int flags; - QEMUIOVector *qiov; - }; - struct { - int req; - void *buf; - }; - }; - BlockCompletionFunc *cb; - void *opaque; - - /* Filled by block layer */ - int error; -} BlockRequest; - /* sg packet commands */ int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf); BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, diff --git a/block/io.c b/block/io.c index 60a6bd8..e3d35c7 100644 --- a/block/io.c +++ b/block/io.c @@ -1908,6 +1908,27 @@ void bdrv_aio_cancel_async(BlockAIOCB *acb) /**************************************************************/ /* async block device emulation */ +typedef struct BlockRequest { + union { + /* Used during read, write, trim */ + struct { + int64_t sector; + int nb_sectors; + int flags; + QEMUIOVector *qiov; + }; + /* Used during ioctl */ + struct { + int req; + void *buf; + }; + }; + BlockCompletionFunc *cb; + void *opaque; + + int error; +} BlockRequest; + typedef struct BlockAIOCBCoroutine { BlockAIOCB common; BlockRequest req; -- 2.5.5