qcow2-rs
Library in qcow2-rs is for reading/writing data from qcow2 image, and follows its features:
-
async/await, support multiple io engines, verified on tokio-uring, raw linux sync IO syscall, tokio and io-uring^3 with smol^2 runtime
-
support both direct IO and buffered IO, for direct IO, it needs async runtime support, such as tokio doesn't allow it.
-
basic read/write function on data file, backing file and compressed image
-
l2 table & refcount block load & store in slice way, and the minimized slice size is block size, and the maximized size is cluster size
-
block device like interface, minimized read/write unit is aligned with block size of the FS qcow2 image
-
cross-platform support, verified on linux(Fedora/ubuntu), freebsd and windows
This project is based on qcow2 implementation from rsd
^1
Motivation of this project is for supporting ublk-qcow2^4, but turns out it becomes one generic async qcow2 library. Attributed to Rust async/.await, the lib is well designed & implemented, and easy to extend(add new features, improve, ...)
One utility is included in this project, which can dump qcow2 meta, show any meta related statistics of the image, check image meta integrity & host cluster leak, format qcow2 image and convert between qcow2 and raw.
Example
use qcow2_default_params;
use qcow2_setup_dev_uring;
use Qcow2IoBuf;
start;
Test
-
for running the built-in test,
qemu-img
is required, so package ofqemu-utils
(Debian/Ubuntu) orqemu-img
(Fedora, RHEL, ...) needs to be installed -
built CI covers 'carget test' on both ubuntu and windows
License
This project is licensed under MIT OR Apache.
Contributing
Any kinds of contributions are welcome!