]> xenbits.xensource.com Git - libvirt.git/commitdiff
m4: Check for sanlock_write_lockspace
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 15 Sep 2016 08:45:26 +0000 (10:45 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 29 Sep 2016 14:59:11 +0000 (16:59 +0200)
Currently, we are checking for sanlock_add_lockspace_timeout
which is good for now. But in a subsequent patch we are going to
use sanlock_write_lockspace (which sets an initial value for io
timeout for sanlock). Now, there is no reason to check for both
functions in sanlock library as the sanlock_write_lockspace was
introduced in 2.7 release and the one we are currently checking
for in the 2.5 release. Therefore it is safe to assume presence
of sanlock_add_lockspace_timeout when sanlock_write_lockspace
is detected.

Moreover, the macro for conditional compilation is renamed to
HAVE_SANLOCK_IO_TIMEOUT (as it now encapsulates two functions).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
m4/virt-sanlock.m4
src/locking/lock_driver_sanlock.c

index d2a607d0457aeacf49e87ea8e7ae36066019802d..3c30cbfdf2342364be5dca47d63a0f54c0e3915a 100644 (file)
@@ -46,11 +46,15 @@ AC_DEFUN([LIBVIRT_CHECK_SANLOCK],[
         [whether sanlock supports sanlock_inq_lockspace])
     fi
 
-    AC_CHECK_LIB([sanlock_client], [sanlock_add_lockspace_timeout],
-                 [sanlock_add_lockspace_timeout=yes], [sanlock_add_lockspace_timeout=no])
-    if test "x$sanlock_add_lockspace_timeout" = "xyes" ; then
-      AC_DEFINE_UNQUOTED([HAVE_SANLOCK_ADD_LOCKSPACE_TIMEOUT], 1,
-        [whether Sanlock supports sanlock_add_lockspace_timeout])
+    dnl Ideally, we would check for sanlock_add_lockspace_timeout here too, but
+    dnl sanlock_write_lockspace has been introduced 2 releases after
+    dnl sanlock_add_lockspace_timeout therefore if sanlock_write_lockspace is found
+    dnl it is safe to assume sanlock_add_lockspace_timeout is present too.
+    AC_CHECK_LIB([sanlock_client], [sanlock_write_lockspace],
+                 [sanlock_write_lockspace=yes], [sanlock_write_lockspace=no])
+    if test "x$sanlock_write_lockspace" = "xyes" ; then
+      AC_DEFINE_UNQUOTED([HAVE_SANLOCK_IO_TIMEOUT], 1,
+        [whether sanlock supports sanlock_write_lockspace])
     fi
 
     CPPFLAGS="$old_cppflags"
index 55d6ccedd4a33195f9f95fc299ce984034836e4f..f52e403c8dafedb56e3cd3103fe8376065e4300e 100644 (file)
@@ -311,7 +311,7 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver)
      * or we can fallback to polling.
      */
  retry:
-#ifdef HAVE_SANLOCK_ADD_LOCKSPACE_TIMEOUT
+#ifdef HAVE_SANLOCK_IO_TIMEOUT
     rv = sanlock_add_lockspace_timeout(&ls, 0, driver->io_timeout);
 #else
     if (driver->io_timeout) {