mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
net: purge the monitor object from all init functions
The only backend that really uses it is the socket one, which calls monitor_get_fd(). But it can use 'cur_mon' instead. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-By: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
60d5666f7d
commit
42dcc547e1
15 changed files with 27 additions and 43 deletions
18
net.c
18
net.c
|
|
@ -745,10 +745,7 @@ int net_handle_fd_param(Monitor *mon, const char *param)
|
|||
return fd;
|
||||
}
|
||||
|
||||
static int net_init_nic(QemuOpts *opts,
|
||||
Monitor *mon,
|
||||
const char *name,
|
||||
VLANState *vlan)
|
||||
static int net_init_nic(QemuOpts *opts, const char *name, VLANState *vlan)
|
||||
{
|
||||
int idx;
|
||||
NICInfo *nd;
|
||||
|
|
@ -821,7 +818,6 @@ static int net_init_nic(QemuOpts *opts,
|
|||
}
|
||||
|
||||
typedef int (*net_client_init_func)(QemuOpts *opts,
|
||||
Monitor *mon,
|
||||
const char *name,
|
||||
VLANState *vlan);
|
||||
|
||||
|
|
@ -1085,7 +1081,7 @@ static const struct {
|
|||
#endif /* CONFIG_NET_BRIDGE */
|
||||
};
|
||||
|
||||
int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
|
||||
int net_client_init(QemuOpts *opts, int is_netdev)
|
||||
{
|
||||
const char *name;
|
||||
const char *type;
|
||||
|
|
@ -1156,7 +1152,7 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
|
|||
|
||||
ret = 0;
|
||||
if (net_client_types[i].init) {
|
||||
ret = net_client_types[i].init(opts, mon, name, vlan);
|
||||
ret = net_client_types[i].init(opts, name, vlan);
|
||||
if (ret < 0) {
|
||||
/* TODO push error reporting into init() methods */
|
||||
qerror_report(QERR_DEVICE_INIT_FAILED, type);
|
||||
|
|
@ -1213,7 +1209,7 @@ void net_host_device_add(Monitor *mon, const QDict *qdict)
|
|||
|
||||
qemu_opt_set(opts, "type", device);
|
||||
|
||||
if (net_client_init(mon, opts, 0) < 0) {
|
||||
if (net_client_init(opts, 0) < 0) {
|
||||
monitor_printf(mon, "adding host network device %s failed\n", device);
|
||||
}
|
||||
}
|
||||
|
|
@ -1248,7 +1244,7 @@ int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
res = net_client_init(mon, opts, 1);
|
||||
res = net_client_init(opts, 1);
|
||||
if (res < 0) {
|
||||
qemu_opts_del(opts);
|
||||
}
|
||||
|
|
@ -1431,14 +1427,14 @@ void net_check_clients(void)
|
|||
|
||||
static int net_init_client(QemuOpts *opts, void *dummy)
|
||||
{
|
||||
if (net_client_init(NULL, opts, 0) < 0)
|
||||
if (net_client_init(opts, 0) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int net_init_netdev(QemuOpts *opts, void *dummy)
|
||||
{
|
||||
return net_client_init(NULL, opts, 1);
|
||||
return net_client_init(opts, 1);
|
||||
}
|
||||
|
||||
int net_init_clients(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue