Received: from eggs.gnu.org ([2001:4830:134:3::10]:43443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrjwC-0001VS-Fi for qemu-devel@nongnu.org; Wed, 26 Jun 2013 03:14:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrjwB-0003Uw-HD for qemu-devel@nongnu.org; Wed, 26 Jun 2013 03:14:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrjwB-0003Ur-8k for qemu-devel@nongnu.org; Wed, 26 Jun 2013 03:14:43 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5Q7Egk0028207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 Jun 2013 03:14:42 -0400 From: Markus Armbruster References: <1369300080-31377-1-git-send-email-akong@redhat.com> <1369300080-31377-3-git-send-email-akong@redhat.com> <519E081B.3090000@redhat.com> Date: Wed, 26 Jun 2013 09:14:40 +0200 In-Reply-To: <519E081B.3090000@redhat.com> (Eric Blake's message of "Thu, 23 May 2013 06:14:19 -0600") Message-ID: <874ncll4wv.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 2/2] net: introduce command to query rx-filter information List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: lcapitulino@redhat.com, Amos Kong , qemu-devel@nongnu.org, stefanha@redhat.com, mst@redhat.com Eric Blake writes: > On 05/23/2013 03:08 AM, Amos Kong wrote: >> We want to implement mac programming over macvtap through Libvirt, >> related rx-filter configuration contains main mac, some of rx-mode >> and mac-table. >> >> The previous patch adds QMP event to notify management of rx-filter >> change. This patch adds a monitor command to query rx-filter >> information. >> >> A flag is used to avoid events flooding, if user don't query > > s/don't/doesn't/ > >> rx-filter after receives one event, new events won't be sent > > s/after/after it/ > >> to qmp monitor. >> >> +++ b/net/net.c >> @@ -961,6 +961,53 @@ void print_net_client(Monitor *mon, NetClientState *nc) >> nc->info_str); >> } >> >> +RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, >> + Error **errp) >> +{ >> + NetClientState *nc; >> + RxFilterInfoList *filter_list = NULL, *last_entry = NULL; >> + >> + QTAILQ_FOREACH(nc, &net_clients, next) { >> + RxFilterInfoList *entry; >> + RxFilterInfo *info; >> + >> + if (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) { >> + continue; >> + } >> + if (has_name && strcmp(nc->name, name) != 0) { > > Do you need the has_name argument here, or can you ensure that the > caller passes NULL when the caller's has_name was false, for one less > parameter and the same amount of information? QAPI always generates a has_FOO parameter for an optional FOO parameter, even when FOO is a pointer, which has the perfectly obvious special "not given" value NULL. I hate that. [...]