mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 07:21:15 +00:00
vhost: Bump to latest version from upstream
Moving to the latest version of the rust-vmm/vhost crate, before it gets published on crates.io. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
30cd3cb764
commit
c27d6df233
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1303,7 +1303,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "vhost"
|
name = "vhost"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rust-vmm/vhost?branch=master#8c6919bf60bd641398ddd53864fbc74d75548837"
|
source = "git+https://github.com/rust-vmm/vhost?branch=master#576694bcfb09e7c78d812ed07dbc5377d283852a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.2.1",
|
"bitflags 1.2.1",
|
||||||
"libc",
|
"libc",
|
||||||
|
2
fuzz/Cargo.lock
generated
2
fuzz/Cargo.lock
generated
@ -692,7 +692,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "vhost"
|
name = "vhost"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/rust-vmm/vhost?branch=master#8c6919bf60bd641398ddd53864fbc74d75548837"
|
source = "git+https://github.com/rust-vmm/vhost?branch=master#576694bcfb09e7c78d812ed07dbc5377d283852a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -21,7 +21,7 @@ use vhost::vhost_user::message::{
|
|||||||
};
|
};
|
||||||
use vhost::vhost_user::{
|
use vhost::vhost_user::{
|
||||||
Error as VhostUserError, Listener, Result as VhostUserResult, SlaveFsCacheReq, SlaveListener,
|
Error as VhostUserError, Listener, Result as VhostUserResult, SlaveFsCacheReq, SlaveListener,
|
||||||
VhostUserSlaveReqHandler,
|
VhostUserSlaveReqHandlerMut,
|
||||||
};
|
};
|
||||||
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
||||||
use vm_memory::guest_memory::FileOffset;
|
use vm_memory::guest_memory::FileOffset;
|
||||||
@ -544,7 +544,7 @@ impl<S: VhostUserBackend> VhostUserHandler<S> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: VhostUserBackend> VhostUserSlaveReqHandler for VhostUserHandler<S> {
|
impl<S: VhostUserBackend> VhostUserSlaveReqHandlerMut for VhostUserHandler<S> {
|
||||||
fn set_owner(&mut self) -> VhostUserResult<()> {
|
fn set_owner(&mut self) -> VhostUserResult<()> {
|
||||||
if self.owned {
|
if self.owned {
|
||||||
return Err(VhostUserError::InvalidOperation);
|
return Err(VhostUserError::InvalidOperation);
|
||||||
|
@ -14,7 +14,7 @@ use seccomp::{SeccompAction, SeccompFilter};
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::os::unix::io::{AsRawFd, RawFd};
|
use std::os::unix::io::{AsRawFd, RawFd};
|
||||||
use std::result;
|
use std::result;
|
||||||
use std::sync::{Arc, Barrier, Mutex};
|
use std::sync::{Arc, Barrier};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use vhost::vhost_user::message::{
|
use vhost::vhost_user::message::{
|
||||||
VhostUserFSSlaveMsg, VhostUserFSSlaveMsgFlags, VhostUserProtocolFeatures,
|
VhostUserFSSlaveMsg, VhostUserFSSlaveMsgFlags, VhostUserProtocolFeatures,
|
||||||
@ -53,12 +53,12 @@ impl SlaveReqHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VhostUserMasterReqHandler for SlaveReqHandler {
|
impl VhostUserMasterReqHandler for SlaveReqHandler {
|
||||||
fn handle_config_change(&mut self) -> HandlerResult<u64> {
|
fn handle_config_change(&self) -> HandlerResult<u64> {
|
||||||
debug!("handle_config_change");
|
debug!("handle_config_change");
|
||||||
Ok(0)
|
Ok(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fs_slave_map(&mut self, fs: &VhostUserFSSlaveMsg, fd: RawFd) -> HandlerResult<u64> {
|
fn fs_slave_map(&self, fs: &VhostUserFSSlaveMsg, fd: RawFd) -> HandlerResult<u64> {
|
||||||
debug!("fs_slave_map");
|
debug!("fs_slave_map");
|
||||||
|
|
||||||
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
||||||
@ -98,7 +98,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
Ok(0)
|
Ok(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fs_slave_unmap(&mut self, fs: &VhostUserFSSlaveMsg) -> HandlerResult<u64> {
|
fn fs_slave_unmap(&self, fs: &VhostUserFSSlaveMsg) -> HandlerResult<u64> {
|
||||||
debug!("fs_slave_unmap");
|
debug!("fs_slave_unmap");
|
||||||
|
|
||||||
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
||||||
@ -139,7 +139,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
Ok(0)
|
Ok(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fs_slave_sync(&mut self, fs: &VhostUserFSSlaveMsg) -> HandlerResult<u64> {
|
fn fs_slave_sync(&self, fs: &VhostUserFSSlaveMsg) -> HandlerResult<u64> {
|
||||||
debug!("fs_slave_sync");
|
debug!("fs_slave_sync");
|
||||||
|
|
||||||
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
for i in 0..VHOST_USER_FS_SLAVE_ENTRIES {
|
||||||
@ -166,7 +166,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
Ok(0)
|
Ok(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fs_slave_io(&mut self, fs: &VhostUserFSSlaveMsg, fd: RawFd) -> HandlerResult<u64> {
|
fn fs_slave_io(&self, fs: &VhostUserFSSlaveMsg, fd: RawFd) -> HandlerResult<u64> {
|
||||||
debug!("fs_slave_io");
|
debug!("fs_slave_io");
|
||||||
|
|
||||||
let mut done: u64 = 0;
|
let mut done: u64 = 0;
|
||||||
@ -438,16 +438,18 @@ impl VirtioDevice for Fs {
|
|||||||
// Initialize slave communication.
|
// Initialize slave communication.
|
||||||
let slave_req_handler = if self.slave_req_support {
|
let slave_req_handler = if self.slave_req_support {
|
||||||
if let Some(cache) = self.cache.as_ref() {
|
if let Some(cache) = self.cache.as_ref() {
|
||||||
let vu_master_req_handler = Arc::new(Mutex::new(SlaveReqHandler {
|
let vu_master_req_handler = Arc::new(SlaveReqHandler {
|
||||||
cache_offset: cache.0.addr,
|
cache_offset: cache.0.addr,
|
||||||
cache_size: cache.0.len,
|
cache_size: cache.0.len,
|
||||||
mmap_cache_addr: cache.0.host_addr,
|
mmap_cache_addr: cache.0.host_addr,
|
||||||
mem,
|
mem,
|
||||||
}));
|
});
|
||||||
|
|
||||||
let req_handler = MasterReqHandler::new(vu_master_req_handler).map_err(|e| {
|
let mut req_handler =
|
||||||
ActivateError::VhostUserSetup(Error::MasterReqHandlerCreation(e))
|
MasterReqHandler::new(vu_master_req_handler).map_err(|e| {
|
||||||
})?;
|
ActivateError::VhostUserSetup(Error::MasterReqHandlerCreation(e))
|
||||||
|
})?;
|
||||||
|
req_handler.set_reply_ack_flag(true);
|
||||||
self.vu
|
self.vu
|
||||||
.set_slave_request_fd(req_handler.get_tx_raw_fd())
|
.set_slave_request_fd(req_handler.get_tx_raw_fd())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
Loading…
Reference in New Issue
Block a user