From patchwork Tue Apr 17 19:36:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 153299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C9C0EB7016 for ; Wed, 18 Apr 2012 05:38:38 +1000 (EST) Received: from localhost ([::1]:38419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKEEW-0000qy-Nl for incoming@patchwork.ozlabs.org; Tue, 17 Apr 2012 15:38:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKECk-0005h7-JS for qemu-devel@nongnu.org; Tue, 17 Apr 2012 15:36:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKECh-0008Rj-Ie for qemu-devel@nongnu.org; Tue, 17 Apr 2012 15:36:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKECh-0008RF-A8 for qemu-devel@nongnu.org; Tue, 17 Apr 2012 15:36:43 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3HJaeP9030778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 17 Apr 2012 15:36:40 -0400 Received: from localhost (ovpn-113-173.phx2.redhat.com [10.3.113.173]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3HJadhb011196; Tue, 17 Apr 2012 15:36:39 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 17 Apr 2012 16:36:19 -0300 Message-Id: <1334691381-7666-17-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1334691381-7666-1-git-send-email-lcapitulino@redhat.com> References: <1334691381-7666-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 16/18] net: purge the monitor object from all init functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/pci-hotplug.c | 2 +- hw/usb/dev-network.c | 2 +- net.c | 18 +++++++----------- net.h | 2 +- net/dump.c | 2 +- net/dump.h | 3 +-- net/slirp.c | 5 +---- net/slirp.h | 5 +---- net/socket.c | 8 +++----- net/socket.h | 3 +-- net/tap-win32.c | 2 +- net/tap.c | 9 ++++----- net/tap.h | 5 ++--- net/vde.c | 2 +- 14 files changed, 26 insertions(+), 42 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index c55d8b9..785eb3d 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -60,7 +60,7 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, qemu_opt_set(opts, "type", "nic"); - ret = net_client_init(mon, opts, 0); + ret = net_client_init(opts, 0); if (ret < 0) return NULL; if (nd_table[ret].devaddr) { diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index cff55f2..6b89e66 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1366,7 +1366,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) qemu_opt_set(opts, "type", "nic"); qemu_opt_set(opts, "model", "usb"); - idx = net_client_init(NULL, opts, 0); + idx = net_client_init(opts, 0); if (idx == -1) { return NULL; } diff --git a/net.c b/net.c index f5d9cc7..8e9ca16 100644 --- a/net.c +++ b/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); } } @@ -1245,7 +1241,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); } @@ -1428,14 +1424,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) diff --git a/net.h b/net.h index 64993b4..9d1ed93 100644 --- a/net.h +++ b/net.h @@ -163,7 +163,7 @@ struct HCIInfo *qemu_next_hci(void); extern const char *legacy_tftp_prefix; extern const char *legacy_bootp_filename; -int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev); +int net_client_init(QemuOpts *opts, int is_netdev); int net_client_parse(QemuOptsList *opts_list, const char *str); int net_init_clients(void); void net_check_clients(void); diff --git a/net/dump.c b/net/dump.c index 4b48d48..f835c51 100644 --- a/net/dump.c +++ b/net/dump.c @@ -144,7 +144,7 @@ static int net_dump_init(VLANState *vlan, const char *device, return 0; } -int net_init_dump(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) +int net_init_dump(QemuOpts *opts, const char *name, VLANState *vlan) { int len; const char *file; diff --git a/net/dump.h b/net/dump.h index fdc91ad..2b5d9ba 100644 --- a/net/dump.h +++ b/net/dump.h @@ -27,7 +27,6 @@ #include "net.h" #include "qemu-common.h" -int net_init_dump(QemuOpts *opts, Monitor *mon, - const char *name, VLANState *vlan); +int net_init_dump(QemuOpts *opts, const char *name, VLANState *vlan); #endif /* QEMU_NET_DUMP_H */ diff --git a/net/slirp.c b/net/slirp.c index 18e07ba..35ae1fe 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -675,10 +675,7 @@ static int net_init_slirp_configs(const char *name, const char *value, void *opa return 0; } -int net_init_slirp(QemuOpts *opts, - Monitor *mon, - const char *name, - VLANState *vlan) +int net_init_slirp(QemuOpts *opts, const char *name, VLANState *vlan) { struct slirp_config_str *config; const char *vhost; diff --git a/net/slirp.h b/net/slirp.h index c17de8e..53fe95d 100644 --- a/net/slirp.h +++ b/net/slirp.h @@ -30,10 +30,7 @@ #ifdef CONFIG_SLIRP -int net_init_slirp(QemuOpts *opts, - Monitor *mon, - const char *name, - VLANState *vlan); +int net_init_slirp(QemuOpts *opts, const char *name, VLANState *vlan); void net_slirp_hostfwd_add(Monitor *mon, const QDict *qdict); void net_slirp_hostfwd_remove(Monitor *mon, const QDict *qdict); diff --git a/net/socket.c b/net/socket.c index 0bcf229..fcd0a3c 100644 --- a/net/socket.c +++ b/net/socket.c @@ -26,6 +26,7 @@ #include "config-host.h" #include "net.h" +#include "monitor.h" #include "qemu-char.h" #include "qemu-common.h" #include "qemu-error.h" @@ -585,10 +586,7 @@ static int net_socket_udp_init(VLANState *vlan, return 0; } -int net_init_socket(QemuOpts *opts, - Monitor *mon, - const char *name, - VLANState *vlan) +int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan) { if (qemu_opt_get(opts, "fd")) { int fd; @@ -601,7 +599,7 @@ int net_init_socket(QemuOpts *opts, return -1; } - fd = net_handle_fd_param(mon, qemu_opt_get(opts, "fd")); + fd = net_handle_fd_param(cur_mon, qemu_opt_get(opts, "fd")); if (fd == -1) { return -1; } diff --git a/net/socket.h b/net/socket.h index ea46f02..e1fe959 100644 --- a/net/socket.h +++ b/net/socket.h @@ -27,7 +27,6 @@ #include "net.h" #include "qemu-common.h" -int net_init_socket(QemuOpts *opts, Monitor *mon, - const char *name, VLANState *vlan); +int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan); #endif /* QEMU_NET_SOCKET_H */ diff --git a/net/tap-win32.c b/net/tap-win32.c index 596132e..a801a55 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -699,7 +699,7 @@ static int tap_win32_init(VLANState *vlan, const char *model, return 0; } -int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) +int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan) { const char *ifname; diff --git a/net/tap.c b/net/tap.c index f240028..5ac4ba3 100644 --- a/net/tap.c +++ b/net/tap.c @@ -512,8 +512,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge) return -1; } -int net_init_bridge(QemuOpts *opts, Monitor *mon, const char *name, - VLANState *vlan) +int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan) { TAPState *s; int fd, vnet_hdr; @@ -583,7 +582,7 @@ static int net_tap_init(QemuOpts *opts, int *vnet_hdr) return fd; } -int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) +int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan) { TAPState *s; int fd, vnet_hdr = 0; @@ -600,7 +599,7 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan return -1; } - fd = net_handle_fd_param(mon, qemu_opt_get(opts, "fd")); + fd = net_handle_fd_param(cur_mon, qemu_opt_get(opts, "fd")); if (fd == -1) { return -1; } @@ -687,7 +686,7 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan int vhostfd, r; bool force = qemu_opt_get_bool(opts, "vhostforce", false); if (qemu_opt_get(opts, "vhostfd")) { - r = net_handle_fd_param(mon, qemu_opt_get(opts, "vhostfd")); + r = net_handle_fd_param(cur_mon, qemu_opt_get(opts, "vhostfd")); if (r == -1) { return -1; } diff --git a/net/tap.h b/net/tap.h index 56c591f..b2a9450 100644 --- a/net/tap.h +++ b/net/tap.h @@ -32,7 +32,7 @@ #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" -int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan); +int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan); int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required); @@ -57,7 +57,6 @@ int tap_get_fd(VLANClientState *vc); struct vhost_net; struct vhost_net *tap_get_vhost_net(VLANClientState *vc); -int net_init_bridge(QemuOpts *opts, Monitor *mon, const char *name, - VLANState *vlan); +int net_init_bridge(QemuOpts *opts, const char *name, VLANState *vlan); #endif /* QEMU_NET_TAP_H */ diff --git a/net/vde.c b/net/vde.c index ac48ab2..6b9d452 100644 --- a/net/vde.c +++ b/net/vde.c @@ -110,7 +110,7 @@ static int net_vde_init(VLANState *vlan, const char *model, return 0; } -int net_init_vde(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan) +int net_init_vde(QemuOpts *opts, const char *name, VLANState *vlan) { const char *sock; const char *group;