--- src/vbox/vbox_common.c | 54 +++++++++++++++++++++++++++++------------ src/vbox/vbox_driver.c | 23 ++---------------- src/vbox/vbox_tmpl.c | 18 -------------- src/vbox/vbox_uniformed_api.h | 16 ------------ 4 files changed, 40 insertions(+), 71 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 6e6ce67..4bb01b0 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -7468,9 +7468,10 @@ vboxNodeGetFreePages(virConnectPtr conn ATTRIBUTE_UNUSED, * The Network Functions here on */ -virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn, - virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags) +static virDrvOpenStatus +vboxNetworkOpen(virConnectPtr conn, + virConnectAuthPtr auth ATTRIBUTE_UNUSED, + unsigned int flags) { vboxGlobalData *data = conn->privateData; @@ -7492,14 +7493,14 @@ virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; } -int vboxNetworkClose(virConnectPtr conn) +static int vboxNetworkClose(virConnectPtr conn) { VIR_DEBUG("network uninitialized"); conn->networkPrivateData = NULL; return 0; } -int vboxConnectNumOfNetworks(virConnectPtr conn) +static int vboxConnectNumOfNetworks(virConnectPtr conn) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7534,7 +7535,8 @@ int vboxConnectNumOfNetworks(virConnectPtr conn) return ret; } -int vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames) +static int +vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7581,7 +7583,7 @@ int vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames) return ret; } -int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) +static int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7616,7 +7618,8 @@ int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) return ret; } -int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) +static int +vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) { VBOX_OBJECT_HOST_CHECK(conn, int, 0); vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7663,7 +7666,8 @@ int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names, int n return ret; } -virNetworkPtr vboxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid) +static virNetworkPtr +vboxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid) { VBOX_OBJECT_HOST_CHECK(conn, virNetworkPtr, NULL); PRUint32 interfaceType = 0; @@ -7706,7 +7710,7 @@ virNetworkPtr vboxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *u return ret; } -virNetworkPtr vboxNetworkLookupByName(virConnectPtr conn, const char *name) +static virNetworkPtr vboxNetworkLookupByName(virConnectPtr conn, const char *name) { VBOX_OBJECT_HOST_CHECK(conn, virNetworkPtr, NULL); PRUnichar *nameUtf16 = NULL; @@ -7935,12 +7939,12 @@ vboxNetworkDefineCreateXML(virConnectPtr conn, const char *xml, bool start) return ret; } -virNetworkPtr vboxNetworkCreateXML(virConnectPtr conn, const char *xml) +static virNetworkPtr vboxNetworkCreateXML(virConnectPtr conn, const char *xml) { return vboxNetworkDefineCreateXML(conn, xml, true); } -virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml) +static virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml) { return vboxNetworkDefineCreateXML(conn, xml, false); } @@ -8031,17 +8035,17 @@ vboxNetworkUndefineDestroy(virNetworkPtr network, bool removeinterface) return ret; } -int vboxNetworkUndefine(virNetworkPtr network) +static int vboxNetworkUndefine(virNetworkPtr network) { return vboxNetworkUndefineDestroy(network, true); } -int vboxNetworkDestroy(virNetworkPtr network) +static int vboxNetworkDestroy(virNetworkPtr network) { return vboxNetworkUndefineDestroy(network, false); } -int vboxNetworkCreate(virNetworkPtr network) +static int vboxNetworkCreate(virNetworkPtr network) { VBOX_OBJECT_HOST_CHECK(network->conn, int, -1); char *networkNameUtf8 = NULL; @@ -8125,7 +8129,7 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16, return result; } -char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags) +static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags) { VBOX_OBJECT_HOST_CHECK(network->conn, char *, NULL); virNetworkDefPtr def = NULL; @@ -8357,6 +8361,24 @@ virDriver vboxCommonDriver = { .nodeGetFreePages = vboxNodeGetFreePages, /* 1.2.6 */ }; +virNetworkDriver vboxCommonNetworkDriver = { + "VBOX", + .networkOpen = vboxNetworkOpen, /* 0.6.4 */ + .networkClose = vboxNetworkClose, /* 0.6.4 */ + .connectNumOfNetworks = vboxConnectNumOfNetworks, /* 0.6.4 */ + .connectListNetworks = vboxConnectListNetworks, /* 0.6.4 */ + .connectNumOfDefinedNetworks = vboxConnectNumOfDefinedNetworks, /* 0.6.4 */ + .connectListDefinedNetworks = vboxConnectListDefinedNetworks, /* 0.6.4 */ + .networkLookupByUUID = vboxNetworkLookupByUUID, /* 0.6.4 */ + .networkLookupByName = vboxNetworkLookupByName, /* 0.6.4 */ + .networkCreateXML = vboxNetworkCreateXML, /* 0.6.4 */ + .networkDefineXML = vboxNetworkDefineXML, /* 0.6.4 */ + .networkUndefine = vboxNetworkUndefine, /* 0.6.4 */ + .networkCreate = vboxNetworkCreate, /* 0.6.4 */ + .networkDestroy = vboxNetworkDestroy, /* 0.6.4 */ + .networkGetXMLDesc = vboxNetworkGetXMLDesc, /* 0.6.4 */ +}; + static void updateDriver(void) { /* Update the vboxDriver according to the vboxUniformedAPI. diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index f0c05fe..6c86973 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -48,28 +48,19 @@ VIR_LOG_INIT("vbox.vbox_driver"); -extern virNetworkDriver vbox22NetworkDriver; extern virStorageDriver vbox22StorageDriver; -extern virNetworkDriver vbox30NetworkDriver; extern virStorageDriver vbox30StorageDriver; -extern virNetworkDriver vbox31NetworkDriver; extern virStorageDriver vbox31StorageDriver; -extern virNetworkDriver vbox32NetworkDriver; extern virStorageDriver vbox32StorageDriver; -extern virNetworkDriver vbox40NetworkDriver; extern virStorageDriver vbox40StorageDriver; -extern virNetworkDriver vbox41NetworkDriver; extern virStorageDriver vbox41StorageDriver; -extern virNetworkDriver vbox42NetworkDriver; extern virStorageDriver vbox42StorageDriver; -extern virNetworkDriver vbox42_20NetworkDriver; extern virStorageDriver vbox42_20StorageDriver; -extern virNetworkDriver vbox43NetworkDriver; extern virStorageDriver vbox43StorageDriver; -extern virNetworkDriver vbox43_4NetworkDriver; extern virStorageDriver vbox43_4StorageDriver; extern virDriver vboxCommonDriver; +extern virNetworkDriver vboxCommonNetworkDriver; static virDriver vboxDriverDummy; @@ -89,7 +80,7 @@ int vboxRegister(void) * never work */ driver = &vboxDriverDummy; - networkDriver = &vbox22NetworkDriver; + networkDriver = &vboxCommonNetworkDriver; storageDriver = &vbox22StorageDriver; /* Init the glue and get the API version. */ @@ -106,43 +97,33 @@ int vboxRegister(void) */ if (uVersion >= 2001052 && uVersion < 2002051) { VIR_DEBUG("VirtualBox API version: 2.2"); - networkDriver = &vbox22NetworkDriver; storageDriver = &vbox22StorageDriver; } else if (uVersion >= 2002051 && uVersion < 3000051) { VIR_DEBUG("VirtualBox API version: 3.0"); - networkDriver = &vbox30NetworkDriver; storageDriver = &vbox30StorageDriver; } else if (uVersion >= 3000051 && uVersion < 3001051) { VIR_DEBUG("VirtualBox API version: 3.1"); - networkDriver = &vbox31NetworkDriver; storageDriver = &vbox31StorageDriver; } else if (uVersion >= 3001051 && uVersion < 3002051) { VIR_DEBUG("VirtualBox API version: 3.2"); - networkDriver = &vbox32NetworkDriver; storageDriver = &vbox32StorageDriver; } else if (uVersion >= 3002051 && uVersion < 4000051) { VIR_DEBUG("VirtualBox API version: 4.0"); - networkDriver = &vbox40NetworkDriver; storageDriver = &vbox40StorageDriver; } else if (uVersion >= 4000051 && uVersion < 4001051) { VIR_DEBUG("VirtualBox API version: 4.1"); - networkDriver = &vbox41NetworkDriver; storageDriver = &vbox41StorageDriver; } else if (uVersion >= 4001051 && uVersion < 4002020) { VIR_DEBUG("VirtualBox API version: 4.2"); - networkDriver = &vbox42NetworkDriver; storageDriver = &vbox42StorageDriver; } else if (uVersion >= 4002020 && uVersion < 4002051) { VIR_DEBUG("VirtualBox API version: 4.2.20 or higher"); - networkDriver = &vbox42_20NetworkDriver; storageDriver = &vbox42_20StorageDriver; } else if (uVersion >= 4002051 && uVersion < 4003004) { VIR_DEBUG("VirtualBox API version: 4.3"); - networkDriver = &vbox43NetworkDriver; storageDriver = &vbox43StorageDriver; } else if (uVersion >= 4003004 && uVersion < 4003051) { VIR_DEBUG("VirtualBox API version: 4.3.4 or higher"); - networkDriver = &vbox43_4NetworkDriver; storageDriver = &vbox43_4StorageDriver; } else { VIR_DEBUG("Unsupported VirtualBox API version: %u", uVersion); diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index d0bed1a..67bd408 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -5892,24 +5892,6 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI) * Function Tables */ -virNetworkDriver NAME(NetworkDriver) = { - "VBOX", - .networkOpen = vboxNetworkOpen, /* 0.6.4 */ - .networkClose = vboxNetworkClose, /* 0.6.4 */ - .connectNumOfNetworks = vboxConnectNumOfNetworks, /* 0.6.4 */ - .connectListNetworks = vboxConnectListNetworks, /* 0.6.4 */ - .connectNumOfDefinedNetworks = vboxConnectNumOfDefinedNetworks, /* 0.6.4 */ - .connectListDefinedNetworks = vboxConnectListDefinedNetworks, /* 0.6.4 */ - .networkLookupByUUID = vboxNetworkLookupByUUID, /* 0.6.4 */ - .networkLookupByName = vboxNetworkLookupByName, /* 0.6.4 */ - .networkCreateXML = vboxNetworkCreateXML, /* 0.6.4 */ - .networkDefineXML = vboxNetworkDefineXML, /* 0.6.4 */ - .networkUndefine = vboxNetworkUndefine, /* 0.6.4 */ - .networkCreate = vboxNetworkCreate, /* 0.6.4 */ - .networkDestroy = vboxNetworkDestroy, /* 0.6.4 */ - .networkGetXMLDesc = vboxNetworkGetXMLDesc, /* 0.6.4 */ -}; - virStorageDriver NAME(StorageDriver) = { .name = "VBOX", .storageOpen = vboxStorageOpen, /* 0.7.1 */ diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index da754e8..b92c932 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -586,22 +586,6 @@ typedef struct { virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid); -virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn, - virConnectAuthPtr auth, - unsigned int flags); -int vboxNetworkClose(virConnectPtr conn); -int vboxConnectNumOfNetworks(virConnectPtr conn); -int vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames); -int vboxConnectNumOfDefinedNetworks(virConnectPtr conn); -int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames); -virNetworkPtr vboxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid); -virNetworkPtr vboxNetworkLookupByName(virConnectPtr conn, const char *name); -virNetworkPtr vboxNetworkCreateXML(virConnectPtr conn, const char *xml); -virNetworkPtr vboxNetworkDefineXML(virConnectPtr conn, const char *xml); -int vboxNetworkUndefine(virNetworkPtr network); -int vboxNetworkDestroy(virNetworkPtr network); -int vboxNetworkCreate(virNetworkPtr network); -char *vboxNetworkGetXMLDesc(virNetworkPtr network, 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