diff mbox

[5/5] virtio-blk: remove layout assumption

Message ID 8b06a9760ae7c91aadea92c2cfc26c15b5715bcd.1268896694.git.mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin March 18, 2010, 7:21 a.m. UTC
Use container_of to remove assumption that vdev
is 1st member of device state.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio-blk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

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