Blame SOURCES/0010-vddk-Move-minimum-version-to-VDDK-6.5.patch

6661d0
From 498b4210c1f1a4b4d6cdc09ae354b86522e1d536 Mon Sep 17 00:00:00 2001
7084e2
From: "Richard W.M. Jones" <rjones@redhat.com>
7084e2
Date: Tue, 26 Oct 2021 19:46:32 +0100
7084e2
Subject: [PATCH] vddk: Move minimum version to VDDK 6.5
7084e2
7084e2
Drop support for VDDK 5.5.5 (released in 2015) and 6.0 (released the
7084e2
same year).  Move minimum supported version to 6.5 (released Nov
7084e2
2016).  This is so we can use asynchronous operations.
7084e2
7084e2
Acked-by: Laszlo Ersek <lersek@redhat.com>
7084e2
(cherry picked from commit 5ed23616762a72e039531a9a7cd81353cd4f436e)
7084e2
---
7084e2
 plugins/vddk/nbdkit-vddk-plugin.pod | 10 +++-------
7084e2
 plugins/vddk/vddk-stubs.h           |  3 +--
7084e2
 plugins/vddk/vddk.c                 | 24 ++++++++++++++++--------
7084e2
 tests/dummy-vddk.c                  |  6 ++++++
7084e2
 4 files changed, 26 insertions(+), 17 deletions(-)
7084e2
7084e2
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
7084e2
index 0702aa75..1c16d096 100644
7084e2
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
7084e2
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
7084e2
@@ -424,7 +424,7 @@ by this build.
7084e2
 
7084e2
 =item C<vddk_library_version=...>
7084e2
 
7084e2
-The VDDK major library version: 5, 6, 7, ...
7084e2
+The VDDK major library version: 6, 7, ...
7084e2
 If this is omitted it means the library could not be loaded.
7084e2
 
7084e2
 =item C<vddk_dll=...>
7084e2
@@ -548,16 +548,12 @@ server, which can also be very slow.
7084e2
 
7084e2
 =head1 SUPPORTED VERSIONS OF VDDK
7084e2
 
7084e2
-This plugin requires VDDK E<ge> 5.5.5, which in turn means that it
7084e2
-is only supported on x64-64 platforms.
7084e2
+This plugin requires VDDK E<ge> 6.5 (released Nov 2016).  It is only
7084e2
+supported on the x64-64 archtecture.
7084e2
 
7084e2
 It has been tested with all versions up to 7.0.3 (but should work with
7084e2
 future versions).
7084e2
 
7084e2
-VDDK E<ge> 6.0 should be used if possible.  This is the first version
7084e2
-which added Flush support which is crucial for data integrity when
7084e2
-writing.
7084e2
-
7084e2
 VDDK 6.7 was the first version that supported the
7084e2
 C<VixDiskLib_QueryAllocatedBlocks> API, required to provide extent
7084e2
 information over NBD.
7084e2
diff --git a/plugins/vddk/vddk-stubs.h b/plugins/vddk/vddk-stubs.h
7084e2
index 5e70238d..a94df9cd 100644
7084e2
--- a/plugins/vddk/vddk-stubs.h
7084e2
+++ b/plugins/vddk/vddk-stubs.h
7084e2
@@ -40,8 +40,7 @@
7084e2
  */
7084e2
 
7084e2
 /* Required stubs, present in all versions of VDDK that we support.  I
7084e2
- * have checked that all these exist in at least VDDK 5.5.5 (2015)
7084e2
- * which is the earliest version of VDDK that we support.
7084e2
+ * have checked that all these exist in at least VDDK 5.5.5 (2015).
7084e2
  */
7084e2
 
7084e2
 STUB (VixDiskLib_InitEx,
7084e2
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
7084e2
index 096b04bf..babffc28 100644
7084e2
--- a/plugins/vddk/vddk.c
7084e2
+++ b/plugins/vddk/vddk.c
7084e2
@@ -75,13 +75,13 @@ NBDKIT_DLL_PUBLIC int vddk_debug_stats;
7084e2
 #undef OPTIONAL_STUB
7084e2
 
7084e2
 /* Parameters passed to InitEx. */
7084e2
-#define VDDK_MAJOR 5
7084e2
+#define VDDK_MAJOR 6
7084e2
 #define VDDK_MINOR 5
7084e2
 
7084e2
 static void *dl;                           /* dlopen handle */
7084e2
 static bool init_called;                   /* was InitEx called */
7084e2
 static __thread int error_suppression;     /* threadlocal error suppression */
7084e2
-static int library_version;                /* VDDK major: 5, 6, 7, ... */
7084e2
+static int library_version;                /* VDDK major: 6, 7, ... */
7084e2
 
7084e2
 static enum { NONE = 0, ZLIB, FASTLZ, SKIPZ } compression; /* compression */
7084e2
 static char *config;                       /* config */
7084e2
@@ -413,16 +413,14 @@ load_library (bool load_error_is_fatal)
7084e2
     /* Prefer the newest library in case multiple exist.  Check two
7084e2
      * possible directories: the usual VDDK installation puts .so
7084e2
      * files in an arch-specific subdirectory of $libdir (our minimum
7084e2
-     * supported version is VDDK 5.5.5, which only supports x64-64);
7084e2
-     * but our testsuite is easier to write if we point libdir
7084e2
-     * directly to a stub .so.
7084e2
+     * supported version is VDDK 6.5, which only supports x64-64); but
7084e2
+     * our testsuite is easier to write if we point libdir directly to
7084e2
+     * a stub .so.
7084e2
      */
7084e2
     { "lib64/libvixDiskLib.so.7", 7 },
7084e2
     { "libvixDiskLib.so.7",       7 },
7084e2
     { "lib64/libvixDiskLib.so.6", 6 },
7084e2
     { "libvixDiskLib.so.6",       6 },
7084e2
-    { "lib64/libvixDiskLib.so.5", 5 },
7084e2
-    { "libvixDiskLib.so.5",       5 },
7084e2
     { NULL }
7084e2
   };
7084e2
   size_t i;
7084e2
@@ -474,7 +472,7 @@ load_library (bool load_error_is_fatal)
7084e2
     exit (EXIT_FAILURE);
7084e2
   }
7084e2
 
7084e2
-  assert (library_version >= 5);
7084e2
+  assert (library_version >= 6);
7084e2
 
7084e2
   /* Load symbols. */
7084e2
 #define STUB(fn,ret,args)                                         \
7084e2
@@ -490,6 +488,16 @@ load_library (bool load_error_is_fatal)
7084e2
 #include "vddk-stubs.h"
7084e2
 #undef STUB
7084e2
 #undef OPTIONAL_STUB
7084e2
+
7084e2
+  /* Additionally, VDDK version must be >= 6.5.  This was the first
7084e2
+   * version which introduced VixDiskLib_Wait symbol so we can check
7084e2
+   * for that.
7084e2
+   */
7084e2
+  if (VixDiskLib_Wait == NULL) {
7084e2
+    nbdkit_error ("VDDK version must be >= 6.5. "
7084e2
+                  "See nbdkit-vddk-plugin(1) man page section \"SUPPORTED VERSIONS OF VDDK\".");
7084e2
+    exit (EXIT_FAILURE);
7084e2
+  }
7084e2
 }
7084e2
 
7084e2
 static int
7084e2
diff --git a/tests/dummy-vddk.c b/tests/dummy-vddk.c
7084e2
index 9b5ae0a2..cb88380c 100644
7084e2
--- a/tests/dummy-vddk.c
7084e2
+++ b/tests/dummy-vddk.c
7084e2
@@ -198,3 +198,9 @@ VixDiskLib_Write (VixDiskLibHandle handle,
7084e2
   memcpy (disk + offset, buf, nr_sectors * VIXDISKLIB_SECTOR_SIZE);
7084e2
   return VIX_OK;
7084e2
 }
7084e2
+
7084e2
+NBDKIT_DLL_PUBLIC VixError
7084e2
+VixDiskLib_Wait (VixDiskLibHandle handle)
7084e2
+{
7084e2
+  return VIX_OK;
7084e2
+}
7084e2
-- 
7084e2
2.31.1
7084e2