From owner-freebsd-hackers@FreeBSD.ORG Sun May 6 11:40:17 2007 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 313D216A402 for ; Sun, 6 May 2007 11:40:17 +0000 (UTC) (envelope-from mark@grondar.org) Received: from storm.uk.FreeBSD.org (storm.uk.FreeBSD.org [194.242.157.42]) by mx1.freebsd.org (Postfix) with ESMTP id C5F9513C46C for ; Sun, 6 May 2007 11:40:16 +0000 (UTC) (envelope-from mark@grondar.org) Received: from storm.uk.FreeBSD.org (uucp@localhost [127.0.0.1]) by storm.uk.FreeBSD.org (8.13.8/8.13.8) with ESMTP id l46BeBD1039124; Sun, 6 May 2007 12:40:12 +0100 (BST) (envelope-from mark@grondar.org) Received: (from uucp@localhost) by storm.uk.FreeBSD.org (8.13.8/8.12.11/Submit) with UUCP id l46BeBwD039123; Sun, 6 May 2007 12:40:11 +0100 (BST) (envelope-from mark@grondar.org) Received: from greatest.grondar.org (localhost [127.0.0.1]) by greatest.grondar.org (8.13.8/8.13.8) with ESMTP id l46BdssN017108; Sun, 6 May 2007 13:39:55 +0200 (SAST) (envelope-from mark@greatest.grondar.org) Message-Id: <200705061139.l46BdssN017108@greatest.grondar.org> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Hans Petter Selasky In-Reply-To: Message from Hans Petter Selasky of "Sun, 06 May 2007 13:04:04 +0200." <200705061304.05093.hselasky@c2i.net> From: Mark Murray From: Mark Murray Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 06 May 2007 12:39:53 +0100 Sender: mark@grondar.org Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Missing LIST_PREV() ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2007 11:40:17 -0000 Hans Petter Selasky writes: > Hi, > > Why should LISTs only be forward traversable? The following piece of > code make lists backward traversable: No objection to the concept. But... > /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))))) Please don't use typeof; it is a GCCism. Do you really mean NULL? M -- Mark R V Murray - Cert APS(Open) Dip Phys(Open) BSc Open(Open)