From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsA6Y-0003aC-JG for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:25:18 -0400 Received: from [199.232.76.173] (port=58305 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsA6Y-0003Zv-3Y for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:25:18 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NsA6X-0004c7-2c for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:25:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31985) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NsA6W-0004bs-Lo for qemu-devel@nongnu.org; Thu, 18 Mar 2010 03:25:16 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2I7PFgs019803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Mar 2010 03:25:16 -0400 Date: Thu, 18 Mar 2010 09:21:51 +0200 From: "Michael S. Tsirkin" Message-ID: <8b06a9760ae7c91aadea92c2cfc26c15b5715bcd.1268896694.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH 5/5] virtio-blk: remove layout assumption List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com, qemu-devel@nongnu.org Use container_of to remove assumption that vdev is 1st member of device state. Signed-off-by: Michael S. Tsirkin --- hw/virtio-blk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index b89f1f4..4ab6671 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -32,7 +32,7 @@ typedef struct VirtIOBlock static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) { - return (VirtIOBlock *)vdev; + return container_of(vdev, VirtIOBlock, vdev); } typedef struct VirtIOBlockReq -- 1.7.0.2.280.gc6f05