mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-19 02:55: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)
|
self.vu.reset_owner().map_err(Error::VhostUserResetOwner)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
pub fn set_protocol_features_vhost_user(
|
||||||
pub fn reinitialize_vhost_user<S: VhostUserMasterReqHandler>(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
mem: &GuestMemoryMmap,
|
|
||||||
queues: Vec<Queue>,
|
|
||||||
queue_evts: Vec<EventFd>,
|
|
||||||
virtio_interrupt: &Arc<dyn VirtioInterrupt>,
|
|
||||||
acked_features: u64,
|
acked_features: u64,
|
||||||
acked_protocol_features: u64,
|
acked_protocol_features: u64,
|
||||||
slave_req_handler: &Option<MasterReqHandler<S>>,
|
|
||||||
inflight: Option<&mut Inflight>,
|
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.vu.set_owner().map_err(Error::VhostUserSetOwner)?;
|
self.vu.set_owner().map_err(Error::VhostUserSetOwner)?;
|
||||||
self.vu
|
self.vu
|
||||||
@ -317,6 +310,23 @@ impl VhostUserHandle {
|
|||||||
|
|
||||||
self.update_supports_migration(acked_features, acked_protocol_features);
|
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(
|
self.setup_vhost_user(
|
||||||
mem,
|
mem,
|
||||||
queues,
|
queues,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user