Re: [libvirt] [PATCH 3/5] list: Implement listAllInterfaces

2012-09-12 Thread Eric Blake
On 09/11/2012 09:05 PM, Osier Yang wrote: >>> + >>> +if (VIR_ALLOC_N(names, count)< 0) { >>> +virReportOOMError(); >>> +return -1; >>> +} >> >> >> If you want to check for a race here, you could allocate count+1 items >> in the array, then do an ncf_list_interfaces telling

Re: [libvirt] [PATCH 3/5] list: Implement listAllInterfaces

2012-09-11 Thread Osier Yang
On 2012年09月11日 01:29, Laine Stump wrote: On 09/04/2012 12:10 PM, Osier Yang wrote: This is not that ideal as API for other objects, as it's still O(n). That part I don't see as a big issue, since the number of interfaces isn't generally large enough to have any significant impact :-) Becau

Re: [libvirt] [PATCH 3/5] list: Implement listAllInterfaces

2012-09-10 Thread Laine Stump
On 09/04/2012 12:10 PM, Osier Yang wrote: > This is not that ideal as API for other objects, as it's still > O(n). That part I don't see as a big issue, since the number of interfaces isn't generally large enough to have any significant impact :-) > Because interface driver uses netcf APIs to ma

[libvirt] [PATCH 3/5] list: Implement listAllInterfaces

2012-09-04 Thread Osier Yang
This is not that ideal as API for other objects, as it's still O(n). Because interface driver uses netcf APIs to manage the stuffs, instead of by itself. And netcf APIs don't return a object. It provides APIs like old libvirt APIs: ncf_number_of_interfaces ncf_list_interfaces ncf_lookup_b