9p: introduce a type for the 9p header
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 21 Mar 2017 20:51:34 +0000 (13:51 -0700)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 21 Apr 2017 19:41:29 +0000 (12:41 -0700)
Use the new type in virtio-9p-device.

Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
CC: anthony.perard@citrix.com
CC: jgross@suse.com
CC: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
CC: Greg Kurz <groug@kaod.org>
hw/9pfs/9p.h
hw/9pfs/virtio-9p-device.c

index b7e836251e1374ffa0915ffc2b01c00220f62282..5312d8a42405bb4ecd448b751645e850d9e78690 100644 (file)
@@ -119,6 +119,12 @@ static inline char *rpath(FsContext *ctx, const char *path)
 typedef struct V9fsPDU V9fsPDU;
 struct V9fsState;
 
+typedef struct {
+    uint32_t size_le;
+    uint8_t id;
+    uint16_t tag_le;
+} QEMU_PACKED P9MsgHeader;
+
 struct V9fsPDU
 {
     uint32_t size;
index 27a4a32f5c4c99ebebd46a7c1defb7f1dac3ed80..3782f437029b7be7f62bc56db1c63b61a33a78eb 100644 (file)
@@ -46,11 +46,7 @@ static void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq)
     VirtQueueElement *elem;
 
     while ((pdu = pdu_alloc(s))) {
-        struct {
-            uint32_t size_le;
-            uint8_t id;
-            uint16_t tag_le;
-        } QEMU_PACKED out;
+        P9MsgHeader out;
 
         elem = virtqueue_pop(vq, sizeof(VirtQueueElement));
         if (!elem) {