From 917e85a3d5d73edd4d2004d10724c7e6a63dce43 Mon Sep 17 00:00:00 2001 From: Sergio Lopez Date: Fri, 9 Sep 2022 10:12:33 +0200 Subject: [PATCH] Update dependencies and switch to caret versions Update libc, log, vhost, virtio-queue and vm-memory dependencies. Also, take this opportunity to specify the dependencies with caret versions. Switching to a newer vhost required some small changes to accommodate the fact that VhostUserError::InvalidOperation now requires an argument. Signed-off-by: Sergio Lopez --- Cargo.toml | 14 +++++++------- src/handler.rs | 10 ++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9b554c9..f26a30c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,16 +8,16 @@ edition = "2018" license = "Apache-2.0" [dependencies] -libc = ">=0.2.39" -log = ">=0.4.6" -vhost = { version = "0.4", features = ["vhost-user-slave"] } +libc = "0.2.39" +log = "0.4.17" +vhost = { version = "0.5", features = ["vhost-user-slave"] } virtio-bindings = "0.1" -virtio-queue = "0.5.0" -vm-memory = {version = ">=0.7", features = ["backend-mmap", "backend-atomic"]} +virtio-queue = "0.6" +vm-memory = { version = "0.9", features = ["backend-mmap", "backend-atomic"] } vmm-sys-util = "0.10" [dev-dependencies] nix = "0.25" -vhost = { version = "0.4", features = ["vhost-user-master", "vhost-user-slave"] } -vm-memory = {version = ">=0.7", features = ["backend-mmap", "backend-atomic", "backend-bitmap"]} +vhost = { version = "0.5", features = ["vhost-user-master", "vhost-user-slave"] } +vm-memory = { version = "0.9", features = ["backend-mmap", "backend-atomic", "backend-bitmap"] } tempfile = "3.2.0" diff --git a/src/handler.rs b/src/handler.rs index 0b3c417..41f8107 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -220,7 +220,7 @@ where { fn set_owner(&mut self) -> VhostUserResult<()> { if self.owned { - return Err(VhostUserError::InvalidOperation); + return Err(VhostUserError::InvalidOperation("already claimed")); } self.owned = true; Ok(()) @@ -456,7 +456,9 @@ where // This request should be handled only when VHOST_USER_F_PROTOCOL_FEATURES // has been negotiated. if self.acked_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits() == 0 { - return Err(VhostUserError::InvalidOperation); + return Err(VhostUserError::InvalidOperation( + "protocol features not set", + )); } else if index as usize >= self.num_queues { return Err(VhostUserError::InvalidParam); } @@ -505,7 +507,7 @@ where // Assume the backend hasn't negotiated the inflight feature; it // wouldn't be correct for the backend to do so, as we don't (yet) // provide a way for it to handle such requests. - Err(VhostUserError::InvalidOperation) + Err(VhostUserError::InvalidOperation("not supported")) } fn set_inflight_fd( @@ -513,7 +515,7 @@ where _inflight: &vhost::vhost_user::message::VhostUserInflight, _file: File, ) -> VhostUserResult<()> { - Err(VhostUserError::InvalidOperation) + Err(VhostUserError::InvalidOperation("not supported")) } fn get_max_mem_slots(&mut self) -> VhostUserResult {