mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 23:41:15 +00:00
vhost_user_block: Forward the error from unexpected event
This is consistent with vhost-user-net and vhost-user-fs. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
4f4c3d3ebe
commit
710394b872
@ -27,12 +27,12 @@ use std::process;
|
|||||||
use std::slice;
|
use std::slice;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
use std::{convert, error, fmt, io};
|
||||||
use vhost_rs::vhost_user::message::*;
|
use vhost_rs::vhost_user::message::*;
|
||||||
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring, VringWorker};
|
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring, VringWorker};
|
||||||
use virtio_bindings::bindings::virtio_blk::*;
|
use virtio_bindings::bindings::virtio_blk::*;
|
||||||
use vm_memory::{Bytes, GuestMemoryError, GuestMemoryMmap};
|
use vm_memory::{Bytes, GuestMemoryError, GuestMemoryMmap};
|
||||||
use vm_virtio::block::{build_disk_image_id, Request};
|
use vm_virtio::block::{build_disk_image_id, Request};
|
||||||
use std::{fmt, error, convert,io};
|
|
||||||
|
|
||||||
const QUEUE_SIZE: usize = 1024;
|
const QUEUE_SIZE: usize = 1024;
|
||||||
const SECTOR_SHIFT: u8 = 9;
|
const SECTOR_SHIFT: u8 = 9;
|
||||||
@ -63,6 +63,8 @@ pub enum Error {
|
|||||||
ParseReadOnlyParam,
|
ParseReadOnlyParam,
|
||||||
/// Failed parsing fs number of queues parameter.
|
/// Failed parsing fs number of queues parameter.
|
||||||
ParseBlkNumQueuesParam(std::num::ParseIntError),
|
ParseBlkNumQueuesParam(std::num::ParseIntError),
|
||||||
|
/// Failed to handle event other than input event.
|
||||||
|
HandleEventNotEpollIn,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
@ -214,8 +216,7 @@ impl VhostUserBackend for VhostUserBlkBackend {
|
|||||||
vrings: &[Arc<RwLock<Vring>>],
|
vrings: &[Arc<RwLock<Vring>>],
|
||||||
) -> VhostUserBackendResult<bool> {
|
) -> VhostUserBackendResult<bool> {
|
||||||
if evset != epoll::Events::EPOLLIN {
|
if evset != epoll::Events::EPOLLIN {
|
||||||
warn!("invalid events operation");
|
return Err(Error::HandleEventNotEpollIn.into());
|
||||||
return Ok(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("event received: {:?}", device_event);
|
debug!("event received: {:?}", device_event);
|
||||||
|
Loading…
Reference in New Issue
Block a user