Sharing device driver between kernel and user space

Ivan Voras ivoras at freebsd.org
Wed Sep 21 12:26:17 UTC 2011


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 kernel
> 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 should provide 2 interfaces: one for user space
>  (through char dev) and the other for kernel land. The problem is how to 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110921/1b96d8e3/signature.pgp


More information about the freebsd-hackers mailing list