From owner-freebsd-hackers@FreeBSD.ORG Sun May 6 11:04:25 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 4FD5E16A401 for ; Sun, 6 May 2007 11:04:25 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.freebsd.org (Postfix) with ESMTP id E317613C44B for ; Sun, 6 May 2007 11:04:24 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [81.191.58.152] (account mc467741@c2i.net HELO laptop.lan) by mailfe07.swip.net (CommuniGate Pro SMTP 5.1.7) with ESMTPA id 483116387 for freebsd-hackers@freebsd.org; Sun, 06 May 2007 13:04:20 +0200 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Disposition: inline Date: Sun, 6 May 2007 13:04:04 +0200 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200705061304.05093.hselasky@c2i.net> Subject: 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:04:25 -0000 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? --HPS