summary refs log tree commit diff
path: root/src/hw/virtio/block.rs
diff options
context:
space:
mode:
authorStephen Barber <smbarber@chromium.org>2017-06-15 23:23:19 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-07-07 13:15:46 -0700
commit6a4ca7556aeb0bac836347460b397dec10ee534c (patch)
tree7623193601e21f8199d402d1d3b86e7db0bf873a /src/hw/virtio/block.rs
parenta2b0fc1b8ef315ffe2d7f12cb987d0370d00f10c (diff)
downloadcrosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar
crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.gz
crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.bz2
crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.lz
crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.xz
crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.tar.zst
crosvm-6a4ca7556aeb0bac836347460b397dec10ee534c.zip
crosvm: add device type for VirtioDevice
A VirtioDevice should expose its type so that the guest can probe it
correctly.

BUG=none
TEST=boot with block device

Change-Id: I6a8cae3afbdc5ae9f6af23eea928c83e67719c12
Reviewed-on: https://chromium-review.googlesource.com/538104
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Diffstat (limited to 'src/hw/virtio/block.rs')
-rw-r--r--src/hw/virtio/block.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hw/virtio/block.rs b/src/hw/virtio/block.rs
index 6cd68de..7931f67 100644
--- a/src/hw/virtio/block.rs
+++ b/src/hw/virtio/block.rs
@@ -14,7 +14,7 @@ use byteorder::{ByteOrder, LittleEndian};
 use sys_util::Result as SysResult;
 use sys_util::{EventFd, GuestAddress, GuestMemory, GuestMemoryError, Poller};
 
-use super::{VirtioDevice, Queue, DescriptorChain, INTERRUPT_STATUS_USED_RING};
+use super::{VirtioDevice, Queue, DescriptorChain, INTERRUPT_STATUS_USED_RING, TYPE_BLOCK};
 
 const QUEUE_SIZE: u16 = 256;
 const QUEUE_SIZES: &'static [u16] = &[QUEUE_SIZE];
@@ -290,6 +290,10 @@ impl Drop for Block {
 }
 
 impl VirtioDevice for Block {
+    fn device_type(&self) -> u32 {
+        TYPE_BLOCK
+    }
+
     fn queue_max_sizes(&self) -> &[u16] {
         QUEUE_SIZES
     }