Received: from eggs.gnu.org ([208.118.235.92]:52105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfiIM-0004Pu-6t for qemu-devel@nongnu.org; Thu, 23 May 2013 23:03:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfiIL-0008Ow-8q for qemu-devel@nongnu.org; Thu, 23 May 2013 23:03:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfiIL-0008Oe-0X for qemu-devel@nongnu.org; Thu, 23 May 2013 23:03:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4O33qbb030596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 23 May 2013 23:03:52 -0400 Date: Fri, 24 May 2013 11:03:48 +0800 From: Amos Kong Message-ID: <20130524030348.GA1550@t430s.nay.redhat.com> References: <1369300080-31377-1-git-send-email-akong@redhat.com> <1369300080-31377-3-git-send-email-akong@redhat.com> <519E081B.3090000@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519E081B.3090000@redhat.com> 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: mst@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com On Thu, May 23, 2013 at 06:14:19AM -0600, Eric Blake wrote: > On 05/23/2013 03:08 AM, Amos Kong wrote: > > +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, hmp_info_rx_filter() passes NULL name when has_name is false. 'has_name' is need here. Or we can change it to: if (name && strcmp(nc->name, name) != 0) { I think using 'has_name' is clearer. > for one less parameter and the same amount of information? qmp_query_rx_filter() define is generated by QAPI infrastructure, the parameters are fixed. We also use it in hmp_info_rx_filter(). -- Amos.