// Copyright 2019 Intel Corporation. All Rights Reserved. // Copyright 2020 Alyssa Ross // SPDX-License-Identifier: Apache-2.0 pub mod cloud_hypervisor; mod handler; mod net; mod vu_common_ctrl; pub use net::Net; pub use vu_common_ctrl::VhostUserConfig; use std::io; use sys_util::guest_memory; use vhost_rs::Error as VhostError; use vm_memory::Error as MmapError; #[derive(Debug)] pub enum Error { /// Invalid available address. AvailAddress(guest_memory::Error), /// Queue number is not correct BadQueueNum, /// Creating kill eventfd failed. CreateKillEventFd(io::Error), /// Cloning kill eventfd failed. CloneKillEventFd(io::Error), /// Invalid descriptor table address. DescriptorTableAddress(guest_memory::Error), /// Create Epoll eventfd failed EpollCreateFd(io::Error), /// Epoll ctl error EpollCtl(io::Error), /// Epoll wait error EpollWait(io::Error), /// Read queue failed. FailedReadingQueue(io::Error), /// Signal used queue failed. FailedSignalingUsedQueue(io::Error), /// Failed to read vhost eventfd. MemoryRegions(MmapError), /// Failed to create master. VhostUserCreateMaster(VhostError), /// Failed to open vhost device. VhostUserOpen(VhostError), /// Get features failed. VhostUserGetFeatures(VhostError), /// Get protocol features failed. VhostUserGetProtocolFeatures(VhostError), /// Vhost-user Backend not support vhost-user protocol. VhostUserProtocolNotSupport, /// Set owner failed. VhostUserSetOwner(VhostError), /// Set features failed. VhostUserSetFeatures(VhostError), /// Set protocol features failed. VhostUserSetProtocolFeatures(VhostError), /// Set mem table failed. VhostUserSetMemTable(VhostError), /// Set vring num failed. VhostUserSetVringNum(VhostError), /// Set vring addr failed. VhostUserSetVringAddr(VhostError), /// Set vring base failed. VhostUserSetVringBase(VhostError), /// Set vring call failed. VhostUserSetVringCall(VhostError), /// Set vring kick failed. VhostUserSetVringKick(VhostError), /// Set vring enable failed. VhostUserSetVringEnable(VhostError), /// Vhost-user setup vring failed. VhostUserSetupVringFailed, /// Failed to create vhost eventfd. VhostIrqCreate(std::io::Error), /// Failed to read vhost eventfd. VhostIrqRead(io::Error), /// Failed to read vhost eventfd. VhostUserMemoryRegion(MmapError), /// Invalid used address. UsedAddress(guest_memory::Error), } type Result = std::result::Result;