vmm/devices/virtio/block/vhost_user/
mod.rs

1// Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4pub mod device;
5pub mod event_handler;
6pub mod persist;
7
8use self::device::VhostUserBlock;
9use crate::devices::virtio::vhost_user::VhostUserError;
10use crate::vstate::interrupts::InterruptError;
11
12/// Number of queues for the vhost-user block device.
13pub const NUM_QUEUES: u64 = 1;
14
15/// Queue size for the vhost-user block device.
16pub const QUEUE_SIZE: u16 = 256;
17
18/// Vhost-user block device error.
19#[derive(Debug, thiserror::Error, displaydoc::Display)]
20pub enum VhostUserBlockError {
21    /// Cannot create config
22    Config,
23    /// Snapshotting of vhost-user-blk devices is not supported
24    SnapshottingNotSupported,
25    /// Vhost-user error: {0}
26    VhostUser(VhostUserError),
27    /// Vhost error: {0}
28    Vhost(vhost::Error),
29    /// Error opening eventfd: {0}
30    EventFd(std::io::Error),
31    /// Error creating irqfd: {0}
32    Interrupt(InterruptError),
33}