diff options
author | Cody Schuffelen <schuffelen@google.com> | 2019-07-02 16:54:05 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-28 23:52:36 +0000 |
commit | 7d533e5952b6bae600441e1183964d335a41d6fe (patch) | |
tree | 6f5fc375f4d7207fc02ee20c2c683f5c67d9beca /qcow_utils/src/qcow_utils.rs | |
parent | 971589f7ec1af2904cd5a5b828e9008df9c0bba1 (diff) | |
download | crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.tar crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.tar.gz crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.tar.bz2 crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.tar.lz crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.tar.xz crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.tar.zst crosvm-7d533e5952b6bae600441e1183964d335a41d6fe.zip |
Extract disk creation logic out of qcow and src.
Bug: b/133432409 Change-Id: Iba25d5f6bb5f60619bb2f5a3d72ddfd3a81650b4 Signed-off-by: Cody Schuffelen <schuffelen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1691460 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'qcow_utils/src/qcow_utils.rs')
-rw-r--r-- | qcow_utils/src/qcow_utils.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/qcow_utils/src/qcow_utils.rs b/qcow_utils/src/qcow_utils.rs index 6c8b86f..4c3ede7 100644 --- a/qcow_utils/src/qcow_utils.rs +++ b/qcow_utils/src/qcow_utils.rs @@ -13,7 +13,8 @@ use std::os::raw::{c_char, c_int}; use std::os::unix::io::FromRawFd; use std::panic::catch_unwind; -use qcow::{ImageType, QcowFile}; +use disk::ImageType; +use qcow::QcowFile; use sys_util::{flock, FileSetLen, FlockOperation}; trait DiskFile: FileSetLen + Seek {} @@ -71,7 +72,7 @@ pub unsafe extern "C" fn expand_disk_image(path: *const c_char, virtual_size: u6 return -EIO; } - let image_type = match qcow::detect_image_type(&raw_image) { + let image_type = match disk::detect_image_type(&raw_image) { Ok(t) => t, Err(_) => return -EINVAL, }; @@ -120,7 +121,7 @@ pub unsafe extern "C" fn convert_to_qcow2(src_fd: c_int, dst_fd: c_int) -> c_int match (src_file_owned, dst_file_owned) { (Ok(src_file), Ok(dst_file)) => { catch_unwind( - || match qcow::convert(src_file, dst_file, ImageType::Qcow2) { + || match disk::convert(src_file, dst_file, ImageType::Qcow2) { Ok(_) => 0, Err(_) => -EIO, }, @@ -145,7 +146,7 @@ pub unsafe extern "C" fn convert_to_raw(src_fd: c_int, dst_fd: c_int) -> c_int { match (src_file_owned, dst_file_owned) { (Ok(src_file), Ok(dst_file)) => { - catch_unwind(|| match qcow::convert(src_file, dst_file, ImageType::Raw) { + catch_unwind(|| match disk::convert(src_file, dst_file, ImageType::Raw) { Ok(_) => 0, Err(_) => -EIO, }) |