
On 10/11/2012 06:06 AM, Eric Blake wrote:
On 10/10/2012 10:02 PM, Osier Yang wrote:
Are you interested in writing patches to implement this new API, if others agree with my alternate single-API signature?
Agreed. A single-API and allocating the cpumap inside libvirt without the need to known the maplen avoids the race.
But a flags support won't bite us, assuming someone just want to get the cpumap of the onlined CPUs, or offlined CPUs.
Indeed, shame on me for not remember a flags argument for any possible future extensions.
So how about:
int virNodeGetCpuMap(virConnectPtr conn, unsigned char **cpumap, unsigned int flags);
Yes, that's better, even if flags must always be 0 for now.
No problem to include flags for future extensions to be on the safe side. However, the map will contain all CPUs with the bits representing the online/offline state. If the intention is to quickly get the number of offline/online CPUS the following signature would be better IMO int virNodeGetCpuMap(virConnectPtr conn, unsigned char **cpumap, unsigned int *online, unsigned int *offline, unsigned int flags); -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294