[libvirt] [PATCHv2 4/7] snapshot: virsh fallback for snapshot-list --from children

Eric Blake eblake at redhat.com
Mon Oct 10 23:24:43 UTC 2011


On 10/09/2011 09:23 PM, Daniel Veillard wrote:
> On Fri, Sep 30, 2011 at 05:09:26PM -0600, Eric Blake wrote:
>> Iterating over one level of children requires parsing all snapshots
>> and their parents; a bit of code shuffling makes it pretty easy
>> to do this as well.
>>
>>
>> -    if (tree) {
>> -        char indentBuf[INDENT_BUFLEN];
>> -        char **parents = vshCalloc(ctl, sizeof(char *), actual);
>> +    if (!tree)
>> +        qsort(&names[0], actual, sizeof(char*), namesorter);

I had to rebase a bit here because of the bug fix in 40baa1c, but 
nothing too radical.

>
>    Okay, getting parents global to the function as well as associated
> cleanup looks a bit simpler actually.

Yeah, I was pleasantly surprised at how the function got easier to read 
even as it supported more fallbacks than before.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list