aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-01-24 13:19:30 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-02-04 07:56:54 +0100
commitae71d13d4e606cc89f361ce813e85fb6f6e92096 (patch)
tree238e2e8c4932b46915dc2f21087be8508d681185 /net
parent2030ca36bf1af79c68a4955ff3bf240ec561ec72 (diff)
downloadqemu-ae71d13d4e606cc89f361ce813e85fb6f6e92096.zip
qemu-ae71d13d4e606cc89f361ce813e85fb6f6e92096.tar.gz
qemu-ae71d13d4e606cc89f361ce813e85fb6f6e92096.tar.bz2
net: Move hmp_info_network() to net-hmp-cmds.c
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230124121946.1139465-17-armbru@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/net-hmp-cmds.c28
-rw-r--r--net/net.c28
2 files changed, 29 insertions, 27 deletions
diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c
index d7427ea..41d326b 100644
--- a/net/net-hmp-cmds.c
+++ b/net/net-hmp-cmds.c
@@ -16,7 +16,9 @@
#include "qemu/osdep.h"
#include "migration/misc.h"
#include "monitor/hmp.h"
+#include "monitor/monitor.h"
#include "net/net.h"
+#include "net/hub.h"
#include "qapi/clone-visitor.h"
#include "qapi/qapi-commands-net.h"
#include "qapi/qapi-visit-net.h"
@@ -25,6 +27,32 @@
#include "qemu/help_option.h"
#include "qemu/option.h"
+void hmp_info_network(Monitor *mon, const QDict *qdict)
+{
+ NetClientState *nc, *peer;
+ NetClientDriver type;
+
+ net_hub_info(mon);
+
+ QTAILQ_FOREACH(nc, &net_clients, next) {
+ peer = nc->peer;
+ type = nc->info->type;
+
+ /* Skip if already printed in hub info */
+ if (net_hub_id_for_client(nc, NULL) == 0) {
+ continue;
+ }
+
+ if (!peer || type == NET_CLIENT_DRIVER_NIC) {
+ print_net_client(mon, nc);
+ } /* else it's a netdev connected to a NIC, printed with the NIC */
+ if (peer && type == NET_CLIENT_DRIVER_NIC) {
+ monitor_printf(mon, " \\ ");
+ print_net_client(mon, peer);
+ }
+ }
+}
+
void hmp_set_link(Monitor *mon, const QDict *qdict)
{
const char *name = qdict_get_str(qdict, "name");
diff --git a/net/net.c b/net/net.c
index 2d01472..251fc5a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -63,7 +63,7 @@
#endif
static VMChangeStateEntry *net_change_state_entry;
-static QTAILQ_HEAD(, NetClientState) net_clients;
+NetClientStateList net_clients;
typedef struct NetdevQueueEntry {
Netdev *nd;
@@ -1345,32 +1345,6 @@ RxFilterInfoList *qmp_query_rx_filter(const char *name, Error **errp)
return filter_list;
}
-void hmp_info_network(Monitor *mon, const QDict *qdict)
-{
- NetClientState *nc, *peer;
- NetClientDriver type;
-
- net_hub_info(mon);
-
- QTAILQ_FOREACH(nc, &net_clients, next) {
- peer = nc->peer;
- type = nc->info->type;
-
- /* Skip if already printed in hub info */
- if (net_hub_id_for_client(nc, NULL) == 0) {
- continue;
- }
-
- if (!peer || type == NET_CLIENT_DRIVER_NIC) {
- print_net_client(mon, nc);
- } /* else it's a netdev connected to a NIC, printed with the NIC */
- if (peer && type == NET_CLIENT_DRIVER_NIC) {
- monitor_printf(mon, " \\ ");
- print_net_client(mon, peer);
- }
- }
-}
-
void colo_notify_filters_event(int event, Error **errp)
{
NetClientState *nc;