summary refs log tree commit diff
path: root/disk
diff options
context:
space:
mode:
authorA. Cody Schuffelen <schuffelen@google.com>2019-12-23 18:59:25 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-22 07:50:01 +0000
commite99b6c7e810437778d0a19bd3fb5d9e8f6adfb84 (patch)
tree0f01df77f108a989ddfb6b924c01a44ae9f7a4c5 /disk
parent90878fb30e52db538a55adca8c05ea1f996944d6 (diff)
downloadcrosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.tar
crosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.tar.gz
crosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.tar.bz2
crosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.tar.lz
crosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.tar.xz
crosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.tar.zst
crosvm-e99b6c7e810437778d0a19bd3fb5d9e8f6adfb84.zip
Make DiskFile, CompositeDisk Debug
Making DiskFile Debug allows placing it inside the QcowFile.

TEST=Compiles
BUG=b:140069322
Change-Id: Idf20b7909146b0c2a60d864da386e362e8be97a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1982828
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'disk')
-rw-r--r--disk/src/composite.rs2
-rw-r--r--disk/src/disk.rs6
2 files changed, 6 insertions, 2 deletions
diff --git a/disk/src/composite.rs b/disk/src/composite.rs
index 06c1545..c3cca00 100644
--- a/disk/src/composite.rs
+++ b/disk/src/composite.rs
@@ -49,6 +49,7 @@ impl Display for Error {
 
 pub type Result<T> = std::result::Result<T, Error>;
 
+#[derive(Debug)]
 struct ComponentDiskPart {
     file: Box<dyn DiskFile>,
     offset: u64,
@@ -65,6 +66,7 @@ impl ComponentDiskPart {
 /// disk by a protocol buffer file that lists out the component file locations and their offsets
 /// and lengths on the virtual disk. The spaces covered by the component disks must be contiguous
 /// and not overlapping.
+#[derive(Debug)]
 pub struct CompositeDiskFile {
     component_disks: Vec<ComponentDiskPart>,
 }
diff --git a/disk/src/disk.rs b/disk/src/disk.rs
index a67d91a..49b8127 100644
--- a/disk/src/disk.rs
+++ b/disk/src/disk.rs
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 use std::cmp::min;
-use std::fmt::{self, Display};
+use std::fmt::{self, Debug, Display};
 use std::fs::File;
 use std::io::{self, Read, Seek, SeekFrom, Write};
 
@@ -66,6 +66,7 @@ pub trait DiskFile:
     + WriteZeroesAt
     + Send
     + AsRawFds
+    + Debug
 {
 }
 impl<
@@ -76,7 +77,8 @@ impl<
             + FileReadWriteAtVolatile
             + WriteZeroesAt
             + Send
-            + AsRawFds,
+            + AsRawFds
+            + Debug,
     > DiskFile for D
 {
 }