Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755195AbXFNKK0 (ORCPT ); Thu, 14 Jun 2007 06:10:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751591AbXFNKKT (ORCPT ); Thu, 14 Jun 2007 06:10:19 -0400 Received: from main.gmane.org ([80.91.229.2]:56785 "EHLO ciao.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751450AbXFNKKS (ORCPT ); Thu, 14 Jun 2007 06:10:18 -0400 X-Injected-Via-Gmane: http://gmane.org/ To: linux-kernel@vger.kernel.org From: Jan Blunck Subject: Re: [PATCH RFC] struct list_node Date: Thu, 14 Jun 2007 10:03:51 +0000 (UTC) Organization: SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 (AG Nuernberg) Message-ID: References: <1181452290.16428.7.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: charybdis-ext.suse.de User-Agent: pan 0.119 (Karma Hunters) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1065 Lines: 29 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/