From owner-freebsd-arch@FreeBSD.ORG Tue May 8 21:19:27 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 3ECFE16A407 for ; Tue, 8 May 2007 21:19:27 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id ACAE113C45A for ; Tue, 8 May 2007 21:19:26 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (host5.bedc.ondsl.gr [62.103.39.229]) (authenticated bits=128) by igloo.linux.gr (8.13.8/8.13.8/Debian-3) with ESMTP id l48L85q2016833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 9 May 2007 00:08:12 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l48L7kK2017991; Wed, 9 May 2007 00:07:59 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l48L7k19017990; Wed, 9 May 2007 00:07:46 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 9 May 2007 00:07:46 +0300 From: Giorgos Keramidas To: John Baldwin Message-ID: <20070508210745.GA17259@kobe.laptop> References: <200705051617.34162.hselasky@c2i.net> <4640C52E.7010209@elischer.org> <200705082100.51354.hselasky@c2i.net> <200705081658.38171.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200705081658.38171.jhb@freebsd.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.521, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.68, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-arch@freebsd.org, Julian Elischer , Hans Petter Selasky 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 21:19:27 -0000 On 2007-05-08 16:58, John Baldwin wrote: > On Tuesday 08 May 2007 03:00:51 pm Hans Petter Selasky wrote: > > I suggested the following at hacker's: > > > > #define LIST_PREV(head,elm,field,type) \ > >  (((elm) == LIST_FIRST(head)) ? ((struct type *)0) : \ > >   ((struct type *)(((uint8_t *)((elm)->field.le_prev)) - \ > >                    ((uint8_t *)&LIST_NEXT((struct type *)0,field))))) > > > > What do you think? > > Just use a TAILQ, that's what it is there for. The macro is interesting, but I wouldn't feel safe using it. I didn't receive the hackers post, but I fully agree. Please just use TAILQ. No pointer-hacks are needed, it's there already, it works as expected on all the cases I've seen... what more do we need?