Read Sectors From a
Disk
VixDiskLib_Read(
) reads a range of sectors from
an open virtual disk. You specify the beginning sector and the number of
sectors. Sector size could vary, but is defined in
<vixDiskLib.h>
as 512 bytes
because VMDK files have that sector size.
vixError = VixDiskLib_Read(srcHandle, i, j, buf);
In vSphere 6.7 and later, you
can improve performance of NBD transport with asynchronous reads. Asynchronous
calls may be used for all transport modes, because they fall back to
synchronous as needed.
// customized callback for complete notification void myDiskLibCompletion(void *cbData, VixError result); // a loop for multiple read requests for (...) vixError = VixDiskLib_ReadAsync(srcHandle, i, j, buf, myDiskLibCompletion, cbData); if (vixError != VIX_ASYNC) { // handle error } } VixDiskLib_Wait(srcHandle); // wait ror all async read to complete