[virtio-9p] Use preadv/pwritev instead of readv/writev
authorSanchit Garg <sancgarg@linux.vnet.ibm.com>
Fri, 8 Oct 2010 06:00:16 +0000 (11:30 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 20 Oct 2010 17:10:59 +0000 (12:10 -0500)
commit56d15a53292c06a9c8c574e368003f57a06522ee
tree3b9dac4056f76e88c72f43b2984705b0a2f5eb86
parent9f506893a454ce24263aba49594aa953e9a52853
[virtio-9p] Use preadv/pwritev instead of readv/writev

readv & writev, read & write respectively from the current offset
of the file & hence their use has to be preceeded by a call to lseek.
preadv/writev can be used instead, as they take the offset as an argument.
This saves one system call( lseek ).
In case preadv is not supported, it is implemented by an lseek
followed by a readv. Depending upon the configuration of QEMU, the
appropriate read & write methods are selected. This patch also fixes the
zero byte read/write bug & obviates the need to apply a fix for that bug separately.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Sanchit Garg <sancgarg@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
hw/file-op-9p.h
hw/virtio-9p-local.c
hw/virtio-9p.c