
On 3/22/19 9:00 AM, John Ferlan wrote:
On 3/22/19 12:25 AM, Eric Blake wrote:
Rather than hard-coding the snapshot filter bit values into the generic code, add another layer of indirection: callers must map which of their public filter bits correspond to supported moment bits, then pass two separate flags (the ones translated for moment code to operate on, and the remaining ones for the filter callback to operate on).
- if (flags & VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS) { + if (flags & VIR_DOMAIN_MOMENT_LIST_DESCENDANTS) { /* We could just always do a topological visit; but it is * possible to optimize for less stack usage and time when a * simpler full hashtable visit or counter will do. */ if (from->def || (names && - (flags & VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL))) + (flags & VIR_DOMAIN_MOMENT_LIST_TOPOLOGICAL))) virDomainMomentForEachDescendant(from, virDomainMomentObjListCopyNames, &data); - else if (names || data.flags) + else if (names || data.flags || filter_flags) virHashForEach(moments->objs, virDomainMomentObjListCopyNames, &data); else
Does the data.flags usage just below here calling *ForEachChild using *ObjListCopyNames need the "|| filter_flags" as well? Seems so with the call to data->filter possible.
Yes it does. Good catch, and fixed locally for when I push.
Reviewed-by: John Ferlan <jferlan@redhat.com>
John
[...]
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org