From c91ac233f6474b07ef181a08093c5d0f2f4ec4c3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 29 Oct 2021 20:56:55 +0100 Subject: [PATCH] vddk: Assume that VixDiskLib_Flush is available Since we now require and check that VDDK >= 6.5, we can assume that VixDiskLib_Flush is always available. (cherry picked from commit e3685e6f0d0b71ab24b96fe85430a3b75da58736) --- plugins/vddk/vddk.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c index 9f223db0..f967e2d9 100644 --- a/plugins/vddk/vddk.c +++ b/plugins/vddk/vddk.c @@ -378,6 +378,12 @@ load_library (bool load_error_is_fatal) "See nbdkit-vddk-plugin(1) man page section \"SUPPORTED VERSIONS OF VDDK\"."); exit (EXIT_FAILURE); } + + /* Added in VDDK 6.0 so it must always be present. Since we are + * going to call this function unconditionally, fail early and hard + * if for some reason it's not present. + */ + assert (VixDiskLib_Flush != NULL); } static int @@ -725,18 +731,19 @@ vddk_get_size (void *handle) return (int64_t) size; } +/* The Flush call was added in VDDK 6.0, since we support minimum 6.5 + * we are always able to do FUA / flush. + */ static int vddk_can_fua (void *handle) { - /* The Flush call was not available in VDDK < 6.0. */ - return VixDiskLib_Flush != NULL ? NBDKIT_FUA_NATIVE : NBDKIT_FUA_NONE; + return NBDKIT_FUA_NATIVE; } static int vddk_can_flush (void *handle) { - /* The Flush call was not available in VDDK < 6.0. */ - return VixDiskLib_Flush != NULL; + return 1; } /* Read data from the file. -- 2.31.1