[libvirt] [PATCH] vbox: remove unused code that causes build failures

Since 87dea4fcffb2d1b120e7841adc0e3d8ea97ed777 vboxGetDrivers() is not used for getting the vbox network driver. The only call the code does is using NULL as the @networkDriver_ret param , but the code still used vbox[0-9][0-9]NetworkDriver that didn't exist anymore. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/vbox/vbox_driver.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index 7d7214a..4d13fbf 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -74,10 +74,8 @@ extern virStorageDriver vbox43_4StorageDriver; #if !defined(WITH_DRIVER_MODULES) || defined(VBOX_STORAGE_DRIVER) static void vboxGetDrivers(virDriverPtr *driver_ret, - virNetworkDriverPtr *networkDriver_ret, virStorageDriverPtr *storageDriver_ret) { - virNetworkDriverPtr networkDriver; virStorageDriverPtr storageDriver; uint32_t uVersion; @@ -87,7 +85,6 @@ vboxGetDrivers(virDriverPtr *driver_ret, * if the user requests a vbox:// URI which we know will * never work */ - networkDriver = &vbox22NetworkDriver; storageDriver = &vbox22StorageDriver; /* Init the glue and get the API version. */ @@ -104,43 +101,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); @@ -151,8 +138,6 @@ vboxGetDrivers(virDriverPtr *driver_ret, if (driver_ret) *driver_ret = NULL; - if (networkDriver_ret) - *networkDriver_ret = networkDriver; if (storageDriver_ret) *storageDriver_ret = storageDriver; } @@ -178,7 +163,7 @@ int vboxStorageRegister(void) { virStorageDriverPtr storageDriver; - vboxGetDrivers(NULL, NULL, &storageDriver); + vboxGetDrivers(NULL, &storageDriver); if (virRegisterStorageDriver(storageDriver) < 0) return -1; -- 2.1.2

On Fri, Oct 03, 2014 at 08:50:47PM +0200, Martin Kletzander wrote:
Since 87dea4fcffb2d1b120e7841adc0e3d8ea97ed777 vboxGetDrivers() is not used for getting the vbox network driver. The only call the code does is using NULL as the @networkDriver_ret param , but the code still used vbox[0-9][0-9]NetworkDriver that didn't exist anymore.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> ---
I didn't do 'format-patch' and 'send-email' doesn't add notes. So I'm attaching them now: I'm not pushing this as a build-breaker because I sense there might be more to this. The thing is that it doesn't fail for anyone else I talked to, neither does it fail for out test suite. I don't quite understand how it could worked (ever), since the only definition of vbox22NetworkDriver (and others) was extern throughout the whole git history. I'm running autogen using --with-vbox even though I don't have any virtualbox libraries/binaries installed, but there is no such requirement for compiling the code. And I don't think the libraries would export a virNetworkDriver data struct either. Anyway, feel free to let me know where the real problem is and I'll be glad to help with that either.

Sorry for troubling. I'm checking the release note and just find I missed this. This state existed because it is in the middle of something (say I am rewriting the whole network driver and storage driver for vbox.) And I did forget to remove vbox[0-9][0-9]NetworkDriver since we don't need it any more. So this patch just fixed it up. What's more, the whole vboxGetDrivers is removed after rewriting the storage driver. Taowei 2014-10-04 2:57 GMT+08:00 Martin Kletzander <mkletzan@redhat.com>:
On Fri, Oct 03, 2014 at 08:50:47PM +0200, Martin Kletzander wrote:
Since 87dea4fcffb2d1b120e7841adc0e3d8ea97ed777 vboxGetDrivers() is not used for getting the vbox network driver. The only call the code does is using NULL as the @networkDriver_ret param , but the code still used vbox[0-9][0-9]NetworkDriver that didn't exist anymore.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> ---
I didn't do 'format-patch' and 'send-email' doesn't add notes. So I'm attaching them now:
I'm not pushing this as a build-breaker because I sense there might be more to this. The thing is that it doesn't fail for anyone else I talked to, neither does it fail for out test suite.
I don't quite understand how it could worked (ever), since the only definition of vbox22NetworkDriver (and others) was extern throughout the whole git history. I'm running autogen using --with-vbox even though I don't have any virtualbox libraries/binaries installed, but there is no such requirement for compiling the code. And I don't think the libraries would export a virNetworkDriver data struct either.
Anyway, feel free to let me know where the real problem is and I'll be glad to help with that either.
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 10/03/2014 12:50 PM, Martin Kletzander wrote:
Since 87dea4fcffb2d1b120e7841adc0e3d8ea97ed777 vboxGetDrivers() is not used for getting the vbox network driver. The only call the code does is using NULL as the @networkDriver_ret param , but the code still used vbox[0-9][0-9]NetworkDriver that didn't exist anymore.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- src/vbox/vbox_driver.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Martin Kletzander
-
Taowei Luo