qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi()
@ 2012-05-27 14:41 Andreas Färber
  2012-05-27 15:10 ` Andreas Färber
  2012-05-28 12:23 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Färber @ 2012-05-27 14:41 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Paolo Bonzini, Andreas Färber, Anthony Liguori

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.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/virtio-blk.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index f9e1896..a1b64cb 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -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;
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi()
  2012-05-27 14:41 [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi() Andreas Färber
@ 2012-05-27 15:10 ` Andreas Färber
  2012-05-28 12:23 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2012-05-27 15:10 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

Am 27.05.2012 16:41, schrieb 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

"hosts", obviously. Please fix when applying.

Thanks,
Andreas

> an #ifdef in the variable declaration block.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/virtio-blk.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
> index f9e1896..a1b64cb 100644
> --- a/hw/virtio-blk.c
> +++ b/hw/virtio-blk.c
> @@ -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;

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi()
  2012-05-27 14:41 [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi() Andreas Färber
  2012-05-27 15:10 ` Andreas Färber
@ 2012-05-28 12:23 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2012-05-28 12:23 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Kevin Wolf, Paolo Bonzini, Anthony Liguori, qemu-devel

On Sun, May 27, 2012 at 3:41 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> 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.
>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/virtio-blk.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-28 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 14:41 [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi() Andreas Färber
2012-05-27 15:10 ` Andreas Färber
2012-05-28 12:23 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).