From patchwork Thu Mar 18 09:42:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PATCHv2,5/5] virtio-blk: remove layout assumption From: "Michael S. Tsirkin" X-Patchwork-Id: 48018 Message-Id: <2dcc2f1126686553a64d0a3c0ba82ded54a3e08f.1268905075.git.mst@redhat.com> To: quintela@redhat.com, qemu-devel@nongnu.org Cc: Date: Thu, 18 Mar 2010 11:42:50 +0200 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 5f61469..ab52d1d 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