From owner-cvs-all Tue Feb 6 10:40:16 2001 Delivered-To: cvs-all@freebsd.org Received: from mobile.wemm.org (c1315225-a.plstn1.sfba.home.com [65.0.135.147]) by hub.freebsd.org (Postfix) with ESMTP id 9468537B65D; Tue, 6 Feb 2001 10:39:54 -0800 (PST) Received: from netplex.com.au (localhost [127.0.0.1]) by mobile.wemm.org (8.11.1/8.11.1) with ESMTP id f16IRqt49819; Tue, 6 Feb 2001 10:27:53 -0800 (PST) (envelope-from peter@netplex.com.au) Message-Id: <200102061827.f16IRqt49819@mobile.wemm.org> X-Mailer: exmh version 2.2 06/23/2000 with nmh-1.0.4 To: Poul-Henning Kamp Cc: Garrett Wollman , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/awi awi.c src/sys/dev/ed if_ed.c src/sys/dev/fe if_fe.c src/sys/dev/ie if_ie.c src/sys/dev/lnc if_lnc.c src/sys/dev/pdq pdq_ifsubr.c src/sys/dev/ray if_ray.c src/sys/dev/sn if_sn.c src/sys/dev/snc dp83932.c src/sys/dev/usb ... In-Reply-To: <35662.981479283@critter> Date: Tue, 06 Feb 2001 10:27:52 -0800 From: Peter Wemm Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Poul-Henning Kamp wrote: > In message <200102061704.f16H4ct48889@mobile.wemm.org>, Peter Wemm writes: > >Garrett Wollman wrote: > >> < sa id: > >> > >> > I thought LIST was doubly linked, which means we should be able to have a > >> > LIST_PREV(), right? SLIST is singly linked as is STAILQ. > >> > >> There is a LIST_PREV macro, but in order to traverse the entire list > >> backwards, one must first get to the very end, which requires a loop > >> in LIST and a single dereference in TAILQ. > > > >Do you know where we can get one? For completeness we should have it and it > >is missing from our queue.h. It could probably be a simple enough variant > >of the recently added TAILQ_PREV() macro - which still gives me a headache > >trying to understand. :-) > > If you want to implement it, you have to put a second pointer in the > LIST_HEAD, and then you might as well make that pointer point to the last > element at which point a global s/LIST/TAILQ/g makes more sense. No, you dont. I've figured it out. > The TAILQ_PREV is nasty, but as far as I can tell safe. TAILQ_PREV is only nasty because of a HORRIBLE hack. There is no structure for the tailq entry nodes, so it abuses the head structure definition. TAILQ_PREV can be quite easily be fixed to not need to do this abuse if we put a differient hack in another place. LIST_PREV can do the same thing without needing a head structure.. But it will need to know what the head of the list is so that it can detect when it hits it. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message