block: Move BlockRequest type to io.c
authorEric Blake <eblake@redhat.com>
Thu, 19 May 2016 23:05:50 +0000 (17:05 -0600)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 7 Jun 2016 13:40:51 +0000 (14:40 +0100)
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 <eblake@redhat.com>
Message-Id: <1463699150-19445-1-git-send-email-eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
block/io.c
include/block/block.h

index e12f303df5ce32c3776ef1e84e1dd2923769465d..a2fba6738ac4b0945a807cc45157e6bcfde8fb8b 100644 (file)
@@ -1902,6 +1902,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;
index d6bb74d77e8615be38b3859c0be8fe3c740731be..3fd5043d010ca24ad08b58c1c133c0c2690e80e5 100644 (file)
@@ -320,27 +320,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,