virtio-9p: getattr server implementation for 9P2000.L protocol.

           SYNOPSIS

              size[4] Tgetattr tag[2] fid[4] request_mask[8]

              size[4] Rgetattr tag[2] lstat[n]

           DESCRIPTION

              The getattr transaction inquires about the file identified by fid.
              request_mask is a bit mask that specifies which fields of the
              stat structure is the client interested in.

              The reply will contain a machine-independent directory entry,
              laid out as follows:

                 st_result_mask[8]
                    Bit mask that indicates which fields in the stat structure
                    have been populated by the server

                 qid.type[1]
                    the type of the file (directory, etc.), represented as a bit
                    vector corresponding to the high 8 bits of the file's mode
                    word.

                 qid.vers[4]
                    version number for given path

                 qid.path[8]
                    the file server's unique identification for the file

                 st_mode[4]
                    Permission and flags

                 st_uid[4]
                    User id of owner

                 st_gid[4]
                    Group ID of owner

                 st_nlink[8]
                    Number of hard links

                 st_rdev[8]
                    Device ID (if special file)

                 st_size[8]
                    Size, in bytes

                 st_blksize[8]
                    Block size for file system IO

                 st_blocks[8]
                    Number of file system blocks allocated

                 st_atime_sec[8]
                    Time of last access, seconds

                 st_atime_nsec[8]
                    Time of last access, nanoseconds

                 st_mtime_sec[8]
                    Time of last modification, seconds

                 st_mtime_nsec[8]
                    Time of last modification, nanoseconds

                 st_ctime_sec[8]
                    Time of last status change, seconds

                 st_ctime_nsec[8]
                    Time of last status change, nanoseconds

                 st_btime_sec[8]
                    Time of creation (birth) of file, seconds

                 st_btime_nsec[8]
                    Time of creation (birth) of file, nanoseconds

                 st_gen[8]
                    Inode generation

                 st_data_version[8]
                    Data version number

              request_mask and result_mask bit masks contain the following bits
                 #define P9_STATS_MODE          0x00000001ULL
                 #define P9_STATS_NLINK         0x00000002ULL
                 #define P9_STATS_UID           0x00000004ULL
                 #define P9_STATS_GID           0x00000008ULL
                 #define P9_STATS_RDEV          0x00000010ULL
                 #define P9_STATS_ATIME         0x00000020ULL
                 #define P9_STATS_MTIME         0x00000040ULL
                 #define P9_STATS_CTIME         0x00000080ULL
                 #define P9_STATS_INO           0x00000100ULL
                 #define P9_STATS_SIZE          0x00000200ULL
                 #define P9_STATS_BLOCKS        0x00000400ULL

                 #define P9_STATS_BTIME         0x00000800ULL
                 #define P9_STATS_GEN           0x00001000ULL
                 #define P9_STATS_DATA_VERSION  0x00002000ULL

                 #define P9_STATS_BASIC         0x000007ffULL
                 #define P9_STATS_ALL           0x00003fffULL

        This patch implements the client side of getattr implementation for 9P2000.L.
        It introduces a new structure p9_stat_dotl for getting Linux stat information
        along with QID. The data layout is similar to stat structure in Linux user
        space with the following major differences:

        inode (st_ino) is not part of data. Instead qid is.

        device (st_dev) is not part of data because this doesn't make sense on the
        client.

        All time variables are 64 bit wide on the wire. The kernel seems to use
        32 bit variables for these variables. However, some of the architectures
        have used 64 bit variables and glibc exposes 64 bit variables to user
        space on some architectures. Hence to be on the safer side we have made
        these 64 bit in the protocol. Refer to the comments in
        include/asm-generic/stat.h

        There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
        st_data_version apart from the bitmask, st_result_mask. The bit mask
        is filled by the server to indicate which stat fields have been
        populated by the server. Currently there is no clean way for the
        server to obtain these additional fields, so it sends back just the
        basic fields.

        Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
        Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
3 files changed
tree: e2cd353cfc790c0be58bb196f79c5d4423e98983
  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. host-utils.c
  112. host-utils.h
  113. hpet.h
  114. hppa-dis.c
  115. hppa.ld
  116. hxtool
  117. i386-dis.c
  118. i386.ld
  119. ia64-dis.c
  120. ia64.ld
  121. input.c
  122. ioport-user.c
  123. ioport.c
  124. ioport.h
  125. iov.c
  126. iov.h
  127. json-lexer.c
  128. json-lexer.h
  129. json-parser.c
  130. json-parser.h
  131. json-streamer.c
  132. json-streamer.h
  133. kvm-all.c
  134. kvm-stub.c
  135. kvm.h
  136. libfdt_env.h
  137. LICENSE
  138. linux-aio.c
  139. m68k-dis.c
  140. m68k-semi.c
  141. m68k.ld
  142. MAINTAINERS
  143. Makefile
  144. Makefile.dis
  145. Makefile.hw
  146. Makefile.objs
  147. Makefile.target
  148. Makefile.user
  149. microblaze-dis.c
  150. migration-exec.c
  151. migration-fd.c
  152. migration-tcp.c
  153. migration-unix.c
  154. migration.c
  155. migration.h
  156. mips-dis.c
  157. mips.ld
  158. module.c
  159. module.h
  160. monitor.c
  161. monitor.h
  162. nbd.c
  163. nbd.h
  164. net-checksum.c
  165. net.c
  166. net.h
  167. notify.c
  168. notify.h
  169. os-posix.c
  170. os-win32.c
  171. osdep.c
  172. osdep.h
  173. path.c
  174. pci-ids.txt
  175. poison.h
  176. posix-aio-compat.c
  177. ppc-dis.c
  178. ppc.ld
  179. ppc64.ld
  180. qbool.c
  181. qbool.h
  182. qdict-test-data.txt
  183. qdict.c
  184. qdict.h
  185. qemu-aio.h
  186. qemu-barrier.h
  187. qemu-binfmt-conf.sh
  188. qemu-char.c
  189. qemu-char.h
  190. qemu-common.h
  191. qemu-config.c
  192. qemu-config.h
  193. qemu-doc.texi
  194. qemu-error.c
  195. qemu-error.h
  196. qemu-img-cmds.hx
  197. qemu-img.c
  198. qemu-img.texi
  199. qemu-io.c
  200. qemu-lock.h
  201. qemu-log.h
  202. qemu-malloc.c
  203. qemu-monitor.hx
  204. qemu-nbd.c
  205. qemu-nbd.texi
  206. qemu-objects.h
  207. qemu-option.c
  208. qemu-option.h
  209. qemu-options.h
  210. qemu-options.hx
  211. qemu-os-posix.h
  212. qemu-os-win32.h
  213. qemu-queue.h
  214. qemu-sockets.c
  215. qemu-tech.texi
  216. qemu-thread.c
  217. qemu-thread.h
  218. qemu-timer.c
  219. qemu-timer.h
  220. qemu-tool.c
  221. qemu-x509.h
  222. qemu.sasl
  223. qemu_socket.h
  224. qerror.c
  225. qerror.h
  226. qfloat.c
  227. qfloat.h
  228. qint.c
  229. qint.h
  230. qjson.c
  231. qjson.h
  232. qlist.c
  233. qlist.h
  234. qobject.h
  235. qstring.c
  236. qstring.h
  237. readline.c
  238. readline.h
  239. README
  240. rules.mak
  241. rwhandler.c
  242. rwhandler.h
  243. s390-dis.c
  244. s390.ld
  245. savevm.c
  246. sh4-dis.c
  247. softmmu-semi.h
  248. softmmu_defs.h
  249. softmmu_exec.h
  250. softmmu_header.h
  251. softmmu_template.h
  252. sparc-dis.c
  253. sparc.ld
  254. sparc64.ld
  255. sysemu.h
  256. targphys.h
  257. tcg-runtime.c
  258. texi2pod.pl
  259. thunk.c
  260. thunk.h
  261. TODO
  262. translate-all.c
  263. uboot_image.h
  264. usb-bsd.c
  265. usb-linux.c
  266. usb-stub.c
  267. VERSION
  268. vgafont.h
  269. vl.c
  270. x86_64.ld