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:50:50 -0300 [thread overview]
Message-ID: <4FBF9C4A.7010407@siemens.com> (raw)
In-Reply-To: <CAEH94LjuUU0knF2nryoTJgSE4dyQmFB9qzad_dPTNwZ7+aY49Q@mail.gmail.com>
On 2012-05-25 11:44, Zhi Yong Wu wrote:
> On Fri, May 25, 2012 at 10:40 PM, Jan Kiszka <jan.kiszka@siemens.com> 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.
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
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-05-25 14:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 14:02 [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info zwu.kernel
2012-05-25 14:17 ` Jan Kiszka
2012-05-25 14:25 ` Zhi Yong Wu
2012-05-25 14:40 ` Jan Kiszka
2012-05-25 14:44 ` Zhi Yong Wu
2012-05-25 14:50 ` Jan Kiszka [this message]
2012-05-25 14:56 ` Zhi Yong Wu
-- strict thread matches above, loose matches on Subject: below --
2012-05-25 14:11 zwu.kernel
2012-06-04 5:29 [Qemu-devel] [PATCH v4 00/16] hub-based networking patches zwu.kernel
2012-06-04 5:29 ` [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info 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=4FBF9C4A.7010407@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).