From owner-freebsd-arch Tue Feb 27 23:28: 4 2001 Delivered-To: freebsd-arch@freebsd.org Received: from smtp10.phx.gblx.net (smtp10.phx.gblx.net [206.165.6.140]) by hub.freebsd.org (Postfix) with ESMTP id A076337B71B for ; Tue, 27 Feb 2001 23:28:01 -0800 (PST) (envelope-from tlambert@usr05.primenet.com) Received: (from daemon@localhost) by smtp10.phx.gblx.net (8.9.3/8.9.3) id AAA80880; Wed, 28 Feb 2001 00:27:37 -0700 Received: from usr05.primenet.com(206.165.6.205) via SMTP by smtp10.phx.gblx.net, id smtpd5Rmwya; Wed Feb 28 00:27:34 2001 Received: (from tlambert@localhost) by usr05.primenet.com (8.8.5/8.8.5) id AAA19158; Wed, 28 Feb 2001 00:27:56 -0700 (MST) From: Terry Lambert Message-Id: <200102280727.AAA19158@usr05.primenet.com> Subject: Re: Logical device instances To: magoutis@eecs.harvard.edu (Kostas Magoutis) Date: Wed, 28 Feb 2001 07:27:56 +0000 (GMT) Cc: freebsd-arch@FreeBSD.ORG In-Reply-To: <200102280048.f1S0m9n09106@wally.eecs.harvard.edu> from "Kostas Magoutis" at Feb 27, 2001 07:48:09 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I am writing a device driver for a user-level networking card. User > level code interacts with it via open, close, mmap, and ioctl. A > separate logical instance of the device needs to be created each time > a process opens the device (as in when a file is created when a vnode > is opened). The device driver needs to have a way to find out on what > logical instance of the device a system call is performed. It seems > to me that at present (with either specfs or devfs), the device driver > has no way to find out on what opened instance of the device an > operation is performed. Am I missing something or the present device > driver interfaces just don't support such functionality? Networking devices aren't really devices. What you want is a raw socket. As a general not, FreeBSD can't suport clonging devices because of the "struct fileops *" indirection. This is one of the reasons we can't run multiple copies of VMWare, since we can't create multiple instances of state from the one device, and since the VMWare code we have to run under emulation expects a cloning device, such as is supported by Linux. There was a long discussion about cloning devices on this list a while back, in which several approaches were suggested; mine was rejected, and the others weren't implemented. See the list archives for details. Personally, for your use, I don't believe you need a cloning device or to do as much work as Julian suggested; worst case, you could use BPF ("man bpf"). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message