On 3/12/19 8:00 AM, Ján Tomko wrote:
On Mon, Mar 11, 2019 at 09:38:33PM -0500, Eric Blake wrote:
> Previous patches added topological sorting only for existing public
> API functions, but it turns out that it will also useful for an
> upcoming API addition that wants to visit all snapshots. Add a
> parameter, and update all existing callers (none of which care
> about ordering).
>
> Signed-off-by: Eric Blake <eblake(a)redhat.com>
> ---
> int
> virDomainSnapshotForEach(virDomainSnapshotObjListPtr snapshots,
> + bool topological,
Rather than introducing a bool parameter (which shows up as
non-descriptive 'false' in the caller), I'd put it into the name of the
function:
virDomainSnapshotForEachTopological
which would be a thin wrapper for virDomainSnapshotForEachDescendant.
Alternatively, the one caller can call virDomainSnapshotForEachDescendant
with &snapshots->metaroot directly.
I was debating whether any caller outside of snapshot_conf.c would need
a topological visit (knowing about the metaroot outside of
snapshot_conf.c is a leaky abstraction that I want to avoid). But you're
right that for THIS series, the only caller resides in snapshot_conf.c,
and therefore doing it directly is just as nice. I think that means I
can completely drop this patch and go with that approach instead.
By the way, did you have any comments on my other series adding
topological sorting to the various virDomainSnapshotList API calls? (I
may also end up squashing some of these changes into those, as that
series has not been pushed yet).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization:
qemu.org |
libvirt.org