mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
QemuOpts: make most qemu_*_opts static
Switch tree to lookup-by-name using qemu_find_opts(). Also hook up virtfs options so qemu_find_opts works for them too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
dfe795e71f
commit
3329f07b7a
13 changed files with 59 additions and 66 deletions
16
net.c
16
net.c
|
@ -1168,7 +1168,7 @@ void net_host_device_add(Monitor *mon, const QDict *qdict)
|
|||
return;
|
||||
}
|
||||
|
||||
opts = qemu_opts_parse(&qemu_net_opts, opts_str ? opts_str : "", 0);
|
||||
opts = qemu_opts_parse(qemu_find_opts("net"), opts_str ? opts_str : "", 0);
|
||||
if (!opts) {
|
||||
return;
|
||||
}
|
||||
|
@ -1202,7 +1202,7 @@ int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||
QemuOpts *opts;
|
||||
int res;
|
||||
|
||||
opts = qemu_opts_from_qdict(&qemu_netdev_opts, qdict);
|
||||
opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict);
|
||||
if (!opts) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1226,7 +1226,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||
return -1;
|
||||
}
|
||||
qemu_del_vlan_client(vc);
|
||||
qemu_opts_del(qemu_opts_find(&qemu_netdev_opts, id));
|
||||
qemu_opts_del(qemu_opts_find(qemu_find_opts("netdev"), id));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1349,21 +1349,23 @@ static int net_init_netdev(QemuOpts *opts, void *dummy)
|
|||
|
||||
int net_init_clients(void)
|
||||
{
|
||||
QemuOptsList *net = qemu_find_opts("net");
|
||||
|
||||
if (default_net) {
|
||||
/* if no clients, we use a default config */
|
||||
qemu_opts_set(&qemu_net_opts, NULL, "type", "nic");
|
||||
qemu_opts_set(net, NULL, "type", "nic");
|
||||
#ifdef CONFIG_SLIRP
|
||||
qemu_opts_set(&qemu_net_opts, NULL, "type", "user");
|
||||
qemu_opts_set(net, NULL, "type", "user");
|
||||
#endif
|
||||
}
|
||||
|
||||
QTAILQ_INIT(&vlans);
|
||||
QTAILQ_INIT(&non_vlan_clients);
|
||||
|
||||
if (qemu_opts_foreach(&qemu_netdev_opts, net_init_netdev, NULL, 1) == -1)
|
||||
if (qemu_opts_foreach(qemu_find_opts("netdev"), net_init_netdev, NULL, 1) == -1)
|
||||
return -1;
|
||||
|
||||
if (qemu_opts_foreach(&qemu_net_opts, net_init_client, NULL, 1) == -1) {
|
||||
if (qemu_opts_foreach(net, net_init_client, NULL, 1) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue