Four functions are rewrite in this patch, that is: vboxNodeGetInfo vboxNodeGetCellsFreeMemory vboxNodeGetFreeMemory vboxNodeGetFreePages Since these functions has nothing to do with vbox, it can be directly moved to vbox_common.c. So, I merged these things into one patch. --- src/vbox/vbox_common.c | 39 ++++++++++++++++++++++++++++++++++++++ src/vbox/vbox_tmpl.c | 42 ----------------------------------------- src/vbox/vbox_uniformed_api.h | 13 +++++++++++++ 3 files changed, 52 insertions(+), 42 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 14f627f..c05fd6a 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -7420,3 +7420,42 @@ vboxConnectListAllDomains(virConnectPtr conn, return ret; } #undef MATCH + +int +vboxNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, + virNodeInfoPtr nodeinfo) +{ + return nodeGetInfo(nodeinfo); +} + +int +vboxNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED, + unsigned long long *freeMems, + int startCell, + int maxCells) +{ + return nodeGetCellsFreeMemory(freeMems, startCell, maxCells); +} + +unsigned long long +vboxNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED) +{ + unsigned long long freeMem; + if (nodeGetMemory(NULL, &freeMem) < 0) + return 0; + return freeMem; +} + +int +vboxNodeGetFreePages(virConnectPtr conn ATTRIBUTE_UNUSED, + unsigned int npages, + unsigned int *pages, + int startCell, + unsigned int cellCount, + unsigned long long *counts, + unsigned int flags) +{ + virCheckFlags(0, -1); + + return nodeGetFreePages(npages, pages, startCell, cellCount, counts); +} diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 55ccbc7..72d4c4d 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -3732,48 +3732,6 @@ static char *vboxStorageVolGetPath(virStorageVolPtr vol) { return ret; } -static int -vboxNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, - virNodeInfoPtr nodeinfo) -{ - return nodeGetInfo(nodeinfo); -} - - -static int -vboxNodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED, - unsigned long long *freeMems, - int startCell, - int maxCells) -{ - return nodeGetCellsFreeMemory(freeMems, startCell, maxCells); -} - - -static unsigned long long -vboxNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED) -{ - unsigned long long freeMem; - if (nodeGetMemory(NULL, &freeMem) < 0) - return 0; - return freeMem; -} - - -static int -vboxNodeGetFreePages(virConnectPtr conn ATTRIBUTE_UNUSED, - unsigned int npages, - unsigned int *pages, - int startCell, - unsigned int cellCount, - unsigned long long *counts, - unsigned int flags) -{ - virCheckFlags(0, -1); - - return nodeGetFreePages(npages, pages, startCell, cellCount, counts); -} - static int _pfnInitialize(vboxGlobalData *data) { data->pFuncs = g_pfnGetFunctions(VBOX_XPCOMC_VERSION); diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index c105a07..a868ac0 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -623,6 +623,19 @@ char *vboxDomainScreenshot(virDomainPtr dom, virStreamPtr st, unsigned int screen, unsigned int flags); int vboxConnectListAllDomains(virConnectPtr conn, virDomainPtr **domains, unsigned int flags); +int vboxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo); +int vboxNodeGetCellsFreeMemory(virConnectPtr conn, + unsigned long long *freeMems, + int startCell, + int maxCells); +unsigned long long vboxNodeGetFreeMemory(virConnectPtr); +int vboxNodeGetFreePages(virConnectPtr conn, + unsigned int npages, + unsigned int *pages, + int startCell, + unsigned int cellCount, + unsigned long long *counts, + unsigned int flags); /* Version specified functions for installing uniformed API */ void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list