From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 26 12:44:14 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6ED4A106564A for ; Tue, 26 Apr 2011 12:44:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id E200E8FC19 for ; Tue, 26 Apr 2011 12:44:13 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p3QCi3dk051887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Apr 2011 15:44:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p3QCi35r084042; Tue, 26 Apr 2011 15:44:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p3QCi3xg084041; Tue, 26 Apr 2011 15:44:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 26 Apr 2011 15:44:03 +0300 From: Kostik Belousov To: Bartosz Fabianowski Message-ID: <20110426124403.GQ48734@deviant.kiev.zoral.com.ua> References: <4DB695DB.1080505@chillt.de> <201104261217.23858.hselasky@c2i.net> <4DB6BCC6.5050001@chillt.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WeAyUrhnD1IdQdNw" Content-Disposition: inline In-Reply-To: <4DB6BCC6.5050001@chillt.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org, Hans Petter Selasky Subject: Re: Is there some implicit locking of device methods? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 12:44:14 -0000 --WeAyUrhnD1IdQdNw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 26, 2011 at 02:38:30PM +0200, Bartosz Fabianowski wrote: > >You need to handle all cases in your driver. Fortunately there exists a > >solution for this already, called USB cdev. See >=20 > I went through all the USB drivers with a fine comb (the driver I am=20 > porting was based on the old USB stack and so I needed to adjust it for= =20 > the new stack). Drivers like ulpt seem to be based around usb_fifo_*=20 > structures. If I understand usb_fifo_* right, it gives you a single=20 > device with FIFO semantics. This is not sufficient in my case. My device= =20 > is opened for reading by several processes in parallel and needs to keep= =20 > a separate FIFO per process. I implemented this via device cloning - and= =20 > I could not see how to integrate that with usb_fifo_*. Thus, I based my= =20 > driver on the raw cdev framework. Am I missing something obvious and=20 > making my life unnecessarily hard? If you needs per-file private data for cdev, you would be better served by cdevpriv(9) KPI. Cloning is too hard to use correctly for such task. --WeAyUrhnD1IdQdNw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk22vhMACgkQC3+MBN1Mb4jq/ACgh7bEvUdwzsQyqdmlB0VAILBZ jmcAniztTn+VDRY8pitGjQ/F2RDTvHsI =noOB -----END PGP SIGNATURE----- --WeAyUrhnD1IdQdNw--