pub trait Backend {
Show 27 methods
// Required methods
fn set_owner(&mut self) -> Result<()>;
fn reset_owner(&mut self) -> Result<()>;
fn get_features(&mut self) -> Result<u64>;
fn set_features(&mut self, features: u64) -> Result<()>;
fn set_mem_table(
&mut self,
ctx: &[VhostUserMemoryRegion],
files: Vec<File>
) -> Result<()>;
fn set_vring_num(&mut self, index: u32, num: u32) -> Result<()>;
fn set_vring_addr(
&mut self,
index: u32,
flags: VhostUserVringAddrFlags,
descriptor: u64,
used: u64,
available: u64,
log: u64
) -> Result<()>;
fn set_vring_base(&mut self, index: u32, base: u32) -> Result<()>;
fn get_vring_base(&mut self, index: u32) -> Result<VhostUserVringState>;
fn set_vring_kick(&mut self, index: u8, fd: Option<File>) -> Result<()>;
fn set_vring_call(&mut self, index: u8, fd: Option<File>) -> Result<()>;
fn set_vring_err(&mut self, index: u8, fd: Option<File>) -> Result<()>;
fn get_protocol_features(&mut self) -> Result<VhostUserProtocolFeatures>;
fn set_protocol_features(&mut self, features: u64) -> Result<()>;
fn get_queue_num(&mut self) -> Result<u64>;
fn set_vring_enable(&mut self, index: u32, enable: bool) -> Result<()>;
fn get_config(
&mut self,
offset: u32,
size: u32,
flags: VhostUserConfigFlags
) -> Result<Vec<u8>>;
fn set_config(
&mut self,
offset: u32,
buf: &[u8],
flags: VhostUserConfigFlags
) -> Result<()>;
fn get_inflight_fd(
&mut self,
inflight: &VhostUserInflight
) -> Result<(VhostUserInflight, File)>;
fn set_inflight_fd(
&mut self,
inflight: &VhostUserInflight,
file: File
) -> Result<()>;
fn get_max_mem_slots(&mut self) -> Result<u64>;
fn add_mem_region(
&mut self,
region: &VhostUserSingleMemoryRegion,
fd: File
) -> Result<()>;
fn remove_mem_region(
&mut self,
region: &VhostUserSingleMemoryRegion
) -> Result<()>;
fn set_device_state_fd(
&mut self,
transfer_direction: VhostUserTransferDirection,
migration_phase: VhostUserMigrationPhase,
fd: File
) -> Result<Option<File>>;
fn check_device_state(&mut self) -> Result<()>;
fn get_shared_memory_regions(
&mut self
) -> Result<Vec<VhostSharedMemoryRegion>>;
// Provided method
fn set_backend_req_fd(&mut self, _vu_req: Connection<BackendReq>) { ... }
}
Expand description
Trait for vhost-user backends.
Each method corresponds to a vhost-user protocol method. See the specification for details.