mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-31 18:15:20 +00:00
vitio-devices: vhost_user: Factorize some part of the initialization
Introducing a new function to factorize a small part of the initialization that is shared between a full reinitialization and a restoration. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
71c7dff32b
commit
a636411522
@ -284,17 +284,10 @@ impl VhostUserHandle {
|
||||
self.vu.reset_owner().map_err(Error::VhostUserResetOwner)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn reinitialize_vhost_user<S: VhostUserMasterReqHandler>(
|
||||
pub fn set_protocol_features_vhost_user(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
queues: Vec<Queue>,
|
||||
queue_evts: Vec<EventFd>,
|
||||
virtio_interrupt: &Arc<dyn VirtioInterrupt>,
|
||||
acked_features: u64,
|
||||
acked_protocol_features: u64,
|
||||
slave_req_handler: &Option<MasterReqHandler<S>>,
|
||||
inflight: Option<&mut Inflight>,
|
||||
) -> Result<()> {
|
||||
self.vu.set_owner().map_err(Error::VhostUserSetOwner)?;
|
||||
self.vu
|
||||
@ -317,6 +310,23 @@ impl VhostUserHandle {
|
||||
|
||||
self.update_supports_migration(acked_features, acked_protocol_features);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn reinitialize_vhost_user<S: VhostUserMasterReqHandler>(
|
||||
&mut self,
|
||||
mem: &GuestMemoryMmap,
|
||||
queues: Vec<Queue>,
|
||||
queue_evts: Vec<EventFd>,
|
||||
virtio_interrupt: &Arc<dyn VirtioInterrupt>,
|
||||
acked_features: u64,
|
||||
acked_protocol_features: u64,
|
||||
slave_req_handler: &Option<MasterReqHandler<S>>,
|
||||
inflight: Option<&mut Inflight>,
|
||||
) -> Result<()> {
|
||||
self.set_protocol_features_vhost_user(acked_features, acked_protocol_features)?;
|
||||
|
||||
self.setup_vhost_user(
|
||||
mem,
|
||||
queues,
|
||||
|
Loading…
Reference in New Issue
Block a user