[libvirt] [PATCH v2] Fix disability to run on systems with no PCI bus

The patch which moved libpciaccess initialization to one place caused regression - we were not able to run on system with no PCI bus, like s390(x). --- src/node_device/node_device_udev.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 2139ef3..fcff252 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1421,8 +1421,12 @@ static int udevDeviceMonitorShutdown(void) ret = -1; } +#if defined __s390__ || defined __s390x_ + /* Nothing was initialized, nothing needs to be cleaned up */ +#else /* pci_system_cleanup returns void */ pci_system_cleanup(); +#endif return ret; } @@ -1595,6 +1599,10 @@ static int udevDeviceMonitorStartup(int privileged) int ret = 0; int pciret; +#if defined __s390__ || defined __s390x_ + /* On x390(x) system there is no PCI bus. + * Therefore there is nothing to initialize here. */ +#else if ((pciret = pci_system_init()) != 0) { /* Ignore failure as non-root; udev is not as helpful in that * situation, but a non-privileged user won't benefit much @@ -1607,6 +1615,7 @@ static int udevDeviceMonitorStartup(int privileged) goto out; } } +#endif if (VIR_ALLOC(priv) < 0) { virReportOOMError(); -- 1.7.4.4

Il giorno ven, 22/04/2011 alle 14.24 +0200, Michal Privoznik ha scritto:
+ /* On x390(x) system there is no PCI bus.
Looks like a typo? -- Diego Elio Pettenò — Flameeyes http://blog.flameeyes.eu/

On Fri, Apr 22, 2011 at 02:24:54PM +0200, Michal Privoznik wrote:
The patch which moved libpciaccess initialization to one place caused regression - we were not able to run on system with no PCI bus, like s390(x). --- src/node_device/node_device_udev.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 2139ef3..fcff252 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1421,8 +1421,12 @@ static int udevDeviceMonitorShutdown(void) ret = -1; }
+#if defined __s390__ || defined __s390x_ + /* Nothing was initialized, nothing needs to be cleaned up */ +#else /* pci_system_cleanup returns void */ pci_system_cleanup(); +#endif
return ret; } @@ -1595,6 +1599,10 @@ static int udevDeviceMonitorStartup(int privileged) int ret = 0; int pciret;
+#if defined __s390__ || defined __s390x_
This needs to be one loine further up, so that 'int pciret;' is within the conditional. Otherwise you'll get a compiler warning about an unused variable
+ /* On x390(x) system there is no PCI bus. + * Therefore there is nothing to initialize here. */ +#else if ((pciret = pci_system_init()) != 0) { /* Ignore failure as non-root; udev is not as helpful in that * situation, but a non-privileged user won't benefit much @@ -1607,6 +1615,7 @@ static int udevDeviceMonitorStartup(int privileged) goto out; } } +#endif
if (VIR_ALLOC(priv) < 0) { virReportOOMError();
ACK if you fix the issue above & the typo Diego pointed out. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Diego Elio Pettenò
-
Michal Privoznik