[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more r
From: |
Zhi Yong Wu |
Subject: |
Re: [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info |
Date: |
Fri, 25 May 2012 22:44:38 +0800 |
On Fri, May 25, 2012 at 10:40 PM, Jan Kiszka <address@hidden> wrote:
> On 2012-05-25 11:25, Zhi Yong Wu wrote:
>>>> diff --git a/net/hub.c b/net/hub.c
>>>> index 122de69..8c77d03 100644
>>>> --- a/net/hub.c
>>>> +++ b/net/hub.c
>>>> @@ -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, " \\ ");
>> 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
>> ^^^
>>>
>>> Two space too much of indention (you remove them above for the existing
>> It is three space, not two.
>>> 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.
> 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.
>
> Jan
>
> --
> Siemens AG, Corporate Technology, CT T DE IT 1
> Corporate Competence Center Embedded Linux
--
Regards,
Zhi Yong Wu