From owner-freebsd-arch Thu Jan 4 14:26: 2 2001 From owner-freebsd-arch@FreeBSD.ORG Thu Jan 4 14:26:00 2001 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from hand.dotat.at (sfo-gw.covalent.net [207.44.198.62]) by hub.freebsd.org (Postfix) with ESMTP id 90E6037B400; Thu, 4 Jan 2001 14:25:56 -0800 (PST) Received: from fanf by hand.dotat.at with local (Exim 3.15 #3) id 14EIox-0000Vk-00; Thu, 04 Jan 2001 22:25:19 +0000 Date: Thu, 4 Jan 2001 22:25:19 +0000 From: Tony Finch To: Kirk McKusick Cc: Alfred Perlstein , Will Andrews , Peter Wemm , Stephen McKay , phk@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: Reinstatement of CIRCLEQ Message-ID: <20010104222519.Y2140@hand.dotat.at> References: <20010104001943.T292@fw.wintelcom.net> <200101041708.JAA05731@beastie.mckusick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <200101041708.JAA05731@beastie.mckusick.com> Organization: Covalent Technologies, Inc Sender: fanf@dotat.at Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Kirk McKusick wrote: > From: Alfred Perlstein > > You're right, I'm wondering though, would it be possible > to change TAILQ_PREV(elm, headname, field) to TAILQ_PREV(elm, > field) by using the offset of 'field' into the struct? > You could subtract the offset of 'field' from the tqe_prev > of the next struct right? > >You are correct that your suggested change is exactly the >unportability/headache that I am trying to avoid. The Apache Group needed a linked list structure that would allow insertions before and after a given element without knowing the address of the list header. Although I wanted to use sys/queue.h it didn't quite have that functionality so I wrote some "ring" macros based on code by Dean Gaudet. http://www.apache.org/websrc/cvsweb.cgi/~checkout~/apr-util/include/ap_ring.h?rev=1.5&content-type=text/plain Tony. -- f.a.n.finch fanf@covalent.net dot@dotat.at "You realize there's a government directive stating that there is no such thing as a flying saucer?" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message