qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: quintela@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCHv2 5/5] virtio-blk: remove layout assumption
Date: Thu, 18 Mar 2010 11:42:50 +0200	[thread overview]
Message-ID: <2dcc2f1126686553a64d0a3c0ba82ded54a3e08f.1268905075.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1268905075.git.mst@redhat.com>

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 --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
-- 
1.7.0.2.280.gc6f05

      parent reply	other threads:[~2010-03-18  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  9:42 [Qemu-devel] [PATCHv2 0/5] virtio: cleanup layout assumptions Michael S. Tsirkin
2010-03-18  9:42 ` [Qemu-devel] [PATCHv2 1/5] virtio: add type safe API Michael S. Tsirkin
2010-03-18  9:42 ` [Qemu-devel] [PATCHv2 2/5] virtio-net: remove layout assumptions Michael S. Tsirkin
2010-03-18  9:42 ` [Qemu-devel] [PATCHv2 3/5] virtio-serial: remove struct " Michael S. Tsirkin
2010-03-18  9:42 ` [Qemu-devel] [PATCHv2 4/5] virtio-balloon: remove " Michael S. Tsirkin
2010-03-18  9:42 ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2dcc2f1126686553a64d0a3c0ba82ded54a3e08f.1268905075.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).