No functional change here, we're just making sure we have the disk size (in bytes) available in the handle. --- plugins/vddk/vddk.h | 3 +++ plugins/vddk/vddk.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/plugins/vddk/vddk.h b/plugins/vddk/vddk.h index fb0c79a838..1d1069ccdf 100644 --- a/plugins/vddk/vddk.h +++ b/plugins/vddk/vddk.h @@ -165,6 +165,9 @@ struct vddk_handle { command_queue commands; /* command queue */ pthread_cond_t commands_cond; /* condition (queue size 0 -> 1) */ uint64_t id; /* next command ID */ + + /* Cached disk size in bytes (set in get_size()). */ + uint64_t size; }; /* reexec.c */ diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c index 43400f8530..1de356d883 100644 --- a/plugins/vddk/vddk.c +++ b/plugins/vddk/vddk.c @@ -889,19 +889,19 @@ vddk_get_size (void *handle) { struct vddk_handle *h = handle; VixDiskLibInfo *info; - int64_t size; struct command info_cmd = { .type = INFO, .ptr = &info }; if (send_command_and_wait (h, &info_cmd) == -1) return -1; - size = info->capacity * (int64_t)VIXDISKLIB_SECTOR_SIZE; + /* Compute the size and cache it into the handle. */ + h->size = info->capacity * VIXDISKLIB_SECTOR_SIZE; VDDK_CALL_START (VixDiskLib_FreeInfo, "info") VixDiskLib_FreeInfo (info); VDDK_CALL_END (VixDiskLib_FreeInfo, 0); - return size; + return h->size; } /* Advertise most efficient block sizes. */ -- 2.46.0 _______________________________________________ Libguestfs mailing list -- guestfs@lists.libguestfs.org To unsubscribe send an email to guestfs-le...@lists.libguestfs.org