From owner-freebsd-questions Tue Feb 27 9:14:10 2001 Delivered-To: freebsd-questions@freebsd.org Received: from wally.eecs.harvard.edu (wally.eecs.harvard.edu [140.247.60.30]) by hub.freebsd.org (Postfix) with ESMTP id E0ECC37B718 for ; Tue, 27 Feb 2001 09:14:05 -0800 (PST) (envelope-from magoutis@eecs.harvard.edu) Received: (from magoutis@localhost) by wally.eecs.harvard.edu (8.10.0/8.10.0) id f1RHE4d30504; Tue, 27 Feb 2001 12:14:04 -0500 (EST) Date: Tue, 27 Feb 2001 12:14:04 -0500 (EST) Message-Id: <200102271714.f1RHE4d30504@wally.eecs.harvard.edu> From: Kostas Magoutis To: freebsd-questions@FreeBSD.ORG Subject: keeping device instance information Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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