From owner-freebsd-hackers Sat Dec 11 20:24:16 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp6.mindspring.com (smtp6.mindspring.com [207.69.200.110]) by hub.freebsd.org (Postfix) with ESMTP id 2EE7014F41 for ; Sat, 11 Dec 1999 20:24:13 -0800 (PST) (envelope-from vsilyaev@mindspring.com) Received: from mindspring.com (user-2iveauh.dialup.mindspring.com [165.247.43.209]) by smtp6.mindspring.com (8.9.3/8.8.5) with ESMTP id XAA13068; Sat, 11 Dec 1999 23:24:10 -0500 (EST) Received: (from vsilyaev@localhost) by mindspring.com (8.9.3/8.9.3) id XAA01743; Sat, 11 Dec 1999 23:24:08 -0500 (EST) (envelope-from vsilyaev) Date: Sat, 11 Dec 1999 23:24:07 -0500 From: "Vladimir N. Silyaev" To: David Greenman Cc: "Vladimir N. Silyaev" , hackers@FreeBSD.ORG Subject: Re: Multiple instances of the same character device Message-ID: <19991211232407.A1699@jupiter.delta.ny.us> References: <199912120314.TAA03134@implode.root.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <199912120314.TAA03134@implode.root.com>; from dg@root.com on Sat, Dec 11, 1999 at 07:14:37PM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, Dec 11, 1999 at 07:14:37PM -0800, David Greenman wrote: > >The question is very simple. Is it possible to open the same character > >pseudo device, for example /dev/foo0, simultaneously from other programs, > >and to work with this instances independently? > > > The simple answer is yes. Ok. Where I could to store the pointer to instance of opened device? The data passed to d_open, I mean dev_t, is a specific only to major/minor device number. And how to have access to this context in other device methods? > The only issue has to do with closing the device. > If you don't care about the device driver close routine being called except > on the last close, then everything should work just fine. This is a unlikely future, to have only on last close, because close doing release of system resources (per instance allocated). > I assume this question is related to you work on VMware for FreeBSD? Exactly, this guys to create new virtual machine opened /dev/vmmon device, and stored private data in the special field of the 'struct file'. And the same, with networking. Of course I mean Linux version of their drivers. The FreeBSD version of these drivers store data in the dev_t structure, and because of that it's working fine until you are don't tried to open a new session. -- Vladimir Silyaev To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message