mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
warning: name `ConvertFromUTF8` contains a capitalized acronym --> virtio-devices/src/vsock/unix/mod.rs:32:5 | 32 | ConvertFromUTF8(std::str::Utf8Error), | ^^^^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `ConvertFromUtf8` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms Signed-off-by: Rob Bradford <robert.bradford@intel.com>
57 lines
2.0 KiB
Rust
57 lines
2.0 KiB
Rust
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
/// This module implements the Unix Domain Sockets backend for vsock - a mediator between
|
|
/// guest-side AF_VSOCK sockets and host-side AF_UNIX sockets. The heavy lifting is performed by
|
|
/// `muxer::VsockMuxer`, a connection multiplexer that uses `super::csm::VsockConnection` for
|
|
/// handling vsock connection states.
|
|
/// Check out `muxer.rs` for a more detailed explanation of the inner workings of this backend.
|
|
///
|
|
mod muxer;
|
|
mod muxer_killq;
|
|
mod muxer_rxq;
|
|
|
|
pub use muxer::VsockMuxer as VsockUnixBackend;
|
|
pub use Error as VsockUnixError;
|
|
|
|
mod defs {
|
|
/// Maximum number of established connections that we can handle.
|
|
pub const MAX_CONNECTIONS: usize = 1023;
|
|
|
|
/// Size of the muxer RX packet queue.
|
|
pub const MUXER_RXQ_SIZE: usize = 256;
|
|
|
|
/// Size of the muxer connection kill queue.
|
|
pub const MUXER_KILLQ_SIZE: usize = 128;
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
/// Error converting from UTF-8
|
|
ConvertFromUtf8(std::str::Utf8Error),
|
|
/// Error registering a new epoll-listening FD.
|
|
EpollAdd(std::io::Error),
|
|
/// Error creating an epoll FD.
|
|
EpollFdCreate(std::io::Error),
|
|
/// The host made an invalid vsock port connection request.
|
|
InvalidPortRequest,
|
|
/// Error parsing integer.
|
|
ParseInteger(std::num::ParseIntError),
|
|
/// Error reading stream port.
|
|
ReadStreamPort(Box<Error>),
|
|
/// Error accepting a new connection from the host-side Unix socket.
|
|
UnixAccept(std::io::Error),
|
|
/// Error binding to the host-side Unix socket.
|
|
UnixBind(std::io::Error),
|
|
/// Error connecting to a host-side Unix socket.
|
|
UnixConnect(std::io::Error),
|
|
/// Error reading from host-side Unix socket.
|
|
UnixRead(std::io::Error),
|
|
/// Muxer connection limit reached.
|
|
TooManyConnections,
|
|
}
|
|
|
|
type Result<T> = std::result::Result<T, Error>;
|
|
type MuxerConnection = super::csm::VsockConnection<std::os::unix::net::UnixStream>;
|