diff options
author | Sanchit Garg <sancgarg@linux.vnet.ibm.com> | 2010-10-08 11:30:16 +0530 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-10-20 12:10:59 -0500 |
commit | 56d15a53292c06a9c8c574e368003f57a06522ee (patch) | |
tree | 3b9dac4056f76e88c72f43b2984705b0a2f5eb86 /hw/file-op-9p.h | |
parent | 9f506893a454ce24263aba49594aa953e9a52853 (diff) |
[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>
Diffstat (limited to 'hw/file-op-9p.h')
-rw-r--r-- | hw/file-op-9p.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/file-op-9p.h b/hw/file-op-9p.h index bf867b924c..21d60b5855 100644 --- a/hw/file-op-9p.h +++ b/hw/file-op-9p.h @@ -80,9 +80,8 @@ typedef struct FileOperations off_t (*telldir)(FsContext *, DIR *); struct dirent *(*readdir)(FsContext *, DIR *); void (*seekdir)(FsContext *, DIR *, off_t); - ssize_t (*readv)(FsContext *, int, const struct iovec *, int); - ssize_t (*writev)(FsContext *, int, const struct iovec *, int); - off_t (*lseek)(FsContext *, int, off_t, int); + ssize_t (*preadv)(FsContext *, int, const struct iovec *, int, off_t); + ssize_t (*pwritev)(FsContext *, int, const struct iovec *, int, off_t); int (*mkdir)(FsContext *, const char *, FsCred *); int (*fstat)(FsContext *, int, struct stat *); int (*rename)(FsContext *, const char *, const char *); |