Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Feb 2001 07:27:56 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        magoutis@eecs.harvard.edu (Kostas Magoutis)
Cc:        freebsd-arch@FreeBSD.ORG
Subject:   Re: Logical device instances
Message-ID:  <200102280727.AAA19158@usr05.primenet.com>
In-Reply-To: <200102280048.f1S0m9n09106@wally.eecs.harvard.edu> from "Kostas Magoutis" at Feb 27, 2001 07:48:09 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102280727.AAA19158>