From owner-freebsd-hackers Tue Jan 21 01:51:35 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id BAA11018 for hackers-outgoing; Tue, 21 Jan 1997 01:51:35 -0800 (PST) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id BAA11009; Tue, 21 Jan 1997 01:51:29 -0800 (PST) Received: from current1.whistle.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.8.4/8.8.4) with SMTP id AAA09873; Tue, 21 Jan 1997 00:53:24 -0800 (PST) Date: Tue, 21 Jan 1997 00:51:29 -0800 (PST) From: Julian Elischer To: Darren Reed cc: proff@suburbia.net, julian@freebsd.org, kuku@gilberto.physik.rwth-aachen.de, hackers@freebsd.org Subject: Re: FreeBSD 3.0-current port In-Reply-To: <199701210731.XAA04210@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Tue, 21 Jan 1997, Darren Reed wrote: > In some mail from proff@suburbia.net, sie said: > [...] > > FreeBSD uses dynamically allocated cdevsw's. imho ipfilter should > > not be manipulating the cdevsw directly at all (there are macros/ > > functions in the kernel to do this). Darren's rational (correct me > > if I'm wrong) behind scanning through cdevsw directly was to ensure > > free major/minor number pairs. > > It manipuates cdevsw so that it knows the major/minor # and can create > the entry in /dev itself (rather than rely on some script or human to > do it correctly). Solaris2 has an interface for doing all this, and now > I think FreeBSD does too (other OSes don't). Note thet FreeBSD has an array of POINTERS to cdevsw entries.. so an array can be sparse and not waste too much room. the cdevsw struct is in the source file with the functions it references, so those functions can be 'static'. (e.g. two functions can have the name "fdopen" and not clash if one is in teh 'fd' driver and the other is in the floppy disk driver. the major number is written into the cdevsw structure when it is assigned by the function, and it also has a spot for the driver name e.g. "fd". there is also a spot for a link to an associated bdevsw entry. sorry if that all looks too differnt to other OS's but I wanted to clean up a lot of cruft in teh kernel.. we have a way to go but this was the distance we could easily do without TOTALLY breaking too much.. the functions are: cdevsw_add() and bdevsw_add() and they are in (I think) kern/kern_conf.c (they can probably do with some cleanups by now :) julian