qemu-ga: Add interface to traverse the qmp command list by QmpCommand

In the original code, qmp_get_command_list is used to construct
a list of all commands' name. To get the information of all qga
commands, it traverses the name list and search the command info
with its name.  So it can cause O(n^2) in the number of commands.

This patch adds an interface to traverse the qmp command list by
QmpCommand to replace qmp_get_command_list. It can decrease the
complexity from O(n^2) to O(n).

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
*fix up commit subject
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
4 files changed
tree: f4c7abf2d2bc74ee4d092aae95f8eb55c1c909ef
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. disas/
  7. docs/
  8. fpu/
  9. fsdev/
  10. gdb-xml/
  11. hw/
  12. include/
  13. libcacard/
  14. linux-headers/
  15. linux-user/
  16. net/
  17. pc-bios/
  18. po/
  19. qapi/
  20. qga/
  21. qobject/
  22. qom/
  23. roms/
  24. scripts/
  25. slirp/
  26. stubs/
  27. sysconfigs/
  28. target-alpha/
  29. target-arm/
  30. target-cris/
  31. target-i386/
  32. target-lm32/
  33. target-m68k/
  34. target-microblaze/
  35. target-mips/
  36. target-moxie/
  37. target-openrisc/
  38. target-ppc/
  39. target-s390x/
  40. target-sh4/
  41. target-sparc/
  42. target-unicore32/
  43. target-xtensa/
  44. tcg/
  45. tests/
  46. trace/
  47. ui/
  48. util/
  49. .exrc
  50. .gitignore
  51. .gitmodules
  52. .mailmap
  53. aio-posix.c
  54. aio-win32.c
  55. arch_init.c
  56. async.c
  57. balloon.c
  58. block-migration.c
  59. block.c
  60. blockdev-nbd.c
  61. blockdev.c
  62. blockjob.c
  63. bt-host.c
  64. bt-vhci.c
  65. Changelog
  66. CODING_STYLE
  67. configure
  68. COPYING
  69. COPYING.LIB
  70. coroutine-gthread.c
  71. coroutine-sigaltstack.c
  72. coroutine-ucontext.c
  73. coroutine-win32.c
  74. cpu-exec.c
  75. cpus.c
  76. cputlb.c
  77. device-hotplug.c
  78. device_tree.c
  79. disas.c
  80. dma-helpers.c
  81. dump.c
  82. exec.c
  83. gdbstub.c
  84. HACKING
  85. hmp-commands.hx
  86. hmp.c
  87. hmp.h
  88. iohandler.c
  89. ioport.c
  90. kvm-all.c
  91. kvm-stub.c
  92. LICENSE
  93. main-loop.c
  94. MAINTAINERS
  95. Makefile
  96. Makefile.objs
  97. Makefile.target
  98. memory.c
  99. memory_mapping.c
  100. migration-exec.c
  101. migration-fd.c
  102. migration-rdma.c
  103. migration-tcp.c
  104. migration-unix.c
  105. migration.c
  106. monitor.c
  107. nbd.c
  108. os-posix.c
  109. os-win32.c
  110. page_cache.c
  111. qapi-schema.json
  112. qdev-monitor.c
  113. qdict-test-data.txt
  114. qemu-bridge-helper.c
  115. qemu-char.c
  116. qemu-coroutine-io.c
  117. qemu-coroutine-lock.c
  118. qemu-coroutine-sleep.c
  119. qemu-coroutine.c
  120. qemu-doc.texi
  121. qemu-img-cmds.hx
  122. qemu-img.c
  123. qemu-img.texi
  124. qemu-io-cmds.c
  125. qemu-io.c
  126. qemu-log.c
  127. qemu-nbd.c
  128. qemu-nbd.texi
  129. qemu-options-wrapper.h
  130. qemu-options.h
  131. qemu-options.hx
  132. qemu-seccomp.c
  133. qemu-tech.texi
  134. qemu-timer.c
  135. qemu.nsi
  136. qemu.sasl
  137. qmp-commands.hx
  138. qmp.c
  139. qtest.c
  140. readline.c
  141. README
  142. rules.mak
  143. savevm.c
  144. spice-qemu-char.c
  145. tcg-runtime.c
  146. tci.c
  147. thread-pool.c
  148. thunk.c
  149. tpm.c
  150. trace-events
  151. translate-all.c
  152. translate-all.h
  153. user-exec.c
  154. VERSION
  155. version.rc
  156. vl.c
  157. xbzrle.c
  158. xen-all.c
  159. xen-mapcache.c
  160. xen-stub.c