diff options
-rw-r--r-- | Cargo.lock | 13 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rwxr-xr-x | build_test.py | 2 | ||||
-rw-r--r-- | disk/Cargo.toml | 5 | ||||
-rw-r--r-- | disk/src/disk.rs | 4 | ||||
-rw-r--r-- | disk/src/qcow/mod.rs (renamed from qcow/src/qcow.rs) | 8 | ||||
-rw-r--r-- | disk/src/qcow/qcow_raw_file.rs (renamed from qcow/src/qcow_raw_file.rs) | 0 | ||||
-rw-r--r-- | disk/src/qcow/refcount.rs (renamed from qcow/src/refcount.rs) | 4 | ||||
-rw-r--r-- | disk/src/qcow/vec_cache.rs (renamed from qcow/src/vec_cache.rs) | 0 | ||||
-rw-r--r-- | fuzz/Cargo.toml | 2 | ||||
-rw-r--r-- | fuzz/qcow_fuzzer.rs | 2 | ||||
-rw-r--r-- | qcow/Cargo.toml | 14 | ||||
-rw-r--r-- | qcow_utils/Cargo.toml | 1 | ||||
-rw-r--r-- | qcow_utils/src/qcow_img.rs | 2 | ||||
-rw-r--r-- | qcow_utils/src/qcow_utils.rs | 3 | ||||
-rw-r--r-- | src/main.rs | 2 |
16 files changed, 17 insertions, 46 deletions
diff --git a/Cargo.lock b/Cargo.lock index 8dc6ff4..81abd93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,7 +106,6 @@ dependencies = [ "p9 0.1.0", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "protos 0.1.0", - "qcow 0.1.0", "rand_ish 0.1.0", "remain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "resources 0.1.0", @@ -182,7 +181,6 @@ dependencies = [ "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "protos 0.1.0", - "qcow 0.1.0", "remain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "sys_util 0.1.0", ] @@ -423,23 +421,12 @@ dependencies = [ ] [[package]] -name = "qcow" -version = "0.1.0" -dependencies = [ - "data_model 0.1.0", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "remain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "sys_util 0.1.0", -] - -[[package]] name = "qcow_utils" version = "0.1.0" dependencies = [ "disk 0.1.0", "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "qcow 0.1.0", "sys_util 0.1.0", ] diff --git a/Cargo.toml b/Cargo.toml index 69d1a42..231e532 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,6 @@ net_util = { path = "net_util" } p9 = { path = "p9" } protobuf = { version = "2.3", optional = true } protos = { path = "protos", optional = true } -qcow = { path = "qcow" } rand_ish = { path = "rand_ish" } remain = "*" resources = { path = "resources" } diff --git a/build_test.py b/build_test.py index 6225518..81d09db 100755 --- a/build_test.py +++ b/build_test.py @@ -32,6 +32,7 @@ TEST_MODULES_PARALLEL = [ 'crosvm', 'data_model', 'devices', + 'disk', 'enumn', 'kernel_cmdline', 'kernel_loader', @@ -40,7 +41,6 @@ TEST_MODULES_PARALLEL = [ 'msg_socket', 'net_sys', 'net_util', - 'qcow', 'qcow_utils', 'rand_ish', 'resources', diff --git a/disk/Cargo.toml b/disk/Cargo.toml index 0847932..d0305a5 100644 --- a/disk/Cargo.toml +++ b/disk/Cargo.toml @@ -8,13 +8,12 @@ edition = "2018" path = "src/disk.rs" [features] -composite-disk = ["data_model", "protos", "protobuf"] +composite-disk = ["protos", "protobuf"] [dependencies] libc = "*" protobuf = { version = "2.3", optional = true } remain = "*" -data_model = { path = "../data_model", optional = true } +data_model = { path = "../data_model" } protos = { path = "../protos", optional = true } -qcow = { path = "../qcow" } sys_util = { path = "../sys_util" } diff --git a/disk/src/disk.rs b/disk/src/disk.rs index c520d13..e3e7e63 100644 --- a/disk/src/disk.rs +++ b/disk/src/disk.rs @@ -8,13 +8,15 @@ use std::fs::File; use std::io::{self, Read, Seek, SeekFrom, Write}; use libc::EINVAL; -use qcow::{QcowFile, QCOW_MAGIC}; use remain::sorted; use sys_util::{ AsRawFds, FileGetLen, FileReadWriteAtVolatile, FileSetLen, FileSync, PunchHole, SeekHole, WriteZeroesAt, }; +mod qcow; +pub use qcow::{QcowFile, QCOW_MAGIC}; + #[cfg(feature = "composite-disk")] mod composite; #[cfg(feature = "composite-disk")] diff --git a/qcow/src/qcow.rs b/disk/src/qcow/mod.rs index 10998f5..f449d1d 100644 --- a/qcow/src/qcow.rs +++ b/disk/src/qcow/mod.rs @@ -21,9 +21,9 @@ use std::io::{self, Read, Seek, SeekFrom, Write}; use std::mem::size_of; use std::os::unix::io::{AsRawFd, RawFd}; -use crate::qcow_raw_file::QcowRawFile; -use crate::refcount::RefCount; -use crate::vec_cache::{CacheMap, Cacheable, VecCache}; +use crate::qcow::qcow_raw_file::QcowRawFile; +use crate::qcow::refcount::RefCount; +use crate::qcow::vec_cache::{CacheMap, Cacheable, VecCache}; #[sorted] #[derive(Debug)] @@ -342,7 +342,7 @@ fn max_refcount_clusters(refcount_order: u32, cluster_size: u32, num_clusters: u /// /// ``` /// # use std::io::{Read, Seek, SeekFrom}; -/// # use qcow::{self, QcowFile}; +/// # use disk::QcowFile; /// # fn test(file: std::fs::File) -> std::io::Result<()> { /// let mut q = QcowFile::from(file).expect("Can't open qcow file"); /// let mut buf = [0u8; 12]; diff --git a/qcow/src/qcow_raw_file.rs b/disk/src/qcow/qcow_raw_file.rs index ede28d8..ede28d8 100644 --- a/qcow/src/qcow_raw_file.rs +++ b/disk/src/qcow/qcow_raw_file.rs diff --git a/qcow/src/refcount.rs b/disk/src/qcow/refcount.rs index 5a87d86..438de5b 100644 --- a/qcow/src/refcount.rs +++ b/disk/src/qcow/refcount.rs @@ -8,8 +8,8 @@ use std::io; use libc::EINVAL; -use crate::qcow_raw_file::QcowRawFile; -use crate::vec_cache::{CacheMap, Cacheable, VecCache}; +use crate::qcow::qcow_raw_file::QcowRawFile; +use crate::qcow::vec_cache::{CacheMap, Cacheable, VecCache}; #[derive(Debug)] pub enum Error { diff --git a/qcow/src/vec_cache.rs b/disk/src/qcow/vec_cache.rs index ecd7673..ecd7673 100644 --- a/qcow/src/vec_cache.rs +++ b/disk/src/qcow/vec_cache.rs diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 47d3bf2..1616921 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -8,9 +8,9 @@ edition = "2018" cros_fuzz = "*" data_model = { path = "../data_model" } devices = { path = "../devices" } +disk = { path = "../disk" } kernel_loader = { path = "../kernel_loader" } libc = "*" -qcow = { path = "../qcow" } rand = "0.6" sys_util = { path = "../sys_util" } usb_util = { path = "../usb_util" } diff --git a/fuzz/qcow_fuzzer.rs b/fuzz/qcow_fuzzer.rs index 74bc75f..c8d1b38 100644 --- a/fuzz/qcow_fuzzer.rs +++ b/fuzz/qcow_fuzzer.rs @@ -5,7 +5,7 @@ #![no_main] use cros_fuzz::fuzz_target; -use qcow::QcowFile; +use disk::QcowFile; use sys_util::SharedMemory; use std::fs::File; diff --git a/qcow/Cargo.toml b/qcow/Cargo.toml deleted file mode 100644 index 5b9d8ab..0000000 --- a/qcow/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "qcow" -version = "0.1.0" -authors = ["The Chromium OS Authors"] -edition = "2018" - -[lib] -path = "src/qcow.rs" - -[dependencies] -libc = "*" -remain = "*" -sys_util = { path = "../sys_util" } -data_model = { path = "../data_model" } \ No newline at end of file diff --git a/qcow_utils/Cargo.toml b/qcow_utils/Cargo.toml index 88326db..5f19f3c 100644 --- a/qcow_utils/Cargo.toml +++ b/qcow_utils/Cargo.toml @@ -16,5 +16,4 @@ path = "src/qcow_img.rs" getopts = "*" libc = "*" disk = { path = "../disk" } -qcow = { path = "../qcow" } sys_util = { path = "../sys_util" } diff --git a/qcow_utils/src/qcow_img.rs b/qcow_utils/src/qcow_img.rs index b4ad422..5bb977b 100644 --- a/qcow_utils/src/qcow_img.rs +++ b/qcow_utils/src/qcow_img.rs @@ -7,7 +7,7 @@ use std::io::{Read, Write}; use getopts::Options; -use qcow::QcowFile; +use disk::QcowFile; use sys_util::WriteZeroes; fn show_usage(program_name: &str) { diff --git a/qcow_utils/src/qcow_utils.rs b/qcow_utils/src/qcow_utils.rs index 0d77816..97d9a94 100644 --- a/qcow_utils/src/qcow_utils.rs +++ b/qcow_utils/src/qcow_utils.rs @@ -10,8 +10,7 @@ use std::fs::OpenOptions; use std::io::{Seek, SeekFrom}; use std::os::raw::{c_char, c_int}; -use disk::ImageType; -use qcow::QcowFile; +use disk::{ImageType, QcowFile}; use sys_util::{flock, FileSetLen, FlockOperation}; trait DiskFile: FileSetLen + Seek {} diff --git a/src/main.rs b/src/main.rs index 0a1ceb4..eee8bb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,8 +23,8 @@ use crosvm::{ #[cfg(feature = "gpu")] use devices::virtio::gpu::{GpuParameters, DEFAULT_GPU_PARAMS}; use devices::{SerialParameters, SerialType}; +use disk::QcowFile; use msg_socket::{MsgReceiver, MsgSender, MsgSocket}; -use qcow::QcowFile; use sys_util::{ debug, error, getpid, info, kill_process_group, net::UnixSeqpacket, reap_child, syslog, validate_raw_fd, warn, |