From: Jan Blunck <jblunck@suse.de>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] struct list_node
Date: Thu, 14 Jun 2007 10:03:51 +0000 (UTC) [thread overview]
Message-ID: <f4r3q7$fin$1@sea.gmane.org> (raw)
In-Reply-To: <1181452290.16428.7.camel@localhost.localdomain>
On Sun, 10 Jun 2007 15:11:30 +1000, Rusty Russell wrote:
>
> +/* A list node is the same as the head of the list, but it's useful to
> + * think of them as a separate type. */
> +struct list_node {
> + struct list_head h;
> +};
> +
> +/* This allows us to support old style list_head as well as list_node. */
> +union list_head_or_node {
> + struct list_head *_h;
> + struct list_node *_n;
> +};
> +union list_head_or_node_const {
> + struct list_head *_h;
> + struct list_node *_n;
> + const struct list_head *_ch;
> + const struct list_node *_cn;
> +};
> +#define __lh(n) (((union list_head_or_node)(n))._h)
> +#define __clh(n) (((union list_head_or_node_const)(n))._h)
> +
Any reason why you don't use __attribute__ ((transparent_union)) ? I guess
this is exactly the case for which it was invented.
Cheers,
Jan
prev parent reply other threads:[~2007-06-14 10:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-10 5:11 Rusty Russell
2007-06-10 17:13 ` Randy Dunlap
2007-06-10 17:20 ` Linus Torvalds
2007-06-10 20:19 ` Linus Torvalds
2007-06-11 0:08 ` Rusty Russell
2007-06-11 0:02 ` Rusty Russell
2007-06-14 10:03 ` Jan Blunck [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='f4r3q7$fin$1@sea.gmane.org' \
--to=jblunck@suse.de \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®