From owner-freebsd-hackers Sat Jan 24 17:37:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA01045 for hackers-outgoing; Sat, 24 Jan 1998 17:37:44 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from word.smith.net.au (ppp5.portal.net.au [202.12.71.105]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA01033 for ; Sat, 24 Jan 1998 17:37:13 -0800 (PST) (envelope-from mike@word.smith.net.au) Received: from word (localhost [127.0.0.1]) by word.smith.net.au (8.8.8/8.8.5) with ESMTP id LAA00656; Sun, 25 Jan 1998 11:59:43 +1030 (CST) Message-Id: <199801250129.LAA00656@word.smith.net.au> X-Mailer: exmh version 2.0zeta 7/24/97 To: Tom cc: Terry Lambert , hackers@FreeBSD.ORG Subject: Re: cloning drivers In-reply-to: Your message of "Sat, 24 Jan 1998 16:56:22 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 25 Jan 1998 11:59:41 +1030 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk > On Sun, 25 Jan 1998, Terry Lambert wrote: > > > I have a cloning pty driver and cloning bfs and tun and vnode > > drivers as well. > > Can it become more generic so that any driver can be cloned? > > It seems silly to me that I need to recompile the kernel to support an > additional (but identical to the first) ethernet card. > > It seems to me that some of the PCI devices do this somewhat > automatically right now? IE. if you added a "device de0", it > automatically makes devices de0 to de(N-1) for N DEC ethernet cards? You're confusing a couple of related issues here. A cloning driver is one where you walk up to some control node and say "I'll have a new one of these, thanks". It's most useful for logical entities (like ptys, or bpfilter handles). On the other hand, the number of instances of a device that a driver handles internally is dependant on the driver's internal policy. Most drivers allocate a fixed-size static array of instance references at compile time. This is done because at runtime they are (currently) only provided with their major/minor numbers when their entrypoints are called, and so lookup for the corresponding instance is easiest when simply indexing into the array. This is what Jean-Mark Gurney is working on in the "interrupt argument to void *" thread, and one of the things that DEVFS aims to combat. By allowing the driver to specify a token that will be handed back to it on entry, it becomes possible to dynamically allocate device instances and address them efficiently. All it takes is developer time. Want to get involved? > Tom > > -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\