On Thu, Nov 27, 2008 at 08:53:49AM +0100, Chris Lalancette wrote:
Daniel P. Berrange wrote:
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.187
diff -u -r1.187 configure.in
--- a/configure.in 25 Nov 2008 15:48:11 -0000 1.187
+++ b/configure.in 27 Nov 2008 07:44:51 -0000
@@ -115,11 +115,17 @@
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_PATH_PROG([BRCTL], [brctl], [brctl],
[/sbin:/usr/sbin:/usr/local/sbin:$PATH])
+AC_PATH_PROG([UDEVADM], [udevadm], [],
+ [/sbin:/usr/sbin:/usr/local/sbin:$PATH])
AC_DEFINE_UNQUOTED([DNSMASQ],["$DNSMASQ"],
[Location or name of the dnsmasq program])
AC_DEFINE_UNQUOTED([BRCTL],["$BRCTL"],
[Location or name of the brctl program (see bridge-utils)])
+if test -n "$UDEVADM"; then
+ AC_DEFINE_UNQUOTED([UDEVADM],["$UDEVADM"],
+ [Location or name of the udevadm program])
+fi
ACK.
+void virStorageBackendWaitForDevices(virConnectPtr conn)
+{
+#ifdef UDEVADM
+ const char *const settleprog[] = { UDEVADM, "settle", NULL };
+ int exitstatus;
+
+ if (access(UDEVADM, X_OK) != 0)
+ return;
+
+ /*
+ * NOTE: we ignore errors here; this is just to make sure that any device
+ * nodes that are being created finish before we try to scan them.
+ * If this fails for any reason, we still have the backup of polling for
+ * 5 seconds for device nodes.
+ */
+ virRun(conn, settleprog, &exitstatus);
+#endif
+}
This will generate a compiler warning when UDEVADM is not defined.
Better to have the #ifdef around the entire function, and then do
a no-op decl with ATTRIBUTE_UNUSED
#else
void virStorageBackendWaitForDevices(virConnectPtr conn ATTRIBUTE_UNUSED) {}
#endif
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|