Skip to contentSkip to conversation

virtio-blk: Fix unused variables in virtio_blk_handle_scsi()

PATCH In review Andreas Färber 3 participants 3 messages May 27, 2012 – May 28, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-blk: Fix unused variables in virtio_blk_handle_scsi()

Commit f34e73cd69bdbdb9b1d56b288c5e14d6fff58165 (virtio-blk: report non-zero status when failing SG_IO requests) exposed the function to non-Linux guests. Move all Linux-only variable declarations into an #ifdef in the variable declaration block.

---
 hw/virtio-blk.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
hw/virtio-blk.c +4 -2
index f9e1896..a1b64cb 100644
@@ -147,9 +147,12 @@ static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s)
 
 static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
 {
-    int ret;
     int status = VIRTIO_BLK_S_OK;
+#ifdef __linux__
+    struct sg_io_hdr hdr;
+    int ret;
     int i;
+#endif
 
     /*
      * We require at least one output segment each for the virtio_blk_outhdr
@@ -184,7 +187,6 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
     }
 
 #ifdef __linux__
-    struct sg_io_hdr hdr;
     memset(&hdr, 0, sizeof(struct sg_io_hdr));
     hdr.interface_id = 'S';
     hdr.cmd_len = req->elem.out_sg[1].iov_len;
Signature · 1 line
1.7.5.3
#1 lore raw

Am 27.05.2012 16:41, schrieb Andreas Färber:

Quoted 3 lines

Commit f34e73cd69bdbdb9b1d56b288c5e14d6fff58165 (virtio-blk: report non-zero status when failing SG_IO requests) exposed the function to non-Linux guests. Move all Linux-only variable declarations into

"hosts", obviously. Please fix when applying.

Thanks,
Andreas

Quoted 34 lines

an #ifdef in the variable declaration block.

---
 hw/virtio-blk.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
hw/virtio-blk.c +4 -2
index f9e1896..a1b64cb 100644
@@ -147,9 +147,12 @@ static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s)
 
 static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
 {
-    int ret;
     int status = VIRTIO_BLK_S_OK;
+#ifdef __linux__
+    struct sg_io_hdr hdr;
+    int ret;
     int i;
+#endif
 
     /*
      * We require at least one output segment each for the virtio_blk_outhdr
@@ -184,7 +187,6 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
     }
 
 #ifdef __linux__
-    struct sg_io_hdr hdr;
     memset(&hdr, 0, sizeof(struct sg_io_hdr));
     hdr.interface_id = 'S';
     hdr.cmd_len = req->elem.out_sg[1].iov_len;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andreas Färber
Quoted 10 lines · Andreas Färber

Commit f34e73cd69bdbdb9b1d56b288c5e14d6fff58165 (virtio-blk: report non-zero status when failing SG_IO requests) exposed the function to non-Linux guests. Move all Linux-only variable declarations into an #ifdef in the variable declaration block.

---
 hw/virtio-blk.c |    6 ++++--

 1 files changed, 4 insertions(+), 2 deletions(-)