Re: [PATCH RFC] struct list_node

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

 



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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux