From owner-freebsd-net Tue Nov 14 15:15:16 2000 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 E3D6337B4C5 for ; Tue, 14 Nov 2000 15:15:13 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id eAENF6N24939; Tue, 14 Nov 2000 15:15:06 -0800 (PST) Date: Tue, 14 Nov 2000 15:15:06 -0800 From: Alfred Perlstein To: Julian Elischer Cc: Bosko Milekic , David Malone , iedowse@maths.tcd.ie, freebsd-net@FreeBSD.ORG Subject: Re: M_RDONLY: review & comment Message-ID: <20001114151506.F11449@fw.wintelcom.net> References: <3A11329A.D54E17E3@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <3A11329A.D54E17E3@elischer.org>; from julian@elischer.org on Tue, Nov 14, 2000 at 04:39:54AM -0800 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Julian Elischer [001114 14:59] wrote: > Bosko Milekic wrote: > > > > On Sun, 12 Nov 2000, David Malone wrote: > > > > > > The other option I thought of is to use a char *. You could point > > > to a static string describing the type of external storage. This > > > way is still fast comparing types, just compare the pointers. If > > > you want to know what the type is in human readable format (for > > > debugging) you just look at the string it points at. Also the > > > kernel allocates different addresses for different strings, so > > > it automatically solves the problem of allocating unique numbers > > > to each type. > > > > > > David. > > > > using char * is unsafe if the aim is to tag mbufs that were allocated > by some module, if the midule is unloaded.. > (the mbufs may hang around in some queu way afte the module has gone.. > and an attempt to follow the char 8 pointer......) That doesn't have to be true, see src/sys/kern/uipc_accf.c, as long as the char * is malloc'd and not forceably free'd on module unload we're safe although we may leak memory. -- -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