From patchwork Tue Mar 12 09:22:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fred.konrad@greensocs.com X-Patchwork-Id: 226863 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 C110F2C0343 for ; Tue, 12 Mar 2013 20:24:08 +1100 (EST) Received: from localhost ([::1]:33215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFLRF-00008J-BF for incoming@patchwork.ozlabs.org; Tue, 12 Mar 2013 05:24:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFLPy-0006pq-0D for qemu-devel@nongnu.org; Tue, 12 Mar 2013 05:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFLPt-0006xn-NL for qemu-devel@nongnu.org; Tue, 12 Mar 2013 05:22:45 -0400 Received: from greensocs.com ([87.106.252.221]:33312 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFLPt-0006xZ-I1 for qemu-devel@nongnu.org; Tue, 12 Mar 2013 05:22:41 -0400 Received: from localhost (unknown [127.0.0.1]) by s15328186.onlinehome-server.info (Postfix) with ESMTP id 07A1D44D688; Tue, 12 Mar 2013 09:22:41 +0000 (UTC) Received: from s15328186.onlinehome-server.info ([127.0.0.1]) by localhost (s15328186.onlinehome-server.info [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2m1FfhxtVqx2; Tue, 12 Mar 2013 10:22:39 +0100 (CET) Received: by s15328186.onlinehome-server.info (Postfix, from userid 491) id 1EFCF44D682; Tue, 12 Mar 2013 10:22:39 +0100 (CET) Received: from compaq.katmai.xl.cx.katmai.xl.cx (lan31-11-83-155-143-136.fbx.proxad.net [83.155.143.136]) by s15328186.onlinehome-server.info (Postfix) with ESMTPSA id 40E1243EE3F; Tue, 12 Mar 2013 10:22:38 +0100 (CET) From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org, aliguori@us.ibm.com, afaerber@suse.de Date: Tue, 12 Mar 2013 10:22:04 +0100 Message-Id: <1363080131-16427-2-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1363080131-16427-1-git-send-email-fred.konrad@greensocs.com> References: <1363080131-16427-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 87.106.252.221 Cc: Kevin Wolf , peter.maydell@linaro.org, mst@redhat.com, mark.burton@greensocs.com, Stefan Hajnoczi , fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH v6 1/8] virtio-blk: don't use pointer for configuration. 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 From: KONRAD Frederic The configuration field must not be a pointer as it will be used for virtio-blk properties. So *blk is replaced by blk in VirtIOBlock structure. Signed-off-by: KONRAD Frederic Reviewed-by: Peter Maydell --- hw/virtio-blk.c | 8 ++++---- hw/virtio-blk.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 6714b01..908c316 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -151,7 +151,7 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req) */ req->scsi = (void *)req->elem.in_sg[req->elem.in_num - 2].iov_base; - if (!req->dev->blk->scsi) { + if (!req->dev->blk.scsi) { status = VIRTIO_BLK_S_UNSUPP; goto fail; } @@ -371,7 +371,7 @@ static void virtio_blk_handle_request(VirtIOBlockReq *req, * terminated by '\0' only when shorter than buffer. */ strncpy(req->elem.in_sg[0].iov_base, - s->blk->serial ? s->blk->serial : "", + s->blk.serial ? s->blk.serial : "", MIN(req->elem.in_sg[0].iov_len, VIRTIO_BLK_ID_BYTES)); virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); g_free(req); @@ -534,7 +534,7 @@ static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features) features |= (1 << VIRTIO_BLK_F_BLK_SIZE); features |= (1 << VIRTIO_BLK_F_SCSI); - if (s->blk->config_wce) { + if (s->blk.config_wce) { features |= (1 << VIRTIO_BLK_F_CONFIG_WCE); } if (bdrv_enable_write_cache(s->bs)) @@ -650,7 +650,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk) s->vdev.reset = virtio_blk_reset; s->bs = blk->conf.bs; s->conf = &blk->conf; - s->blk = blk; + memcpy(&(s->blk), blk, sizeof(struct VirtIOBlkConf)); s->rq = NULL; s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1; diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h index 19ec569..b704d50 100644 --- a/hw/virtio-blk.h +++ b/hw/virtio-blk.h @@ -118,7 +118,7 @@ typedef struct VirtIOBlock { void *rq; QEMUBH *bh; BlockConf *conf; - VirtIOBlkConf *blk; + VirtIOBlkConf blk; unsigned short sector_mask; DeviceState *qdev; VMChangeStateEntry *change;