From: Jan Kiszka <jan.kiszka@siemens.com>
To: Zhi Yong Wu <zwu.kernel@gmail.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"stefanha@linux.vnet.ibm.com" <stefanha@linux.vnet.ibm.com>,
"wuzhy@linux.vnet.ibm.com" <wuzhy@linux.vnet.ibm.com>
Subject: Re: [PATCH v4 13/16] net: Make "info network" output more readable info
Date: Fri, 25 May 2012 11:40:05 -0300 [thread overview]
Message-ID: <4FBF99C5.1060505@siemens.com> (raw)
In-Reply-To: <CAEH94LjD8LzeUBHSBotUDsYWtEBC6q8_hiotndRrJ-=TNEUxPw@mail.gmail.com>
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
should be exactly one space, like for the non-hub peers. You should see
it better than I when running the code.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Zhi Yong Wu <zwu.kernel@gmail.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"wuzhy@linux.vnet.ibm.com" <wuzhy@linux.vnet.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"stefanha@linux.vnet.ibm.com" <stefanha@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info
Date: Fri, 25 May 2012 11:40:05 -0300 [thread overview]
Message-ID: <4FBF99C5.1060505@siemens.com> (raw)
In-Reply-To: <CAEH94LjD8LzeUBHSBotUDsYWtEBC6q8_hiotndRrJ-=TNEUxPw@mail.gmail.com>
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
should be exactly one space, like for the non-hub peers. You should see
it better than I when running the code.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-05-25 14:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 14:02 [PATCH v4 13/16] net: Make "info network" output more readable info zwu.kernel
2012-05-25 14:02 ` [Qemu-devel] " zwu.kernel
2012-05-25 14:17 ` Jan Kiszka
2012-05-25 14:17 ` [Qemu-devel] " Jan Kiszka
2012-05-25 14:25 ` Zhi Yong Wu
2012-05-25 14:25 ` [Qemu-devel] " Zhi Yong Wu
2012-05-25 14:40 ` Jan Kiszka [this message]
2012-05-25 14:40 ` Jan Kiszka
2012-05-25 14:44 ` Zhi Yong Wu
2012-05-25 14:44 ` [Qemu-devel] " Zhi Yong Wu
2012-05-25 14:50 ` Jan Kiszka
2012-05-25 14:50 ` [Qemu-devel] " Jan Kiszka
2012-05-25 14:56 ` Zhi Yong Wu
2012-05-25 14:56 ` [Qemu-devel] " Zhi Yong Wu
-- strict thread matches above, loose matches on Subject: below --
2012-05-25 14:11 zwu.kernel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FBF99C5.1060505@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=wuzhy@linux.vnet.ibm.com \
--cc=zwu.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.