Blame SOURCES/0009-vddk-Print-one-line-in-dump-plugin-output-for-each-V.patch

e7ca0c
From 7b43137763287b3d79874e27146ea2fecc5f9a17 Mon Sep 17 00:00:00 2001
7084e2
From: "Richard W.M. Jones" <rjones@redhat.com>
7084e2
Date: Mon, 25 Oct 2021 08:36:53 +0100
7084e2
Subject: [PATCH] vddk: Print one line in --dump-plugin output for each VDDK
7084e2
 API
7084e2
7084e2
Helps when detecting if certain optional features are being used, such
7084e2
as flush and extents.
7084e2
7084e2
(cherry picked from commit 4ee13559e46cf622410d0bdd7db29bb00908b40a)
7084e2
---
7084e2
 plugins/vddk/nbdkit-vddk-plugin.pod |  9 +++++++++
7084e2
 plugins/vddk/vddk.c                 | 10 ++++++++++
7084e2
 tests/test-vddk-real-dump-plugin.sh |  1 +
7084e2
 3 files changed, 20 insertions(+)
7084e2
7084e2
diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod
7084e2
index 49e3d75d..0702aa75 100644
7084e2
--- a/plugins/vddk/nbdkit-vddk-plugin.pod
7084e2
+++ b/plugins/vddk/nbdkit-vddk-plugin.pod
7084e2
@@ -432,6 +432,15 @@ If this is omitted it means the library could not be loaded.
7084e2
 Prints the full path to the VDDK shared library.  Since this requires
7084e2
 a glibc extension it may not be available in all builds of the plugin.
7084e2
 
7084e2
+=item C<VixDiskLib_...=1>
7084e2
+
7084e2
+For each VDDK API that the plugin uses I<and> which is present in the
7084e2
+VDDK library that was loaded, we print the name of the API
7084e2
+(eg. C<VixDiskLib_Open=1>).  This lets you see which optional APIs are
7084e2
+available, such as C<VixDiskLib_Flush> and
7084e2
+C<VixDiskLib_QueryAllocatedBlocks>.  If the library could not be
7084e2
+loaded then these lines are not printed.
7084e2
+
7084e2
 =back
7084e2
 
7084e2
 =head1 NOTES
7084e2
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
7084e2
index 39a7d261..096b04bf 100644
7084e2
--- a/plugins/vddk/vddk.c
7084e2
+++ b/plugins/vddk/vddk.c
7084e2
@@ -616,6 +616,16 @@ vddk_dump_plugin (void)
7084e2
     printf ("vddk_dll=%s\n", p);
7084e2
   }
7084e2
 #endif
7084e2
+
7084e2
+  /* Note we print all VDDK APIs found here, not just the optional
7084e2
+   * ones.  That is so if we update the baseline VDDK in future and
7084e2
+   * make optional into required APIs, the output doesn't change.
7084e2
+   */
7084e2
+#define STUB(fn,ret,args) if (fn != NULL) printf ("%s=1\n", #fn);
7084e2
+#define OPTIONAL_STUB(fn,ret,args) STUB(fn,ret,args)
7084e2
+#include "vddk-stubs.h"
7084e2
+#undef STUB
7084e2
+#undef OPTIONAL_STUB
7084e2
 }
7084e2
 
7084e2
 /* The rules on threads and VDDK are here:
7084e2
diff --git a/tests/test-vddk-real-dump-plugin.sh b/tests/test-vddk-real-dump-plugin.sh
7084e2
index 0a079c6c..e37c8b54 100755
7084e2
--- a/tests/test-vddk-real-dump-plugin.sh
7084e2
+++ b/tests/test-vddk-real-dump-plugin.sh
7084e2
@@ -65,6 +65,7 @@ grep ^vddk_default_libdir= $out
7084e2
 grep ^vddk_has_nfchostport= $out
7084e2
 grep ^vddk_library_version= $out
7084e2
 grep ^vddk_dll= $out
7084e2
+grep ^VixDiskLib_Open=1 $out
7084e2
 
7084e2
 dll="$(grep ^vddk_dll $out | cut -d= -f2)"
7084e2
 test -f "$dll"
7084e2
-- 
7084e2
2.31.1
7084e2