qemu-e2k/softmmu
Laurent Vivier f3eedcddba qapi: net: introduce a way to bypass qemu_opts_parse_noisily()
As qemu_opts_parse_noisily() flattens the QAPI structures ("type" field
of Netdev structure can collides with "type" field of SocketAddress),
we introduce a way to bypass qemu_opts_parse_noisily() and use directly
visit_type_Netdev() to parse the backend parameters.

More details from Markus:

qemu_init() passes the argument of -netdev, -nic, and -net to
net_client_parse().

net_client_parse() parses with qemu_opts_parse_noisily(), passing
QemuOptsList qemu_netdev_opts for -netdev, qemu_nic_opts for -nic, and
qemu_net_opts for -net.  Their desc[] are all empty, which means any
keys are accepted.  The result of the parse (a QemuOpts) is stored in
the QemuOptsList.

Note that QemuOpts is flat by design.  In some places, we layer non-flat
on top using dotted keys convention, but not here.

net_init_clients() iterates over the stored QemuOpts, and passes them to
net_init_netdev(), net_param_nic(), or net_init_client(), respectively.

These functions pass the QemuOpts to net_client_init().  They also do
other things with the QemuOpts, which we can ignore here.

net_client_init() uses the opts visitor to convert the (flat) QemOpts to
a (non-flat) QAPI object Netdev.  Netdev is also the argument of QMP
command netdev_add.

The opts visitor was an early attempt to support QAPI in
(QemuOpts-based) CLI.  It restricts QAPI types to a certain shape; see
commit eb7ee2cbeb "qapi: introduce OptsVisitor".

A more modern way to support QAPI is qobject_input_visitor_new_str().
It uses keyval_parse() instead of QemuOpts for KEY=VALUE,... syntax, and
it also supports JSON syntax.  The former isn't quite as expressive as
JSON, but it's a lot closer than QemuOpts + opts visitor.

This commit paves the way to use of the modern way instead.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2022-10-28 13:28:52 +08:00
..
arch_init.c softmmu: Add qemu_init_arch_modules() 2022-03-06 13:15:42 +01:00
balloon.c qapi: Restrict balloon-related commands to machine code 2020-09-29 15:41:35 +02:00
bootdevice.c machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
cpu-throttle.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
cpu-timers.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
cpus.c gdbstub: move breakpoint logic to accel ops 2022-10-06 11:53:41 +01:00
datadir.c meson: Prefix each element of firmware path 2022-07-13 16:58:57 +02:00
device_tree.c qmp/hmp, device_tree.c: introduce dumpdtb 2022-10-17 16:15:10 -03:00
dirtylimit.c Use g_new() & friends where that makes obvious sense 2022-10-04 00:10:11 +02:00
dma-helpers.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
globals.c ui: Switch "-display sdl" to use the QAPI parser 2022-06-03 08:03:28 +02:00
icount.c replay: rewrite async event handling 2022-06-06 09:26:53 +02:00
ioport.c softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
main.c ui/cocoa: Run qemu_init in the main thread 2022-09-23 14:36:33 +02:00
memory.c Replace TARGET_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
memory_mapping.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
meson.build softmmu/dirtylimit: Implement vCPU dirtyrate calculation periodically 2022-07-20 12:15:08 +01:00
physmem.c accel/tcg: Move qemu_ram_addr_from_host_nofail to physmem.c 2022-09-06 08:04:26 +01:00
qdev-monitor.c qdev: unplug blocker for devices 2022-06-15 14:50:41 +01:00
qemu-seccomp.c seccomp: block setns, unshare and execveat syscalls 2022-02-16 18:52:40 +00:00
qtest.c Replace TARGET_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
rtc.c rtc: Move RTC function prototypes to their own header 2022-01-28 14:29:46 +00:00
runstate-action.c runstate: cleanup reboot and panic actions 2021-01-21 13:00:41 +01:00
runstate.c qapi: Add exit-failure PanicAction 2022-07-29 09:48:01 +01:00
timers-state.h qemu/atomic: Add aligned_{int64,uint64}_t types 2021-07-21 07:45:38 -10:00
tpm.c qapi: More complex uses of QAPI_LIST_APPEND 2021-01-28 08:08:45 +01:00
trace-events softmmu/dirtylimit: Implement virtual CPU throttle 2022-07-20 12:15:08 +01:00
trace.h softmmu: Add missing trace-events file 2020-09-09 17:15:18 +01:00
vl.c qapi: net: introduce a way to bypass qemu_opts_parse_noisily() 2022-10-28 13:28:52 +08:00