qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/5] virtio-blk: remove layout assumption


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH 5/5] virtio-blk: remove layout assumption
Date: Thu, 18 Mar 2010 09:21:51 +0200
User-agent: Mutt/1.5.19 (2009-01-05)

Use container_of to remove assumption that vdev
is 1st member of device state.

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]