From owner-freebsd-net Mon Dec 11 12:13:58 2000 From owner-freebsd-net@FreeBSD.ORG Mon Dec 11 12:13:56 2000 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id AFFBF37B402 for ; Mon, 11 Dec 2000 12:13:56 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eBBKDtD11017; Mon, 11 Dec 2000 12:13:55 -0800 (PST) Date: Mon, 11 Dec 2000 12:13:55 -0800 From: Alfred Perlstein To: Bosko Milekic Cc: net@FreeBSD.ORG Subject: Re: Abusing m_ext for a worthy goal. Message-ID: <20001211121354.E16205@fw.wintelcom.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from bmilekic@technokratis.com on Mon, Dec 11, 2000 at 02:57:43PM -0500 Sender: bright@fw.wintelcom.net Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Bosko Milekic [001211 11:56] wrote: > > Something I forgot in first Email... > > On Mon, 11 Dec 2000, Bosko Milekic wrote: > > [...] > > Actually, your free routine needs to accept the address of the > > cluster as a first argument, and the optional argument as a second > > argument. According to your MEXTADD() above, your optional argument will > > be something called "cm." In your case, what you need to make your > > optional argument be is the actual mbuf "control" (you can cast it to > > struct mbuf *). Then, you can call unp_scan() on that mbuf (second > > argument) and call _MCLFREE() on the first argument, which will > > effectively be the address of the cluster. > > Don't forget to also, after running _MCLFREE() on the ext_buf, to > NULL out the control mbuf's ext_buf, and to remove the M_EXT bit from the > mbuf if you are planning to re-use it. Basically, make sure to clean up > after yourself after you forcibly free the cluster "manually." Hmm, I think instead of doing this sort of abuse, what I should be doing is allocating an mbuf header, then allocating a mbuf cluster then attaching them using the MEXTADD() macro. I'm going to look at the code to see if there's a clean way to do this, if not can you provide an interface for allocating and free'ing clusters by themselves? thanks, -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message