From fa8fcf5f4cbf9c49e830322aec2983d4005d312a Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 25 Feb 2021 10:46:27 +0100 Subject: [PATCH] vhost: Move to upstream crate The vhost crate from rust-vmm is ready, which is why we do the switch from the Cloud Hypervisor fork to the upstream crate. At the same time, we rename the crate from vhost_rs to vhost. Signed-off-by: Sebastien Boeuf --- Cargo.lock | 2 +- Cargo.toml | 3 --- vhost_user_backend/Cargo.toml | 2 +- vhost_user_backend/src/lib.rs | 4 ++-- vhost_user_block/Cargo.toml | 2 +- vhost_user_block/src/lib.rs | 6 +++--- vhost_user_net/Cargo.toml | 2 +- vhost_user_net/src/lib.rs | 6 +++--- virtio-devices/Cargo.toml | 2 +- virtio-devices/src/lib.rs | 2 +- virtio-devices/src/vhost_user/blk.rs | 10 +++++----- virtio-devices/src/vhost_user/fs.rs | 6 +++--- virtio-devices/src/vhost_user/handler.rs | 2 +- virtio-devices/src/vhost_user/mod.rs | 10 +++++----- virtio-devices/src/vhost_user/net.rs | 6 +++--- virtio-devices/src/vhost_user/vu_common_ctrl.rs | 4 ++-- 16 files changed, 33 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d5d8670c..332c3457d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1338,7 +1338,7 @@ dependencies = [ [[package]] name = "vhost" version = "0.1.0" -source = "git+https://github.com/cloud-hypervisor/vhost?branch=ch#6fc980bf5083d67586ab91d6a965c3a593c33a78" +source = "git+https://github.com/rust-vmm/vhost?branch=master#8c6919bf60bd641398ddd53864fbc74d75548837" dependencies = [ "bitflags 1.2.1", "libc", diff --git a/Cargo.toml b/Cargo.toml index cadde480b..084bfffc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,9 +34,6 @@ vm-memory = "0.5.0" clap = { version = "2.33.3", features = ["wrap_help"] } # List of patched crates -[patch.'https://github.com/rust-vmm/vhost'] -vhost_rs = { git = "https://github.com/cloud-hypervisor/vhost", branch = "ch", package = "vhost", features = ["vhost-user-master", "vhost-user-slave"] } - [patch.crates-io] kvm-bindings = { git = "https://github.com/cloud-hypervisor/kvm-bindings", branch = "ch", features = ["with-serde", "fam-wrappers"] } kvm-ioctls = { git = "https://github.com/cloud-hypervisor/kvm-ioctls", branch = "ch" } diff --git a/vhost_user_backend/Cargo.toml b/vhost_user_backend/Cargo.toml index 0b1ad6303..76ddaf1cd 100644 --- a/vhost_user_backend/Cargo.toml +++ b/vhost_user_backend/Cargo.toml @@ -15,4 +15,4 @@ virtio-bindings = "0.1.0" vm-memory = "0.5.0" vm-virtio = { path = "../vm-virtio" } vmm-sys-util = ">=0.3.1" -vhost_rs = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-slave"] } +vhost = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-slave"] } diff --git a/vhost_user_backend/src/lib.rs b/vhost_user_backend/src/lib.rs index f627e5d7f..b2290bb47 100644 --- a/vhost_user_backend/src/lib.rs +++ b/vhost_user_backend/src/lib.rs @@ -15,11 +15,11 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; use std::result; use std::sync::{Arc, Mutex, RwLock}; use std::thread; -use vhost_rs::vhost_user::message::{ +use vhost::vhost_user::message::{ VhostUserConfigFlags, VhostUserMemoryRegion, VhostUserProtocolFeatures, VhostUserVirtioFeatures, VhostUserVringAddrFlags, VhostUserVringState, }; -use vhost_rs::vhost_user::{ +use vhost::vhost_user::{ Error as VhostUserError, Listener, Result as VhostUserResult, SlaveFsCacheReq, SlaveListener, VhostUserSlaveReqHandler, }; diff --git a/vhost_user_block/Cargo.toml b/vhost_user_block/Cargo.toml index 2b64dd071..748dbb734 100644 --- a/vhost_user_block/Cargo.toml +++ b/vhost_user_block/Cargo.toml @@ -13,7 +13,7 @@ log = "0.4.14" option_parser = { path = "../option_parser" } qcow = { path = "../qcow" } vhost_user_backend = { path = "../vhost_user_backend" } -vhost_rs = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-slave"] } +vhost = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-slave"] } virtio-bindings = "0.1.0" vm-memory = "0.5.0" vmm-sys-util = ">=0.3.1" diff --git a/vhost_user_block/src/lib.rs b/vhost_user_block/src/lib.rs index 6754e2d7a..2a1d24ec1 100644 --- a/vhost_user_block/src/lib.rs +++ b/vhost_user_block/src/lib.rs @@ -10,7 +10,7 @@ extern crate block_util; extern crate log; -extern crate vhost_rs; +extern crate vhost; extern crate vhost_user_backend; use block_util::{build_disk_image_id, Request, VirtioBlockConfig}; @@ -33,8 +33,8 @@ use std::sync::{Arc, Mutex, RwLock}; use std::time::Instant; use std::vec::Vec; use std::{convert, error, fmt, io}; -use vhost_rs::vhost_user::message::*; -use vhost_rs::vhost_user::Listener; +use vhost::vhost_user::message::*; +use vhost::vhost_user::Listener; use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring}; use virtio_bindings::bindings::virtio_blk::*; use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX; diff --git a/vhost_user_net/Cargo.toml b/vhost_user_net/Cargo.toml index cd84df207..20ca71c6e 100644 --- a/vhost_user_net/Cargo.toml +++ b/vhost_user_net/Cargo.toml @@ -12,7 +12,7 @@ log = "0.4.14" net_util = { path = "../net_util" } option_parser = { path = "../option_parser" } vhost_user_backend = { path = "../vhost_user_backend" } -vhost_rs = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-slave"] } +vhost = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-slave"] } virtio-bindings = "0.1.0" vm-memory = "0.5.0" vmm-sys-util = ">=0.3.1" diff --git a/vhost_user_net/src/lib.rs b/vhost_user_net/src/lib.rs index e3ec4242b..0b91772f7 100644 --- a/vhost_user_net/src/lib.rs +++ b/vhost_user_net/src/lib.rs @@ -8,7 +8,7 @@ extern crate log; extern crate net_util; -extern crate vhost_rs; +extern crate vhost; extern crate vhost_user_backend; use libc::{self, EFD_NONBLOCK}; @@ -24,8 +24,8 @@ use std::os::unix::io::AsRawFd; use std::process; use std::sync::{Arc, Mutex, RwLock}; use std::vec::Vec; -use vhost_rs::vhost_user::message::*; -use vhost_rs::vhost_user::{Error as VhostUserError, Listener}; +use vhost::vhost_user::message::*; +use vhost::vhost_user::{Error as VhostUserError, Listener}; use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring, VringWorker}; use virtio_bindings::bindings::virtio_net::*; use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX; diff --git a/virtio-devices/Cargo.toml b/virtio-devices/Cargo.toml index 0636feb42..1ae6bf521 100644 --- a/virtio-devices/Cargo.toml +++ b/virtio-devices/Cargo.toml @@ -25,7 +25,7 @@ seccomp = { git = "https://github.com/firecracker-microvm/firecracker", tag = "v serde = ">=1.0.27" serde_derive = ">=1.0.27" serde_json = ">=1.0.9" -vhost_rs = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-master", "vhost-user-slave"] } +vhost = { git = "https://github.com/rust-vmm/vhost", branch = "master", package = "vhost", features = ["vhost-user-master", "vhost-user-slave"] } virtio-bindings = { version = "0.1", features = ["virtio-v5_0_0"]} vm-allocator = { path = "../vm-allocator" } vm-device = { path = "../vm-device" } diff --git a/virtio-devices/src/lib.rs b/virtio-devices/src/lib.rs index fa1892478..05bdc6a3f 100644 --- a/virtio-devices/src/lib.rs +++ b/virtio-devices/src/lib.rs @@ -21,7 +21,7 @@ extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; -extern crate vhost_rs; +extern crate vhost; extern crate virtio_bindings; extern crate vm_device; extern crate vm_memory; diff --git a/virtio-devices/src/vhost_user/blk.rs b/virtio-devices/src/vhost_user/blk.rs index e33f26446..b86c29473 100644 --- a/virtio-devices/src/vhost_user/blk.rs +++ b/virtio-devices/src/vhost_user/blk.rs @@ -17,11 +17,11 @@ use std::result; use std::sync::{Arc, Barrier}; use std::thread; use std::vec::Vec; -use vhost_rs::vhost_user::message::VhostUserConfigFlags; -use vhost_rs::vhost_user::message::VHOST_USER_CONFIG_OFFSET; -use vhost_rs::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures}; -use vhost_rs::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler}; -use vhost_rs::VhostBackend; +use vhost::vhost_user::message::VhostUserConfigFlags; +use vhost::vhost_user::message::VHOST_USER_CONFIG_OFFSET; +use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures}; +use vhost::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler}; +use vhost::VhostBackend; use virtio_bindings::bindings::virtio_blk::*; use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX; use vm_memory::{ByteValued, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryMmap}; diff --git a/virtio-devices/src/vhost_user/fs.rs b/virtio-devices/src/vhost_user/fs.rs index 4dea49fe4..c9958824e 100644 --- a/virtio-devices/src/vhost_user/fs.rs +++ b/virtio-devices/src/vhost_user/fs.rs @@ -16,14 +16,14 @@ use std::os::unix::io::{AsRawFd, RawFd}; use std::result; use std::sync::{Arc, Barrier, Mutex}; use std::thread; -use vhost_rs::vhost_user::message::{ +use vhost::vhost_user::message::{ VhostUserFSSlaveMsg, VhostUserFSSlaveMsgFlags, VhostUserProtocolFeatures, VhostUserVirtioFeatures, VHOST_USER_FS_SLAVE_ENTRIES, }; -use vhost_rs::vhost_user::{ +use vhost::vhost_user::{ HandlerResult, Master, MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler, }; -use vhost_rs::VhostBackend; +use vhost::VhostBackend; use vm_memory::{ Address, ByteValued, GuestAddress, GuestAddressSpace, GuestMemory, GuestMemoryAtomic, GuestMemoryMmap, MmapRegion, diff --git a/virtio-devices/src/vhost_user/handler.rs b/virtio-devices/src/vhost_user/handler.rs index cc2bb7c8c..6ca21ae1b 100644 --- a/virtio-devices/src/vhost_user/handler.rs +++ b/virtio-devices/src/vhost_user/handler.rs @@ -18,7 +18,7 @@ use crate::VirtioInterrupt; use std::os::unix::io::AsRawFd; use std::sync::atomic::AtomicBool; use std::sync::{Arc, Barrier}; -use vhost_rs::vhost_user::{MasterReqHandler, VhostUserMasterReqHandler}; +use vhost::vhost_user::{MasterReqHandler, VhostUserMasterReqHandler}; /// Collection of common parameters required by vhost-user devices while /// call Epoll handler. diff --git a/virtio-devices/src/vhost_user/mod.rs b/virtio-devices/src/vhost_user/mod.rs index c074689d0..a75415bd1 100644 --- a/virtio-devices/src/vhost_user/mod.rs +++ b/virtio-devices/src/vhost_user/mod.rs @@ -3,12 +3,12 @@ extern crate epoll; extern crate net_util; -extern crate vhost_rs; +extern crate vhost; extern crate virtio_bindings; extern crate vm_memory; use std::io; -use vhost_rs::Error as VhostError; +use vhost::Error as VhostError; use vm_memory::Error as MmapError; pub mod blk; @@ -43,7 +43,7 @@ pub enum Error { /// Failed to open vhost device. VhostUserOpen(VhostError), /// Connection to socket failed. - VhostUserConnect(vhost_rs::Error), + VhostUserConnect(vhost::Error), /// Get features failed. VhostUserGetFeatures(VhostError), /// Get queue max number failed. @@ -81,9 +81,9 @@ pub enum Error { /// Failed to read vhost eventfd. VhostUserMemoryRegion(MmapError), /// Failed to create the master request handler from slave. - MasterReqHandlerCreation(vhost_rs::vhost_user::Error), + MasterReqHandlerCreation(vhost::vhost_user::Error), /// Set slave request fd failed. - VhostUserSetSlaveRequestFd(vhost_rs::Error), + VhostUserSetSlaveRequestFd(vhost::Error), /// Invalid used address. UsedAddress, /// Invalid features provided from vhost-user backend diff --git a/virtio-devices/src/vhost_user/net.rs b/virtio-devices/src/vhost_user/net.rs index 4f4a1b55b..f55667593 100644 --- a/virtio-devices/src/vhost_user/net.rs +++ b/virtio-devices/src/vhost_user/net.rs @@ -19,9 +19,9 @@ use std::result; use std::sync::{Arc, Barrier}; use std::thread; use std::vec::Vec; -use vhost_rs::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures}; -use vhost_rs::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler}; -use vhost_rs::VhostBackend; +use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures}; +use vhost::vhost_user::{Master, VhostUserMaster, VhostUserMasterReqHandler}; +use vhost::VhostBackend; use virtio_bindings::bindings::virtio_net; use virtio_bindings::bindings::virtio_ring; use vm_memory::{ByteValued, GuestAddressSpace, GuestMemoryAtomic, GuestMemoryMmap}; diff --git a/virtio-devices/src/vhost_user/vu_common_ctrl.rs b/virtio-devices/src/vhost_user/vu_common_ctrl.rs index 791122717..567d3a60c 100644 --- a/virtio-devices/src/vhost_user/vu_common_ctrl.rs +++ b/virtio-devices/src/vhost_user/vu_common_ctrl.rs @@ -9,8 +9,8 @@ use std::convert::TryInto; use std::os::unix::io::AsRawFd; use std::sync::Arc; use std::vec::Vec; -use vhost_rs::vhost_user::{Master, VhostUserMaster}; -use vhost_rs::{VhostBackend, VhostUserMemoryRegionInfo, VringConfigData}; +use vhost::vhost_user::{Master, VhostUserMaster}; +use vhost::{VhostBackend, VhostUserMemoryRegionInfo, VringConfigData}; use vm_memory::{Address, Error as MmapError, GuestMemory, GuestMemoryMmap, GuestMemoryRegion}; use vmm_sys_util::eventfd::EventFd;