summary refs log tree commit diff
path: root/devices/src/virtio/block.rs
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2019-11-01 10:01:23 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-18 07:43:03 +0000
commit24eeed2b6fb6306f404238d1343db4b55aa9beef (patch)
tree0a347754994d470b3df3e3811430b4da6758ea17 /devices/src/virtio/block.rs
parente7c46cad4150ecb18a0832a61042522974543938 (diff)
downloadcrosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.gz
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.bz2
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.lz
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.xz
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.tar.zst
crosvm-24eeed2b6fb6306f404238d1343db4b55aa9beef.zip
devices: virtio: pass Interrupt to activate()
Factor out the common creation of struct Interrupt.

No functional change.

BUG=chromium:854765
TEST=./build_test

Change-Id: Idf8804771ba1af5181818f643e15e1b42918258a
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898268
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'devices/src/virtio/block.rs')
-rw-r--r--devices/src/virtio/block.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/devices/src/virtio/block.rs b/devices/src/virtio/block.rs
index e3e5247..477a9de 100644
--- a/devices/src/virtio/block.rs
+++ b/devices/src/virtio/block.rs
@@ -8,13 +8,11 @@ use std::io::{self, Seek, SeekFrom, Write};
 use std::mem::size_of;
 use std::os::unix::io::{AsRawFd, RawFd};
 use std::result;
-use std::sync::atomic::AtomicUsize;
 use std::sync::Arc;
 use std::thread;
 use std::time::Duration;
 use std::u32;
 
-use crate::pci::MsixConfig;
 use data_model::{DataInit, Le16, Le32, Le64};
 use disk::DiskFile;
 use msg_socket::{MsgReceiver, MsgSender};
@@ -723,10 +721,7 @@ impl VirtioDevice for Block {
     fn activate(
         &mut self,
         mem: GuestMemory,
-        interrupt_evt: EventFd,
-        interrupt_resample_evt: EventFd,
-        msix_config: Option<Arc<Mutex<MsixConfig>>>,
-        status: Arc<AtomicUsize>,
+        interrupt: Interrupt,
         queues: Vec<Queue>,
         mut queue_evts: Vec<EventFd>,
     ) {
@@ -752,12 +747,7 @@ impl VirtioDevice for Block {
                         .name("virtio_blk".to_string())
                         .spawn(move || {
                             let mut worker = Worker {
-                                interrupt: Interrupt::new(
-                                    status,
-                                    interrupt_evt,
-                                    interrupt_resample_evt,
-                                    msix_config,
-                                ),
+                                interrupt,
                                 queues,
                                 mem,
                                 disk_image,