--- 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 7eda4ef..efd2c8d 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -7457,9 +7457,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; @@ -7479,14 +7480,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) { vboxGlobalData *data = conn->privateData; vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7531,7 +7532,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) { vboxGlobalData *data = conn->privateData; vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7588,7 +7590,7 @@ int vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames) return ret; } -int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) +static int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) { vboxGlobalData *data = conn->privateData; vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7633,7 +7635,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) { vboxGlobalData *data = conn->privateData; vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER; @@ -7690,7 +7693,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) { vboxGlobalData *data = conn->privateData; PRUint32 interfaceType = 0; @@ -7742,7 +7746,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) { vboxGlobalData *data = conn->privateData; PRUnichar *nameUtf16 = NULL; @@ -7993,12 +7997,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); } @@ -8099,17 +8103,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) { vboxGlobalData *data = network->conn->privateData; char *networkNameUtf8 = NULL; @@ -8202,7 +8206,7 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16, return result; } -char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags) +static char *vboxNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags) { vboxGlobalData *data = network->conn->privateData; virNetworkDefPtr def = NULL; @@ -8445,6 +8449,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 d33f78f..507212f 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; @@ -92,7 +83,7 @@ vboxGetDrivers(virDriverPtr *driver_ret, * never work */ driver = &vboxDriverDummy; - networkDriver = &vbox22NetworkDriver; + networkDriver = &vboxCommonNetworkDriver; storageDriver = &vbox22StorageDriver; /* Init the glue and get the API version. */ @@ -109,43 +100,33 @@ vboxGetDrivers(virDriverPtr *driver_ret, */ 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 9231fab..a062428 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -5894,24 +5894,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