Struct vhost::vsock::Vsock

source ·
pub struct Vsock {
    descriptor: File,
}
Expand description

Handle for running VHOST_VSOCK ioctls.

Fields§

§descriptor: File

Implementations§

source§

impl Vsock

source

pub fn new(vhost_vsock_file: File) -> Vsock

Open a handle to a new VHOST_VSOCK instance.

source

pub fn set_cid(&self, cid: u64) -> Result<()>

Set the CID for the guest. This number is used for routing all data destined for programs running in the guest.

§Arguments
  • cid - CID to assign to the guest
source

pub fn start(&self) -> Result<()>

Tell the VHOST driver to start performing data transfer.

source

pub fn stop(&self) -> Result<()>

Tell the VHOST driver to stop performing data transfer.

source

fn set_running(&self, running: bool) -> Result<()>

Trait Implementations§

source§

impl AsRawDescriptor for Vsock

source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. Read more
source§

impl Vhost for Vsock

source§

fn set_owner(&self) -> Result<()>

Set the current process as the owner of this file descriptor. This must be run before any other vhost ioctls.
source§

fn reset_owner(&self) -> Result<()>

Give up ownership and reset the device to default values. Allows a subsequent call to set_owner to succeed.
source§

fn get_features(&self) -> Result<u64>

Get a bitmask of supported virtio/vhost features.
source§

fn set_features(&self, features: u64) -> Result<()>

Inform the vhost subsystem which features to enable. This should be a subset of supported features from VHOST_GET_FEATURES. Read more
source§

fn set_mem_table(&self, mem: &GuestMemory) -> Result<()>

Set the guest memory mappings for vhost to use.
source§

fn set_vring_num(&self, queue_index: usize, num: u16) -> Result<()>

Set the number of descriptors in the vring. Read more
source§

fn set_vring_addr( &self, mem: &GuestMemory, queue_max_size: u16, queue_size: u16, queue_index: usize, flags: u32, desc_addr: GuestAddress, used_addr: GuestAddress, avail_addr: GuestAddress, log_addr: Option<GuestAddress> ) -> Result<()>

Set the addresses for a given vring. Read more
source§

fn set_vring_base(&self, queue_index: usize, num: u16) -> Result<()>

Set the first index to look for available descriptors. Read more
source§

fn get_vring_base(&self, queue_index: usize) -> Result<u16>

Gets the index of the next available descriptor in the queue. Read more
source§

fn set_vring_call(&self, queue_index: usize, event: &Event) -> Result<()>

Set the event to trigger when buffers have been used by the host. Read more
source§

fn set_vring_err(&self, queue_index: usize, event: &Event) -> Result<()>

Set the event to trigger to signal an error. Read more
source§

fn set_vring_kick(&self, queue_index: usize, event: &Event) -> Result<()>

Set the event that will be signaled by the guest when buffers are available for the host to process. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Vsock

§

impl Send for Vsock

§

impl Sync for Vsock

§

impl Unpin for Vsock

§

impl UnwindSafe for Vsock

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsRawDescriptors for T
where T: AsRawDescriptor,

§

fn as_raw_descriptors(&self) -> Vec<i32>

Returns the underlying raw descriptors. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.