Eric Blake <ebl...@redhat.com> 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. [...]