From patchwork Sun May 27 14:41:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 161546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C87E2B6F9F for ; Mon, 28 May 2012 00:41:48 +1000 (EST) Received: from localhost ([::1]:55356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYefC-0005kw-L5 for incoming@patchwork.ozlabs.org; Sun, 27 May 2012 10:41:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYef5-0005kZ-Gm for qemu-devel@nongnu.org; Sun, 27 May 2012 10:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYef2-00089y-SE for qemu-devel@nongnu.org; Sun, 27 May 2012 10:41:39 -0400 Received: from mout.web.de ([212.227.15.3]:60141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYef2-00089X-Iy for qemu-devel@nongnu.org; Sun, 27 May 2012 10:41:36 -0400 Received: from af.local ([62.157.78.131]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0Mf0a9-1SNyMM30MT-00OYSR; Sun, 27 May 2012 16:41:32 +0200 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 27 May 2012 16:41:30 +0200 Message-Id: <1338129690-42835-1-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.5.3 MIME-Version: 1.0 X-Provags-ID: V02:K0:G8d8Bmmc6+rF0ue3qYOMQBDvjNFJ/+g5jwq0h1nnShU jcq0/dsXMFUMQDmYOzJk8lmpVqDvUtisci1GfMC2st+smPt4qH Kdv/u1Ayu2H0vmer6nK0KTVai34UOAbj8ovaR+FsLjanvF40aG BEv9ANcKAWf7qKj7iEk5ep0/caiDR5XrpZPkf4U6L5J4ExHOHv lyePQyX8/jYY0sLiMx92g== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.15.3 Cc: Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori Subject: [Qemu-devel] [PATCH for-1.1] virtio-blk: Fix unused variables in virtio_blk_handle_scsi() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Cc: Paolo Bonzini Reviewed-by: Stefan Hajnoczi --- 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;