From owner-freebsd-current@FreeBSD.ORG Mon Sep 8 21:31:07 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86144106579F; Mon, 8 Sep 2008 21:31:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 074D88FC15; Mon, 8 Sep 2008 21:31:06 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [IPv6:2001:470:1f11:75:2a0:d2ff:fe18:8b38]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m88LUZtU096483; Mon, 8 Sep 2008 17:31:00 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Mon, 8 Sep 2008 17:29:34 -0400 User-Agent: KMail/1.9.7 References: <200809080202.00664.vehemens@verizon.net> <200809080350.41579.vehemens@verizon.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200809081729.35340.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:2001:470:1f11:75::1]); Mon, 08 Sep 2008 17:31:01 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8162/Thu Sep 4 12:38:45 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Kostik Belousov , Robert Watson , vehemens Subject: Re: bsd versus linux device drivers X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Sep 2008 21:31:07 -0000 On Monday 08 September 2008 09:41:53 am Robert Watson wrote: > On Mon, 8 Sep 2008, vehemens wrote: > > On Monday 08 September 2008 03:04:15 am Kostik Belousov wrote: > >> On Mon, Sep 08, 2008 at 02:02:00AM -0700, vehemens wrote: > >>> In linux drivers, there is a one to one relationship to an open and a > >>> calling argument structure called struct file. It provides a private > >>> data pointer that allows the driver to preserve unique state > >>> information across other calls such as read/write/ioctl/mmap/close etc. > >>> > >>> For bsd drivers, my understanding there is not an equivalent. As a > >>> result it is not possible to preserve different state information for > >>> multiple opens by the same thread of the same device major/minor #'s. > >>> > >>> Is this correct, or did i miss something? > >> > >> There is devfs_{get,set}_cdevpriv() KPI. Still no manpage, I shall fix > >> this ASAP. > > > > Just started looking at the firewire driver which has clone. It looks > > like it hooks into the event handler. > > > > Don't quite understand it all yet, so I'm going to look forward to that > > man page. > > Many device drivers continue to use the old clone interface, but are > gradually being converted over. You can look at the definitions and list > of converted drivers here: > > http://fxr.watson.org/fxr/ident?im=bigexcerpts;i=devfs_set_cdevpriv > > Looking at some of the converted drivers, I find myself a bit worried by > the extra error handling: in what situations do we expect that bpfioctl() > might be called without its cdev-private data? I think that is just hyper-paranoia. -- John Baldwin