net: Make "info network" output more readable info
Subsystems (2)
PATCH v4 13/16 net: Make "info network" output more readable info
From: Zhi Yong Wu <[email protected]>
--- net.c | 18 ++++++++++++++---- net.h | 12 ++++++++++++ net/hub.c | 23 +++++++++++++++++++++-- net/hub.h | 1 + 4 files changed, 48 insertions(+), 6 deletions(-)
net.c +14 -4
@@ -887,6 +887,12 @@ static const struct { }, }, #endif /* CONFIG_NET_BRIDGE */ + [NET_CLIENT_TYPE_HUB] = { + .type = "hubport", + .desc = { + {/* end of list */ } + }, + }, };int net_client_init (Monitor *mon,QemuOpts *opts,int is_netdev)
@@ -1068,7 +1074,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)return 0 ; } -static void print_net_client (Monitor *mon,NetClientState *vc) +void print_net_client (Monitor *mon,NetClientState *vc) {monitor_printf (mon,"%s: type=%s,%s\n" , vc->name, net_client_types[vc->info->type].type, vc->info_str);
@@ -1079,12 +1085,17 @@ void do_info_network(Monitor *mon)NetClientState *nc, *peer;net_client_type type; -monitor_printf (mon,"Devices not on any VLAN:\n" ); +net_hub_info (mon); + QTAILQ_FOREACH(nc, &net_clients, next) { peer = nc->peer; type = nc->info->type; + +if (net_hub_port_peer_nc (nc)) { +continue ; + } +if (!peer || type ==NET_CLIENT_TYPE_NIC ) { -monitor_printf (mon," " );print_net_client (mon, nc); }/* else it's a netdev connected to a NIC, printed with the NIC */ if (peer && type ==NET_CLIENT_TYPE_NIC ) {
@@ -1092,7 +1103,6 @@ void do_info_network(Monitor *mon)print_net_client (mon, peer); } } -net_hub_info (mon); }void qmp_set_link (const char *name,bool up,Error **errp)
net.h +12 -0
@@ -112,6 +112,18 @@ void qemu_check_nic_model(NICInfo *nd, const char *model);int qemu_find_nic_model (NICInfo *nd,const char *const *models,const char *default_model); +ssize_t qemu_deliver_packet (NetClientState *sender, +unsigned flags, +const uint8_t *data, +size_t size, +void *opaque); +ssize_t qemu_deliver_packet_iov (NetClientState *sender, +unsigned flags, +const struct iovec *iov, +int iovcnt, +void *opaque); + +void print_net_client (Monitor *mon,NetClientState *vc);void do_info_network (Monitor *mon);/* NIC info */
net/hub.c +21 -2
@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, }/** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ +NetHub *hub; +NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { +if (nc == port->nc.peer) { +return true; + } + } + } + +return false; +} + +/** * Print hub configuration */ void net_hub_info (Monitor *mon)
@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) {monitor_printf (mon,"hub %u\n" , hub->id); QLIST_FOREACH(port, &hub->ports, next) { -monitor_printf (mon," port %u peer %s\n" , port->id, - port->nc.peer ? port->nc.peer->name :"<none>" ); +monitor_printf (mon," \\ " ); +print_net_client (mon, port->nc.peer); } } }
net/hub.h +1 -0
@@ -23,5 +23,6 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id,void net_hub_info (Monitor *mon);int net_hub_id_for_client (NetClientState *nc,unsigned int *id);void net_hub_check_clients (void ); +bool net_hub_port_peer_nc (NetClientState *nc);#endif /* NET_HUB_H */
Signature · 1 line
1.7.6
Quoted 3 lines · On 2012-05-25 11:02, [email protected] wrote:
From: Zhi Yong Wu <[email protected]>
Reviewed-by Jan Kiszka <[email protected]>
Please don't put reviewed-by tags here before the reviewer had a chance to look at the code.
Quoted 13 lines
Signed-off-by Zhi Yong Wu <[email protected]>--- net.c | 18 ++++++++++++++---- net.h | 12 ++++++++++++ net/hub.c | 23 +++++++++++++++++++++-- net/hub.h | 1 + 4 files changed, 48 insertions(+), 6 deletions(-)net.c +0
-0
net.c static const struct { · line 895
Quoted 9 lines
net.c +6
-0@@ -887,6 +887,12 @@ static const struct { }, }, #endif /* CONFIG_NET_BRIDGE */ + [NET_CLIENT_TYPE_HUB] = { + .type = "hubport", + .desc = { + {/* end of list */ } + }, + },
This should be obsolete now.
Quoted 33 lines
net.c +8
-3};int net_client_init (Monitor *mon,QemuOpts *opts,int is_netdev)@@ -1068,7 +1074,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)return 0 ; } -static void print_net_client (Monitor *mon,NetClientState *vc) +void print_net_client (Monitor *mon,NetClientState *vc) {monitor_printf (mon,"%s: type=%s,%s\n" , vc->name, net_client_types[vc->info->type].type, vc->info_str);@@ -1079,12 +1085,17 @@ void do_info_network(Monitor *mon)NetClientState *nc, *peer;net_client_type type; -monitor_printf (mon,"Devices not on any VLAN:\n" ); +net_hub_info (mon); + QTAILQ_FOREACH(nc, &net_clients, next) { peer = nc->peer; type = nc->info->type; + +if (net_hub_port_peer_nc (nc)) { +continue ; + } +if (!peer || type ==NET_CLIENT_TYPE_NIC ) { -monitor_printf (mon," " );print_net_client (mon, nc); }/* else it's a netdev connected to a NIC, printed with the NIC */ if (peer && type ==NET_CLIENT_TYPE_NIC ) {
net.c void do_info_network(Monitor *mon) · line 1095
Quoted 4 lines
net.c +0
-1@@ -1092,7 +1103,6 @@ void do_info_network(Monitor *mon)print_net_client (mon, peer); } } -net_hub_info (mon);
Why introduce a different hub output format at all? Do it in the final right from the start.
Quoted 12 lines
net.c +0
-0}void qmp_set_link (const char *name,bool up,Error **errp)net.h +1
-0@@ -112,6 +112,18 @@ void qemu_check_nic_model(NICInfo *nd, const char *model);int qemu_find_nic_model (NICInfo *nd,const char *const *models,const char *default_model); +ssize_t qemu_deliver_packet(NetClientState *sender,
net.h void qemu_check_nic_model(NICInfo *nd, const char *model); · line 125
Quoted 10 lines
net.h +10
-0+unsigned flags, + const uint8_t *data, + size_t size, + void *opaque); +ssize_t qemu_deliver_packet_iov (NetClientState *sender, +unsigned flags, +const struct iovec *iov, +int iovcnt, +void *opaque); +
I bet those two prototypes are required by some other patch (or are even redundant).
Quoted 35 lines
net.h +1
-0+void print_net_client (Monitor *mon,NetClientState *vc);void do_info_network (Monitor *mon);/* NIC info */ net/hub.c +19
-0@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, }/** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ +NetHub *hub; +NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { +if (nc == port->nc.peer) { +return true; + } + } + } + +return false; +} + +/** * Print hub configuration */ void net_hub_info (Monitor *mon)
net/hub.c void net_hub_info(Monitor *mon) · line 216
Quoted 6 lines
net/hub.c +1
-2@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) {monitor_printf (mon,"hub %u\n" , hub->id); QLIST_FOREACH(port, &hub->ports, next) { -monitor_printf (mon," port %u peer %s\n" , port->id, - port->nc.peer ? port->nc.peer->name :"<none>" ); +monitor_printf (mon," \\ " );
Two space too much of indention (you remove them above for the existing peer \ peer outputs).
Quoted 9 lines
net/hub.c +1
-0+print_net_client (mon, port->nc.peer); } } }net/hub.h +0
-0
net/hub.h NetClientState *net_hub_find_client_by_name(unsigned int hub_id, · line 28
Quoted 6 lines
net/hub.h +1
-0@@ -23,5 +23,6 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id,void net_hub_info (Monitor *mon);int net_hub_id_for_client (NetClientState *nc,unsigned int *id);void net_hub_check_clients (void ); +bool net_hub_port_peer_nc (NetClientState *nc);#endif /* NET_HUB_H */
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 85 lines · Jan Kiszka
Quoted 3 lines · On 2012-05-25 11:02, [email protected] wrote:
From: Zhi Yong Wu <[email protected]>
Reviewed-by Jan Kiszka <[email protected]>Please don't put reviewed-by tags here before the reviewer had a chance to look at the code.
Quoted 13 lines
Signed-off-by Zhi Yong Wu <[email protected]>---
net.c | 18 ++++++++++++++----
net.h | 12 ++++++++++++
net/hub.c | 23 +++++++++++++++++++++--
net/hub.h | 1 +4 files changed, 48 insertions(+), 6 deletions(-)net.c +0
-0net.c static const struct { · line 895
Quoted 9 lines
net.c +6
-0@@ -887,6 +887,12 @@ static const struct { }, }, #endif /* CONFIG_NET_BRIDGE */ + [NET_CLIENT_TYPE_HUB] = { + .type = "hubport", + .desc = { + { /* end of list */ } + }, + },This should be obsolete now.
Quoted 33 lines
net.c +8
-3}; int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)@@ -1068,7 +1074,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data) return 0; } -static void print_net_client (Monitor *mon,NetClientState *vc) +void print_net_client (Monitor *mon,NetClientState *vc) { monitor_printf(mon, "%s: type=%s,%s\n", vc->name, net_client_types[vc->info->type].type, vc->info_str);@@ -1079,12 +1085,17 @@ void do_info_network(Monitor *mon) NetClientState *nc, *peer; net_client_type type; - monitor_printf(mon, "Devices not on any VLAN:\n"); + net_hub_info(mon); + QTAILQ_FOREACH(nc, &net_clients, next) { peer = nc->peer; type = nc->info->type; + + if (net_hub_port_peer_nc(nc)) { + continue; + } + if (!peer || type == NET_CLIENT_TYPE_NIC) { - monitor_printf(mon, " "); print_net_client(mon, nc); } /* else it's a netdev connected to a NIC, printed with the NIC */ if (peer && type == NET_CLIENT_TYPE_NIC) {net.c void do_info_network(Monitor *mon) · line 1095
Quoted 4 lines
net.c +0
-1@@ -1092,7 +1103,6 @@ void do_info_network(Monitor *mon) print_net_client(mon, peer); } } - net_hub_info(mon);Why introduce a different hub output format at all? Do it in the final right from the start.
Quoted 11 lines
net.c +0
-0} void qmp_set_link(const char *name, bool up, Error **errp)net.h +0
-0@@ -112,6 +112,18 @@ void qemu_check_nic_model(NICInfo *nd, const char *model); int qemu_find_nic_model(NICInfo *nd, const char * const *models, const char *default_model);
Quoted 14 lines
net.h void qemu_check_nic_model(NICInfo *nd, const char *model); · line 125
Quoted 11 lines
net.h +11
-0+ssize_t qemu_deliver_packet (NetClientState *sender, + unsigned flags, + const uint8_t *data, + size_t size, + void *opaque); +ssize_t qemu_deliver_packet_iov (NetClientState *sender, + unsigned flags, + const struct iovec *iov, + int iovcnt, + void *opaque); +I bet those two prototypes are required by some other patch (or are even redundant).
I have noticed this, and split out them to other patch.
Quoted 34 lines
Quoted 34 lines
net.h +1
-0+void print_net_client (Monitor *mon,NetClientState *vc); void do_info_network(Monitor *mon); /* NIC info */net/hub.c +19
-0@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, } /** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ + NetHub *hub; + NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { + if (nc == port->nc.peer) { + return true; + } + } + } + + return false; +} + +/** * Print hub configuration */
Quoted 8 lines
net/hub.c void net_hub_info(Monitor *mon) · line 216
Quoted 8 lines
net/hub.c +1
-2void net_hub_info(Monitor *mon)@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) { monitor_printf(mon, "hub %u\n", hub->id); QLIST_FOREACH(port, &hub->ports, next) { - monitor_printf(mon, " port %u peer %s\n", port->id, - port->nc.peer ? port->nc.peer->name : "<none>"); + monitor_printf(mon, " \\ ");
This will have the following layout:
(qemu) info network
hub 1
\ dump.0: type=dump,dump to qemu-vlan1.pcap (len=65536)
\ user.1: type=user,net=10.0.2.0,restrict=off
\ virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:58
hub 0
\ user.0: type=user,net=10.0.2.0,restrict=off
\ e1000.0: type=nic,model=e1000,macaddr=52:54:00:12:34:57
virtio-net-pci.1: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
\ ur: type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
^^^
Quoted 2 lines
Two space too much of indention (you remove them above for the existing
It is three space, not two.
Quoted 1 line
peer \ peer outputs).
Do you mean that it should be like "monitor_printf(mon, "\\ ");" but this indention will not match with those peers in hub case.
Quoted 22 lines
Quoted 10 lines
net/hub.c +1
-0+ print_net_client(mon, port->nc.peer); } } }net/hub.h +0
-0net/hub.h NetClientState *net_hub_find_client_by_name(unsigned int hub_id, · line 28
Quoted 6 lines
net/hub.h +1
-0@@ -23,5 +23,6 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, void net_hub_info(Monitor *mon); int net_hub_id_for_client(NetClientState *nc, unsigned int *id); void net_hub_check_clients(void); +bool net_hub_port_peer_nc (NetClientState *nc); #endif /* NET_HUB_H */Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
Signature · 3 lines
Regards, Zhi Yong Wu
Quoted 50 lines · Zhi Yong Wu
Quoted 29 lines
Quoted 29 lines
net/hub.c +19
-0@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, }/** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ +NetHub *hub; +NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { +if (nc == port->nc.peer) { +return true; + } + } + } + +return false; +} + +/** * Print hub configuration */ Quoted 8 lines
net/hub.c void net_hub_info(Monitor *mon) · line 216
Quoted 8 lines
net/hub.c +1
-2void net_hub_info (Monitor *mon)@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) {monitor_printf (mon,"hub %u\n" , hub->id); QLIST_FOREACH(port, &hub->ports, next) { -monitor_printf (mon," port %u peer %s\n" , port->id, - port->nc.peer ? port->nc.peer->name :"<none>" ); +monitor_printf (mon," \\ " );This will have the following layout:
(qemu) info network
hub 1
\ dump.0: type=dump,dump to qemu-vlan1.pcap (len=65536)
\ user.1: type=user,net=10.0.2.0,restrict=off
\ virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:58
hub 0
\ user.0: type=user,net=10.0.2.0,restrict=off
\ e1000.0: type=nic,model=e1000,macaddr=52:54:00:12:34:57
virtio-net-pci.1: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
\ ur: type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
^^^Quoted 1 line
Quoted 5 lines
Quoted 1 line
Two space too much of indention (you remove them above for the existing
It is three space, not two.
Quoted 1 line
peer \ peer outputs).
Do you mean that it should be like "
monitor_printf(mon, "\\ ");" but this indention will not match with those peers in hub case.
This line is for printing peers attached to a hub, isn't it? So it should be exactly one space, like for the non-hub peers. You should see it better than I when running the code.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 51 lines · Jan Kiszka
Quoted 50 lines · Zhi Yong Wu
Quoted 29 lines
Quoted 29 lines
net/hub.c +19
-0@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, } /** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ + NetHub *hub; + NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { + if (nc == port->nc.peer) { + return true; + } + } + } + + return false; +} + +/** * Print hub configuration */ Quoted 8 lines
net/hub.c void net_hub_info(Monitor *mon) · line 216
Quoted 8 lines
net/hub.c +1
-2void net_hub_info(Monitor *mon)@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) { monitor_printf(mon, "hub %u\n", hub->id); QLIST_FOREACH(port, &hub->ports, next) { - monitor_printf(mon, " port %u peer %s\n", port->id, - port->nc.peer ? port->nc.peer->name : "<none>"); + monitor_printf(mon, " \\ ");This will have the following layout:
(qemu) info network
hub 1
\ dump.0: type=dump,dump to qemu-vlan1.pcap (len=65536)
\ user.1: type=user,net=10.0.2.0,restrict=off
\ virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:58 hub 0
\ user.0: type=user,net=10.0.2.0,restrict=off
\ e1000.0: type=nic,model=e1000,macaddr=52:54:00:12:34:57 virtio-net-pci.1: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 \ ur: type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown ^^^Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Two space too much of indention (you remove them above for the existing
It is three space, not two.
Quoted 1 line
peer \ peer outputs).
Do you mean that it should be like "
monitor_printf(mon, "\\ ");" but this indention will not match with those peers in hub case.This line is for printing peers attached to a hub, isn't it? So it
Yeah, but it is three spaces, not one. You can check the code in do_info_network. For non-hub peers, it is also three spaces.
Quoted 2 lines
should be exactly one space, like for the non-hub peers. You should see it better than I when running the code.
That is the result i got when i was running the code.
Quoted 6 lines
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
Signature · 3 lines
Regards, Zhi Yong Wu
Quoted 53 lines · Zhi Yong Wu
Quoted 52 lines · Jan Kiszka
Quoted 51 lines · Zhi Yong Wu
Quoted 29 lines
Quoted 29 lines
net/hub.c +19
-0@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, }/** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ +NetHub *hub; +NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { +if (nc == port->nc.peer) { +return true; + } + } + } + +return false; +} + +/** * Print hub configuration */ Quoted 8 lines
net/hub.c void net_hub_info(Monitor *mon) · line 216
Quoted 8 lines
net/hub.c +1
-2void net_hub_info (Monitor *mon)@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) {monitor_printf (mon,"hub %u\n" , hub->id); QLIST_FOREACH(port, &hub->ports, next) { -monitor_printf (mon," port %u peer %s\n" , port->id, - port->nc.peer ? port->nc.peer->name :"<none>" ); +monitor_printf (mon," \\ " );This will have the following layout:
(qemu) info network
hub 1
\ dump.0: type=dump,dump to qemu-vlan1.pcap (len=65536)
\ user.1: type=user,net=10.0.2.0,restrict=off
\ virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:58
hub 0
\ user.0: type=user,net=10.0.2.0,restrict=off
\ e1000.0: type=nic,model=e1000,macaddr=52:54:00:12:34:57
virtio-net-pci.1: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56
\ ur: type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown
^^^Quoted 2 lines
Two space too much of indention (you remove them above for the existing
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
It is three space, not two.
Quoted 1 line
peer \ peer outputs).
Do you mean that it should be like "
monitor_printf(mon, "\\ ");" but this indention will not match with those peers in hub case.This line is for printing peers attached to a hub, isn't it? So it
Yeah, but it is three spaces, not one. You can check the code in
do_info_network. For non-hub peers, it is also three spaces.
Then non-hub needs adjustment to a single space as well. Just remove the two spaces I added to indent the categories (VLAN vs. non-VLAN listing) for _both_ peer lines.
(I love nit-picking discussions :) )
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 59 lines · Jan Kiszka
Quoted 58 lines · Zhi Yong Wu
Quoted 57 lines · Jan Kiszka
Quoted 55 lines · Zhi Yong Wu
Quoted 29 lines
Quoted 29 lines
net/hub.c +19
-0@@ -184,6 +184,25 @@ NetClientState *net_hub_find_client_by_name(unsigned int hub_id, } /** +* Determine if one nc peers with one hub port +*/ +bool net_hub_port_peer_nc (NetClientState *nc) +{ + NetHub *hub; + NetHubPort *port; + + QLIST_FOREACH(hub, &hubs, next) { + QLIST_FOREACH(port, &hub->ports, next) { + if (nc == port->nc.peer) { + return true; + } + } + } + + return false; +} + +/** * Print hub configuration */ Quoted 8 lines
net/hub.c void net_hub_info(Monitor *mon) · line 216
Quoted 8 lines
net/hub.c +1
-2void net_hub_info(Monitor *mon)@@ -194,8 +213,8 @@ void net_hub_info(Monitor *mon) QLIST_FOREACH(hub, &hubs, next) { monitor_printf(mon, "hub %u\n", hub->id); QLIST_FOREACH(port, &hub->ports, next) { - monitor_printf(mon, " port %u peer %s\n", port->id, - port->nc.peer ? port->nc.peer->name : "<none>"); + monitor_printf(mon, " \\ ");This will have the following layout:
(qemu) info network
hub 1
\ dump.0: type=dump,dump to qemu-vlan1.pcap (len=65536)
\ user.1: type=user,net=10.0.2.0,restrict=off
\ virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:58 hub 0
\ user.0: type=user,net=10.0.2.0,restrict=off
\ e1000.0: type=nic,model=e1000,macaddr=52:54:00:12:34:57 virtio-net-pci.1: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 \ ur: type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown ^^^Quoted 2 lines
Two space too much of indention (you remove them above for the existing
It is three space, not two.
Quoted 1 line
peer \ peer outputs).
Do you mean that it should be like "
monitor_printf(mon, "\\ ");" but this indention will not match with those peers in hub case.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
This line is for printing peers attached to a hub, isn't it? So it
Yeah, but it is three spaces, not one. You can check the code in
do_info_network. For non-hub peers, it is also three spaces.Then non-hub needs adjustment to a single space as well. Just remove the two spaces I added to indent the categories (VLAN vs. non-VLAN listing)
OK, done
Quoted 3 lines
for _both_ peer lines.
(I love nit-picking discussions :) )
No matter. :)
Quoted 6 lines
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
Signature · 3 lines
Regards, Zhi Yong Wu