
While fixing the QEMU nodeinfo API to correctly deal with case where CPU sockets have sparse numbering (eg sockets 0 & 3 are populated), I realized that OpenVZ doesn't have a nodeinfo API, and its requirements are basically identical to the QEMU driver's. So this patch moves the impl of the nodeinfo API into a nodeinfo.c file, and makes both the QEMU and OpenVZ driver call out to this shared impl. I also put #ifdef __linux__ around the impl since code reading /proc/cpuinfo is never going to work on any non-Linux platform. For non linux I just return -1 which'll get treated as not-implemented. If QEMU driver is ported to work on Solaris, the nodeinfo.c file can be easily extended for their custom impl. Finally I'm adding a testcase with a bunch of example /proc/cpuinfo files to validate correctness Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|