Closed leslie-qiwa closed 4 years ago
Is libvmdk_handle_read_buffer the one I should use and continuously read until EOF?
yes, the API is very straightforward open (descriptor file), (open data files), read_buffer, close For an example have a look at vmdkmount (mount_file_entry.c).
Perfect and thanks for the quick reply. Would you mind me submitting one PR to add one vmdkconvert
utility tool into vmdktools
folder. I thought other people may benefit from it, and I can also get your help to review it.
The reason why I never added such a tool (which I would have named vmdkexport) is that with vmdkmount you technically have a raw image without the additional storage overhead. With dd or equiv you can easily create such a copy.
What is your use case for having such tool?
BTW I can help review such a tool also in another repo, as long as the code is under an Open Source license I can work with.
The use case is to download vmdk file and convert to raw disk image file on the fly, while Golang is the main language. So I probably need write one Golang binding for this library. With the vmdkexport
tool, I can get some understanding on the APIs and verify the result, then can work on binding part.
Anyway, let me create such a tool on my repo, and invite you for review. Thanks a lot
I see, the outline of the C API usage would look something like:
Make sure to check the return values of the functions, they indicate success/error status and error contains some diagnostic information about the error. Also free error if it has been set.
More detail is about the C API are in man 3 libvmdk
or the main include file include/libvmdk.h
thanks a lot!
Thanks for the great library. We want a simple library to convert VMDK image to raw disk image. qemu-img can support it, but we do want a library like libvmdk to achieve. So if yes, can you please provide some sample codes? Is libvmdk_handle_read_buffer the one I should use and continuously read until EOF?