vmm/devices/virtio/block/
persist.rs1use std::sync::Arc;
5
6use serde::{Deserialize, Serialize};
7
8use super::vhost_user::persist::VhostUserBlockState;
9use super::virtio::persist::VirtioBlockState;
10use crate::devices::virtio::transport::VirtioInterrupt;
11use crate::vstate::memory::GuestMemoryMmap;
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
15pub enum BlockState {
16 Virtio(VirtioBlockState),
17 VhostUser(VhostUserBlockState),
18}
19
20impl BlockState {
21 pub fn is_activated(&self) -> bool {
22 match self {
23 BlockState::Virtio(virtio_block_state) => virtio_block_state.virtio_state.activated,
24 BlockState::VhostUser(vhost_user_block_state) => false,
25 }
26 }
27}
28
29#[derive(Debug)]
31pub struct BlockConstructorArgs {
32 pub mem: GuestMemoryMmap,
33}