libimobiledevice/libimobiledevice — pull request #88 by kamstrup (2014-05-25 20:56:05+00:00)
Title: afc: new API using sendfile() for fast and light operation

Adds two new public functions:

idevice_connection_sendfile(): Wraps sendfile() on Unix
to avoid copying data between kernel and user space when
transfering regular files. Falls back to regular read/write
and non-Unices

afc_file_write_from_fd(): Using idevice_connection_sendfile()
but in the higher level AFC API.

Using sendfile() might only be a smidgeon faster than hand optimized
regular read/write ops, but it puts a noticably lighter load on the
system because it avoids memory churn and context switches. For
non-optimized read/write loads sendfile is about 8 times faster.

Also - the API is nice to use :-) What was 10-20 lines of tricky
buffer juggling is now a 1-liner for most situations.

I tested all #ifdef chunks extensively by transferring files back and forth and checking md5 sums. Everything is working. I have branches porting ideviceinstaller and afcclient to use sendfile if we land this.