Patchwork [15/16] vhost-scsi: move some definitions to its header file

login
register
mail settings
Submitter Zhiyong Wu
Date April 19, 2012, 2:39 a.m.
Message ID <1334803149-27379-16-git-send-email-zwu.kernel@gmail.com>
Download mbox | patch
Permalink /patch/153637/
State New
Headers show

Comments

Zhiyong Wu - April 19, 2012, 2:39 a.m.
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 hw/vhost-scsi.c |    9 +--------
 hw/vhost-scsi.h |   11 +++++++++++
 2 files changed, 12 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/vhost-scsi.c b/hw/vhost-scsi.c
index 54e6216..62f80bb 100644
--- a/hw/vhost-scsi.c
+++ b/hw/vhost-scsi.c
@@ -49,14 +49,7 @@  const char *vhost_scsi_get_id(VHostSCSI *vs)
 int vhost_scsi_start(VHostSCSI *vs, VirtIODevice *vdev)
 {
     int ret;
-    /* TODO #include <linux/vhost.h> properly */
-    struct vhost_vring_target {
-        unsigned char vhost_wwpn[224];
-        unsigned short vhost_tpgt;
-    } backend;
-#define VHOST_VIRTIO 0xAF
-#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_vring_target)
-#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_vring_target)
+    struct vhost_vring_target backend;
 
     if (!vhost_dev_query(&vs->dev, vdev)) {
         return -ENOTSUP;
diff --git a/hw/vhost-scsi.h b/hw/vhost-scsi.h
index e5e67e3..84e9097 100644
--- a/hw/vhost-scsi.h
+++ b/hw/vhost-scsi.h
@@ -17,6 +17,17 @@ 
 #include "qemu-common.h"
 #include "qemu-option.h"
 
+/* TODO #include <linux/vhost.h> properly */
+/* For VHOST_SCSI_SET_ENDPOINT/VHOST_SCSI_CLEAR_ENDPOINT ioctl */
+struct vhost_vring_target {
+    unsigned char vhost_wwpn[224];
+    unsigned short vhost_tpgt;
+};
+
+#define VHOST_VIRTIO 0xAF
+#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_vring_target)
+#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_vring_target)
+
 VHostSCSI *find_vhost_scsi(const char *id);
 const char *vhost_scsi_get_id(VHostSCSI *vs);