Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Feb 2001 12:14:04 -0500 (EST)
From:      Kostas Magoutis <magoutis@eecs.harvard.edu>
To:        freebsd-questions@FreeBSD.ORG
Subject:   keeping device instance information
Message-ID:  <200102271714.f1RHE4d30504@wally.eecs.harvard.edu>

next in thread | raw e-mail | index | archive | help
Hello,

I am porting a Linux device driver to FreeBSD for a user-space
networking card.  The problem that I am facing is that I need to keep
individual state for every opened instance of the device.  For
example, if two processes do open("/dev/card", O_RDWR), I want to the
driver to somehow be able to distinguish between the two opened
instances of the device and keep separate state for each instance.

The way things happen now is, each device is accessed via specfs, and
from within the driver (e.g. card_open, card_ioctl, etc.) I see no
way to hang state for each opened instance.

In Linux, the device open, ioctl, etc. calls receive the inode and
file structure pointer for that opened instance of the device, and the
file structure has a private_data space to keep space for each
instance.

In FreeBSD, there are separate file structures for each opened
instance and they point to the same vnode.  The file structure has
nothing like the vnode's v_data to keep instance-specific state.

Am I missing something or is there perhaps a way to do this that I
don't know of yet?  I suspect using devfs may work but I haven't
looked at devfs in detail yet.

Thanks for any help,

Kostas

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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