[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>
3 files changed
tree: 3b9dac4056f76e88c72f43b2984705b0a2f5eb86
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. linux-user/
  12. net/
  13. pc-bios/
  14. QMP/
  15. roms/
  16. slirp/
  17. sysconfigs/
  18. target-alpha/
  19. target-arm/
  20. target-cris/
  21. target-i386/
  22. target-m68k/
  23. target-microblaze/
  24. target-mips/
  25. target-ppc/
  26. target-s390x/
  27. target-sh4/
  28. target-sparc/
  29. tcg/
  30. tests/
  31. ui/
  32. .gitignore
  33. .gitmodules
  34. a.out.h
  35. acl.c
  36. acl.h
  37. aes.c
  38. aes.h
  39. aio.c
  40. alpha-dis.c
  41. alpha.ld
  42. arch_init.c
  43. arch_init.h
  44. arm-dis.c
  45. arm-semi.c
  46. arm.ld
  47. async.c
  48. balloon.c
  49. balloon.h
  50. block-migration.c
  51. block-migration.h
  52. block.c
  53. block.h
  54. block_int.h
  55. blockdev.c
  56. blockdev.h
  57. bswap.h
  58. bt-host.c
  59. bt-host.h
  60. bt-vhci.c
  61. buffered_file.c
  62. buffered_file.h
  63. cache-utils.c
  64. cache-utils.h
  65. Changelog
  66. check-qdict.c
  67. check-qfloat.c
  68. check-qint.c
  69. check-qjson.c
  70. check-qlist.c
  71. check-qstring.c
  72. cmd.c
  73. cmd.h
  74. CODING_STYLE
  75. config.h
  76. configure
  77. console.c
  78. console.h
  79. COPYING
  80. COPYING.LIB
  81. cpu-all.h
  82. cpu-common.h
  83. cpu-defs.h
  84. cpu-exec.c
  85. cpus.c
  86. cpus.h
  87. create_config
  88. cris-dis.c
  89. cursor.c
  90. cursor_hidden.xpm
  91. cursor_left_ptr.xpm
  92. cutils.c
  93. def-helper.h
  94. device_tree.c
  95. device_tree.h
  96. dis-asm.h
  97. disas.c
  98. disas.h
  99. dma-helpers.c
  100. dma.h
  101. dyngen-exec.h
  102. elf.h
  103. envlist.c
  104. envlist.h
  105. exec-all.h
  106. exec.c
  107. feature_to_c.sh
  108. gdbstub.c
  109. gdbstub.h
  110. gen-icount.h
  111. HACKING
  112. hmp-commands.hx
  113. host-utils.c
  114. host-utils.h
  115. hpet.h
  116. hppa-dis.c
  117. hppa.ld
  118. hxtool
  119. i386-dis.c
  120. i386.ld
  121. ia64-dis.c
  122. ia64.ld
  123. input.c
  124. ioport-user.c
  125. ioport.c
  126. ioport.h
  127. iov.c
  128. iov.h
  129. json-lexer.c
  130. json-lexer.h
  131. json-parser.c
  132. json-parser.h
  133. json-streamer.c
  134. json-streamer.h
  135. kvm-all.c
  136. kvm-stub.c
  137. kvm.h
  138. libfdt_env.h
  139. LICENSE
  140. linux-aio.c
  141. m68k-dis.c
  142. m68k-semi.c
  143. m68k.ld
  144. MAINTAINERS
  145. Makefile
  146. Makefile.dis
  147. Makefile.hw
  148. Makefile.objs
  149. Makefile.target
  150. Makefile.user
  151. microblaze-dis.c
  152. migration-exec.c
  153. migration-fd.c
  154. migration-tcp.c
  155. migration-unix.c
  156. migration.c
  157. migration.h
  158. mips-dis.c
  159. mips.ld
  160. module.c
  161. module.h
  162. monitor.c
  163. monitor.h
  164. nbd.c
  165. nbd.h
  166. net-checksum.c
  167. net.c
  168. net.h
  169. notify.c
  170. notify.h
  171. os-posix.c
  172. os-win32.c
  173. osdep.c
  174. osdep.h
  175. path.c
  176. pci-ids.txt
  177. pflib.c
  178. pflib.h
  179. poison.h
  180. posix-aio-compat.c
  181. ppc-dis.c
  182. ppc.ld
  183. ppc64.ld
  184. qbool.c
  185. qbool.h
  186. qdict-test-data.txt
  187. qdict.c
  188. qdict.h
  189. qemu-aio.h
  190. qemu-barrier.h
  191. qemu-binfmt-conf.sh
  192. qemu-char.c
  193. qemu-char.h
  194. qemu-common.h
  195. qemu-config.c
  196. qemu-config.h
  197. qemu-doc.texi
  198. qemu-error.c
  199. qemu-error.h
  200. qemu-img-cmds.hx
  201. qemu-img.c
  202. qemu-img.texi
  203. qemu-io.c
  204. qemu-lock.h
  205. qemu-log.h
  206. qemu-malloc.c
  207. qemu-nbd.c
  208. qemu-nbd.texi
  209. qemu-objects.h
  210. qemu-option.c
  211. qemu-option.h
  212. qemu-options.h
  213. qemu-options.hx
  214. qemu-os-posix.h
  215. qemu-os-win32.h
  216. qemu-queue.h
  217. qemu-sockets.c
  218. qemu-tech.texi
  219. qemu-thread.c
  220. qemu-thread.h
  221. qemu-timer.c
  222. qemu-timer.h
  223. qemu-tool.c
  224. qemu-x509.h
  225. qemu.sasl
  226. qemu_socket.h
  227. qerror.c
  228. qerror.h
  229. qfloat.c
  230. qfloat.h
  231. qint.c
  232. qint.h
  233. qjson.c
  234. qjson.h
  235. qlist.c
  236. qlist.h
  237. qmp-commands.hx
  238. qobject.h
  239. qstring.c
  240. qstring.h
  241. range.h
  242. readline.c
  243. readline.h
  244. README
  245. rules.mak
  246. rwhandler.c
  247. rwhandler.h
  248. s390-dis.c
  249. s390.ld
  250. savevm.c
  251. sh4-dis.c
  252. simpletrace.c
  253. simpletrace.h
  254. simpletrace.py
  255. softmmu-semi.h
  256. softmmu_defs.h
  257. softmmu_exec.h
  258. softmmu_header.h
  259. softmmu_template.h
  260. sparc-dis.c
  261. sparc.ld
  262. sparc64.ld
  263. sysemu.h
  264. targphys.h
  265. tcg-runtime.c
  266. texi2pod.pl
  267. thunk.c
  268. thunk.h
  269. TODO
  270. trace-events
  271. tracetool
  272. translate-all.c
  273. uboot_image.h
  274. usb-bsd.c
  275. usb-linux.c
  276. usb-stub.c
  277. VERSION
  278. version.rc
  279. vgafont.h
  280. vl.c
  281. x86_64.ld