From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsAEB-0005On-BL for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:33:11 -0400 Received: from [199.232.76.173] (port=58306 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsAE8-0005OW-V0 for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:33:09 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NsAE7-000563-PP for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:33:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3783) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NsAE7-00055z-DV for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:33:07 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2I7X6lX021535 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Mar 2010 03:33:06 -0400 Date: Thu, 18 Mar 2010 09:29:42 +0200 From: "Michael S. Tsirkin" Message-ID: <20100318072941.GE16973@redhat.com> References: <40b733d50215c872dd4c84f05d56eb6880a7e2bf.1268765204.git.quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40b733d50215c872dd4c84f05d56eb6880a7e2bf.1268765204.git.quintela@redhat.com> Subject: [Qemu-devel] Re: [PATCH 3/9] virtio: Teach virtio-blk about DO_UPCAST List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org On Tue, Mar 16, 2010 at 07:51:19PM +0100, Juan Quintela wrote: > Signed-off-by: Juan Quintela Sent a replacement patch for this. > --- > 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); > -- > 1.6.6.1 > >