From owner-freebsd-arch@FreeBSD.ORG Tue May 8 18:45:06 2007 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F352716A400 for ; Tue, 8 May 2007 18:45:05 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outX.internet-mail-service.net (outX.internet-mail-service.net [216.240.47.247]) by mx1.freebsd.org (Postfix) with ESMTP id DF67413C458 for ; Tue, 8 May 2007 18:45:05 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.32) with ESMTP; Tue, 08 May 2007 11:45:05 -0700 Received: from julian-mac.elischer.org (nat.ironport.com [63.251.108.100]) by idiom.com (Postfix) with ESMTP id 0131C125B43; Tue, 8 May 2007 11:45:03 -0700 (PDT) Message-ID: <4640C52E.7010209@elischer.org> Date: Tue, 08 May 2007 11:45:02 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.0 (Macintosh/20070326) MIME-Version: 1.0 To: John Baldwin References: <200705051617.34162.hselasky@c2i.net> <20070507202034.GA80846@kobe.laptop> <20070507202517.GA88340@kobe.laptop> <200705081128.25708.jhb@freebsd.org> In-Reply-To: <200705081128.25708.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Hans Petter Selasky , Giorgos Keramidas , freebsd-arch@freebsd.org Subject: Re: Missing LIST_PREV() ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2007 18:45:06 -0000 John Baldwin wrote: > On Monday 07 May 2007 04:25:18 pm Giorgos Keramidas wrote: >> with other compilers. > > This can be fixed by passing the type as an argument which is what > TAILQ_PREV() does: > > #define TAILQ_PREV(elm, headname, field) \ > (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) > > I'm not sure how portable offsetof() would be though. In general if you want > this feature, you should just use a TAILQ though. TAILQ_ENTRY() is the same > size as a LIST_ENTRY(), it just adds one more pointer to the HEAD structure. > It is also specifically designed to make TAILQ_PREV() work w/o needing the > offsetof() hack. > I agree with this.. that's why we have the different types. The suggested change in ingenious but I don't know how portable it is..