From owner-freebsd-arch@FreeBSD.ORG Mon May 7 20:38:33 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 DA16316A401 for ; Mon, 7 May 2007 20:38:33 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 3B8BC13C457 for ; Mon, 7 May 2007 20:38:32 +0000 (UTC) (envelope-from keramida@freebsd.org) 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 l47KKrNV025259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 7 May 2007 23:20:59 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l47KKZYQ087946; Mon, 7 May 2007 23:20:47 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l47KKYdj087945; Mon, 7 May 2007 23:20:34 +0300 (EEST) (envelope-from keramida@freebsd.org) Date: Mon, 7 May 2007 23:20:34 +0300 From: Giorgos Keramidas To: Hans Petter Selasky Message-ID: <20070507202034.GA80846@kobe.laptop> References: <200705051617.34162.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200705051617.34162.hselasky@c2i.net> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.811, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.59, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: 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: Mon, 07 May 2007 20:38:33 -0000 On 2007-05-05 16:17, Hans Petter Selasky wrote: > Hi, > > Why should LISTs only be forward traversable? The following piece of code make > lists backward traversable: > > /sys/sys/queue.h: > > +#define LIST_PREV(head,elm,field) \ > + (((elm) == LIST_FIRST(head)) ? ((__typeof(elm))0) : \ > + ((__typeof(elm))(((uint8_t *)((elm)->field.le_prev)) - \ > + ((uint8_t *)&LIST_NEXT((__typeof(elm))0,field))))) > > Any comments? 1. The use of (uint8_t *) casts is relatively ugly. 2. What does LIST_PREV give us that cannot be done with TAILQ_PREV() already?