From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 21 12:26:16 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 F3388106564A for ; Wed, 21 Sep 2011 12:26:16 +0000 (UTC) (envelope-from freebsd-hackers@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 7B0E88FC12 for ; Wed, 21 Sep 2011 12:26:16 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R6LsU-00078J-6z for freebsd-hackers@freebsd.org; Wed, 21 Sep 2011 14:26:14 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Sep 2011 14:26:14 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Sep 2011 14:26:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-hackers@freebsd.org From: Ivan Voras Date: Wed, 21 Sep 2011 14:25:48 +0200 Lines: 46 Message-ID: References: <201109202202.19481.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA9ACA5241980A903A14E5E64" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0.1) Gecko/20110907 Thunderbird/6.0.1 In-Reply-To: X-Enigmail-Version: 1.1.2 Subject: Re: Sharing device driver between kernel and user space 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: Wed, 21 Sep 2011 12:26:17 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA9ACA5241980A903A14E5E64 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 21/09/2011 08:05, geoffrey levand wrote: > I think you misunderstood what i need. If i got it right then cuse4bsd = allows user applications to create char devices, right ? > I do not want to create character devices from user space. My VUART ker= nel > module should provide the character device for user space. What i need = is a way to synchronize access > to VUART data between kernel and user space. The kernel device driver s= hould provide 2 interfaces: one for user space > (through char dev) and the other for kernel land. The problem is how t= o synchronize the access to VUART data between 2 > lands because VUART cannot be shared by both simultaneously. I'm not sure I understand your question but what exactly is the problem here? As the userland will access the device through the char device, you need kernel code which services this device's requests. This kernel code can use any number of synchronization operations provided by the kernel to protect access to any and all needed resources. In other words, you should have a single point of entry to the device in the kernel anyway (e.g. a module, a header file, whatever) and then you may need just a simple sx(9) lock or a sema(9) semaphore, assuming the device access needs sleeping, or mutex(9) if it doesn't. --------------enigA9ACA5241980A903A14E5E64 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5519IACgkQldnAQVacBcgwWACeO64/8QOZVbYcpr7hlLAnKIuu A3cAn24SYUw4255MeHd9XnbYgdb/mMfR =r7GV -----END PGP SIGNATURE----- --------------enigA9ACA5241980A903A14E5E64--