From owner-freebsd-arch Wed Feb 28 6:11:28 2001 Delivered-To: freebsd-arch@freebsd.org Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by hub.freebsd.org (Postfix) with ESMTP id B73CC37B719 for ; Wed, 28 Feb 2001 06:11:25 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from [62.49.251.130] (helo=herring.nlsystems.com) by anchor-post-31.mail.demon.net with esmtp (Exim 2.12 #1) id 14Y7K8-0000RT-0V; Wed, 28 Feb 2001 14:11:24 +0000 Received: from herring (herring [10.0.0.2]) by herring.nlsystems.com (8.11.2/8.11.2) with ESMTP id f1SEBO135968; Wed, 28 Feb 2001 14:11:24 GMT (envelope-from dfr@nlsystems.com) Date: Wed, 28 Feb 2001 14:11:24 +0000 (GMT) From: Doug Rabson To: Kostas Magoutis Cc: Subject: Re: Logical device instances In-Reply-To: <200102280048.f1S0m9n09106@wally.eecs.harvard.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 27 Feb 2001, Kostas Magoutis wrote: > 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? Until yesterday, I thought that there was no way to do this (I wanted to do this when porting a Linux device driver). As it turns out, there is a cunning trick which you can use to generate a new 'struct file' with your own ops table and private data. Check out sys/dev/streams/streams.c and see what it does at the end of streamsopen(). -- Doug Rabson Mail: dfr@nlsystems.com Phone: +44 20 8348 6160 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message