From patchwork Tue Mar 16 18:51:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 47892 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 44B29B7D5E for ; Wed, 17 Mar 2010 06:00:05 +1100 (EST) Received: from localhost ([127.0.0.1]:58425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrbz8-0001Al-GF for incoming@patchwork.ozlabs.org; Tue, 16 Mar 2010 14:59:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nrbrg-0002Gu-Cj for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:51:40 -0400 Received: from [199.232.76.173] (port=42497 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrbre-0002EU-AN for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:51:38 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nrbrc-0000B3-Lc for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:51:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56742) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nrbra-0000AK-PZ for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:51:36 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2GIpVn5012641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Mar 2010 14:51:31 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2GIpPvA023231; Tue, 16 Mar 2010 14:51:30 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 16 Mar 2010 19:51:19 +0100 Message-Id: <40b733d50215c872dd4c84f05d56eb6880a7e2bf.1268765204.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 3/9] virtio: Teach virtio-blk about DO_UPCAST X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- hw/virtio-blk.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 8939bb2..ce8b604 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -29,11 +29,6 @@ typedef struct VirtIOBlock BlockConf *conf; } VirtIOBlock; -static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) -{ - return (VirtIOBlock *)vdev; -} - typedef struct VirtIOBlockReq { VirtIOBlock *dev; @@ -320,7 +315,7 @@ static void virtio_blk_handle_request(VirtIOBlockReq *req, static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) { - VirtIOBlock *s = to_virtio_blk(vdev); + VirtIOBlock *s = DO_UPCAST(VirtIOBlock, vdev, vdev); VirtIOBlockReq *req; MultiReqBuffer mrb = { .num_writes = 0, @@ -392,7 +387,7 @@ static void virtio_blk_reset(VirtIODevice *vdev) */ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) { - VirtIOBlock *s = to_virtio_blk(vdev); + VirtIOBlock *s = DO_UPCAST(VirtIOBlock, vdev, vdev); struct virtio_blk_config blkcfg; uint64_t capacity; int cylinders, heads, secs; @@ -415,7 +410,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features) { - VirtIOBlock *s = to_virtio_blk(vdev); + VirtIOBlock *s = DO_UPCAST(VirtIOBlock, vdev, vdev); features |= (1 << VIRTIO_BLK_F_SEG_MAX); features |= (1 << VIRTIO_BLK_F_GEOMETRY);