[libvirt] [PATCH 3/6] virsh: make tree listing more flexible

Eric Blake eblake at redhat.com
Mon Jun 11 16:21:02 UTC 2012


On 06/11/2012 07:43 AM, Eric Blake wrote:
> On 06/11/2012 07:13 AM, Peter Krempa wrote:
>> On 06/09/12 06:34, Eric Blake wrote:
>>> Requiring the user to pass in parallel arrays of names and parents
>>> is annoying; it means that you can't qsort one of the arrays without
>>> invalidating the ordering of the other.  By refactoring this function
>>> to use callbacks, we isolate the layout to be independent of the
>>> printing, and a future patch can exploit that to improve layout.
>>>

>>> +static const char *
>>> +vshTreeArrayLookup(int devid, bool parent, void *opaque)

>>
>> This is used just for listing node devices IIUC. Wouln't it be better to
>> explicitly name the helper and struct that it's meant for node devices?
>> vshNodeDeviceTree ... ?
> 
> In _this_ patch, it's used by both node devices and snapshots.  Later,
> in patch 6/6, I switch snapshots over to using a different callback.
> Maybe I should rename this function as part of that later split into two
> different callbacks, but for this patch, since it really is used twice,
> I think it makes sense as-is.
> 
>>
>> ACK. The name doesn't matter that much, making the tree printer more
>> universal does.

I've pushed this now, but will remain open to the idea of reworking 6/6
to adjust naming.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120611/3667f245/attachment-0001.sig>


More information about the libvir-list mailing list