qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up upcast from PCIDevice to I6300State)
Date: Mon, 24 Aug 2009 12:55:13 +0100	[thread overview]
Message-ID: <200908241255.14045.paul@codesourcery.com> (raw)
In-Reply-To: <87ab1pvbov.fsf_-_@pike.pond.sub.org>

On Monday 24 August 2009, Markus Armbruster wrote:
> We got container_of() in osdep.h.
>
> We also got DO_UPCAST() in qdev.h.  Odd place, as it's not really
> specific to qdev (except for the naming of the last parameter).  It
> takes the same parameters as container_of(), but in a different order,
> which I find needlessly confusing.  The last parameter is insufficiently
> parenthesized in the macro expansion.  Finally, I don't really like the
> name --- I find container_of() much clearer --- but that's just me.
>
> Why do we have two macros to do essentially the same thing?
>
> When should container_of() be used, and when DO_UPCAST()?

DO_UPCAST requires that the child object be at offset zero.

Paul

  reply	other threads:[~2009-08-24 11:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21  8:31 [Qemu-devel] [PATCH 0/3] qdev: clean up & convert watchdogs Markus Armbruster
2009-08-21  8:31 ` [Qemu-devel] [PATCH 1/3] Move watchdog, watchdog_action, give them internal linkage Markus Armbruster
2009-08-21  8:31 ` [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State Markus Armbruster
     [not found]   ` <m3ws4xt7up.fsf@neno.mitica>
2009-08-24  8:49     ` [Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up upcast from PCIDevice to I6300State) Markus Armbruster
2009-08-24 11:55       ` Paul Brook [this message]
2009-08-24 11:59   ` [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State Paul Brook
2009-08-24 13:44     ` Markus Armbruster
2009-08-24 15:07       ` Gerd Hoffmann
2009-08-21  8:31 ` [Qemu-devel] [PATCH 3/3] qdev: convert watchdogs Markus Armbruster
2009-08-21 13:07   ` Gerd Hoffmann
2009-08-24  9:05     ` Immutable qdev properties (was: [Qemu-devel] [PATCH 3/3] qdev: convert watchdogs) Markus Armbruster
2009-08-24 12:25       ` [Qemu-devel] Re: Immutable qdev properties Gerd Hoffmann
2009-08-24 13:04         ` Markus Armbruster

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=200908241255.14045.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).