Re: How to avoid data copies in a driver ?

linux-os (Dick Johnson)
2008-05-14T21:23:22Z

On Wed, 14 May 2008, Francis Moreau wrote:

> Hello,
>
> I'd like to optimize my driver, which receives data through a fifo and gives
> them to a user space application. In turns this application moves this data
> into a file.
>
> To avoid several useless copies, I'd like the application to pass to
> the driver
> a file descriptor (?) to the driver and then the driver can directly
> move the
> received data to that file.
>
> Could anybody give me some example of such scheme ?
>
> Thanks,
> --
> Francis
> --

You memory-map the data. Impliment mmap() in your driver.
You can also impliment poll() { select() } so your
application knows when new data are available.

You cannot use a user-mode file-descriptor in the kernel.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.22.1 on an i686 machine (5588.29 BogoMips).
My book : http://www.AbominableFirebug.com/
_

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.