How to use sendfile with a char device driver's file descriptor

From: Vinesh Christopher (vineshc@ami.com)
Date: Mon Jun 30 2003 - 15:07:07 EST


I have a device driver which has to sent a data through network. Currently
the driver's buffer is mmaped to the user mode program which uses the
standard socket sent() call.

To improve the performance and reduce CPU overhead, I tried using sendfile()
Call. But it failed with EINVAL.

Browsing thru the mm/filemap.c, I found the driver has to provide a readpage
functions in address_space_operations. So I added it.

Now the sendfile() does not fail, but it returns with 0 bytes sent. Also my
function readpage is never called.

How can I use sendfile() with my driver? Is there any documentation
available on how to add address_space_operations to a driver, so that
sendfile can be used.

Any help will be appreciated

Samvinesh Christopher.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 30 2003 - 22:00:34 EST