From d169a8d9ed63ae33b8678821c9675963bcee3f92 Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Fri, 6 Oct 2017 15:26:46 -0700 Subject: Move crosvm/hw to a new devices module Moving the devices to their own module makes it easier to add tests that use them. Change-Id: I61bfef4037d16b20145b5fddce604835cdc4f67b Signed-off-by: Dylan Reid Reviewed-on: https://chromium-review.googlesource.com/706559 Reviewed-by: Zach Reizner --- devices/src/virtio/vhost/mod.rs | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 devices/src/virtio/vhost/mod.rs (limited to 'devices/src/virtio/vhost/mod.rs') diff --git a/devices/src/virtio/vhost/mod.rs b/devices/src/virtio/vhost/mod.rs new file mode 100644 index 0000000..1a45c5b --- /dev/null +++ b/devices/src/virtio/vhost/mod.rs @@ -0,0 +1,72 @@ +// Copyright 2017 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Implements vhost-based virtio devices. + +use std; + +use net_util::Error as TapError; +use sys_util::Error as SysError; +use vhost::Error as VhostError; + +mod net; +mod vsock; +mod worker; + +pub use self::net::Net; +pub use self::vsock::Vsock; + +#[derive(Debug)] +pub enum Error { + /// Creating kill eventfd failed. + CreateKillEventFd(SysError), + /// Cloning kill eventfd failed. + CloneKillEventFd(SysError), + /// Error while polling for events. + PollError(SysError), + /// Open tap device failed. + TapOpen(TapError), + /// Setting tap IP failed. + TapSetIp(TapError), + /// Setting tap netmask failed. + TapSetNetmask(TapError), + /// Setting tap interface offload flags failed. + TapSetOffload(TapError), + /// Setting vnet header size failed. + TapSetVnetHdrSize(TapError), + /// Enabling tap interface failed. + TapEnable(TapError), + /// Failed to open vhost device. + VhostOpen(VhostError), + /// Set owner failed. + VhostSetOwner(VhostError), + /// Get features failed. + VhostGetFeatures(VhostError), + /// Set features failed. + VhostSetFeatures(VhostError), + /// Set mem table failed. + VhostSetMemTable(VhostError), + /// Set vring num failed. + VhostSetVringNum(VhostError), + /// Set vring addr failed. + VhostSetVringAddr(VhostError), + /// Set vring base failed. + VhostSetVringBase(VhostError), + /// Set vring call failed. + VhostSetVringCall(VhostError), + /// Set vring kick failed. + VhostSetVringKick(VhostError), + /// Net set backend failed. + VhostNetSetBackend(VhostError), + /// Failed to set CID for guest. + VhostVsockSetCid(VhostError), + /// Failed to start vhost-vsock driver. + VhostVsockStart(VhostError), + /// Failed to create vhost eventfd. + VhostIrqCreate(SysError), + /// Failed to read vhost eventfd. + VhostIrqRead(SysError), +} + +pub type Result = std::result::Result; -- cgit 1.4.1