block: merge qcow, vhdx and block_util into block crate

This commit merges crates `qcow`, `vhdx` and `block_util` into the
crate `block`, which can allow `qcow` to use functions from `block_util`
without introducing a circular crate dependency.

This commit is based on crosvm implementation:
https://chromium.googlesource.com/crosvm/crosvm/+/f2eecc4152eca8d395566cffa2c102ec090a152d

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
This commit is contained in:
Yu Li
2023-07-12 10:24:28 +08:00
committed by Rob Bradford
parent 47fbe9af1e
commit 447cad3861
38 changed files with 117 additions and 201 deletions
+1 -2
View File
@@ -7,13 +7,12 @@ build = "../build.rs"
[dependencies]
argh = "0.1.9"
block_util = { path = "../block_util" }
block = { path = "../block" }
env_logger = "0.10.0"
epoll = "4.3.3"
libc = "0.2.139"
log = "0.4.17"
option_parser = { path = "../option_parser" }
qcow = { path = "../qcow" }
vhost = { version = "0.7.0", features = ["vhost-user-slave"] }
vhost-user-backend = "0.9.0"
virtio-bindings = "0.2.0"
+5 -2
View File
@@ -8,11 +8,14 @@
//
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
use block_util::{build_disk_image_id, Request, VirtioBlockConfig};
use block::{
build_disk_image_id,
qcow::{self, ImageType, QcowFile},
Request, VirtioBlockConfig,
};
use libc::EFD_NONBLOCK;
use log::*;
use option_parser::{OptionParser, OptionParserError, Toggle};
use qcow::{self, ImageType, QcowFile};
use std::fs::File;
use std::fs::OpenOptions;
use std::io::Read;