diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2024-02-06 11:43:21 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-02-06 11:43:21 +0000 |
commit | b5c00eb2283025bfcf4365bce20c6e1c5469cc15 (patch) | |
tree | 67534458d5ef8dd2a6dccc10a0d1c328afaed423 | |
parent | b633725a58e4592cdd7916297e50bf7b42748374 (diff) | |
parent | 5f6d8f6f393df674d5056410c14794388efcb301 (diff) | |
download | virtio-queue-main.tar.gz |
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/virtio-queue/+/2950372
Change-Id: Ic2f8feebb949f737fc04a8c0032b79476e2969b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .cargo_vcs_info.json | 4 | ||||
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | CHANGELOG.md | 23 | ||||
-rw-r--r-- | Cargo.toml | 14 | ||||
-rw-r--r-- | Cargo.toml.orig | 14 | ||||
-rw-r--r-- | LICENSE-BSD-3-Clause | 27 | ||||
-rw-r--r-- | LICENSE_APACHE | 30 | ||||
-rw-r--r-- | METADATA | 21 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | src/mock.rs | 15 |
10 files changed, 65 insertions, 89 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 3486f5b..4133f58 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "854e098e4871f2ea487b1853bc21f02d6c1e8057" + "sha1": "a6365caae501c57acb22e6227a4659ffec328ea5" }, - "path_in_vcs": "crates/virtio-queue" + "path_in_vcs": "virtio-queue" }
\ No newline at end of file @@ -5,7 +5,7 @@ rust_library_host { name: "libvirtio_queue", crate_name: "virtio_queue", cargo_env_compat: true, - cargo_pkg_version: "0.9.0", + cargo_pkg_version: "0.11.0", srcs: ["src/lib.rs"], edition: "2021", rustlibs: [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 74f074a..6815552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +# Upcoming + +# v0.11.0 + +## Changed +- Updated vm-memory from 0.13.1 to 0.14.0 +- Updated vmm-sys-util from 0.11.0 to 0.12.1 + +# v0.10.0 + +Identical to v0.9.1, which was incorrectly published as minor release. + +# v0.9.1 - yanked + +This version got yanked. It should have been a major release. The vm-memory +dependency - which received a major bump - is part of the public interface. + +## Changed +- Updated vm-memory from 0.12.0 to 0.13.1. +- Updated dev-dependencies: + - criterion (0.3.0 -> 0.5.1) + - memoffset (0.7.1 -> 0.9.0) + # v0.9.0 ## Changed @@ -12,7 +12,7 @@ [package] edition = "2021" name = "virtio-queue" -version = "0.9.0" +version = "0.11.0" authors = ["The Chromium OS Authors"] description = "virtio queue implementation" readme = "README.md" @@ -29,22 +29,22 @@ harness = false version = "0.4.17" [dependencies.virtio-bindings] -version = "0.2.1" +version = "0.2.2" [dependencies.vm-memory] -version = "0.12.0" +version = "0.14.0" [dependencies.vmm-sys-util] -version = "0.11.0" +version = "0.12.1" [dev-dependencies.criterion] -version = "0.3.0" +version = "0.5.1" [dev-dependencies.memoffset] -version = "0.7.1" +version = "0.9.0" [dev-dependencies.vm-memory] -version = "0.12.0" +version = "0.14.0" features = [ "backend-mmap", "backend-atomic", diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 79ba46f..15fdbc3 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "virtio-queue" -version = "0.9.0" +version = "0.11.0" authors = ["The Chromium OS Authors"] description = "virtio queue implementation" repository = "https://github.com/rust-vmm/vm-virtio" @@ -13,15 +13,15 @@ edition = "2021" test-utils = [] [dependencies] -vm-memory = "0.12.0" -vmm-sys-util = "0.11.0" +vm-memory = "0.14.0" +vmm-sys-util = "0.12.1" log = "0.4.17" -virtio-bindings = { path="../virtio-bindings", version = "0.2.1" } +virtio-bindings = { path="../virtio-bindings", version = "0.2.2" } [dev-dependencies] -criterion = "0.3.0" -vm-memory = { version = "0.12.0", features = ["backend-mmap", "backend-atomic"] } -memoffset = "0.7.1" +criterion = "0.5.1" +vm-memory = { version = "0.14.0", features = ["backend-mmap", "backend-atomic"] } +memoffset = "0.9.0" [[bench]] name = "main" diff --git a/LICENSE-BSD-3-Clause b/LICENSE-BSD-3-Clause deleted file mode 100644 index 8bafca3..0000000 --- a/LICENSE-BSD-3-Clause +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Chromium OS Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSE_APACHE b/LICENSE_APACHE deleted file mode 100644 index ebfb55c..0000000 --- a/LICENSE_APACHE +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Chromium OS Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - @@ -1,19 +1,24 @@ +# This project was upgraded with external_updater. +# Usage: tools/external_updater/updater.sh update external/rust/crates/virtio-queue +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md + name: "virtio-queue" description: "virtio queue implementation" third_party { + license_type: NOTICE + last_upgrade_date { + year: 2024 + month: 2 + day: 6 + } identifier { type: "crates.io" - value: "https://crates.io/crates/virtio-queue" + value: "https://static.crates.io/crates/virtio-queue/virtio-queue-0.11.0.crate" + version: "0.9.0" } identifier { type: "Archive" value: "https://static.crates.io/crates/virtio-queue/virtio-queue-0.9.0.crate" - } - version: "0.9.0" - license_type: NOTICE - last_upgrade_date { - year: 2023 - month: 8 - day: 23 + version: "0.11.0" } } @@ -105,7 +105,7 @@ following, as showed in the diagram below as well: 10. the device sends a used buffer notification to the driver if such notifications are not suppressed. -![queue](https://raw.githubusercontent.com/rust-vmm/vm-virtio/main/crates/virtio-queue/docs/images/queue.png) +![queue](https://raw.githubusercontent.com/rust-vmm/vm-virtio/main/virtio-queue/docs/images/queue.png) A descriptor is storing four fields, with the first two, `addr` and `len`, pointing to the data in memory to which the descriptor refers, as shown in the @@ -114,7 +114,7 @@ buffer is device readable or writable, or if we have another descriptor chained after this one (VIRTQ_DESC_F_NEXT flag set). `next` field is storing the index of the next descriptor if VIRTQ_DESC_F_NEXT is set. -![descriptor](https://raw.githubusercontent.com/rust-vmm/vm-virtio/main/crates/virtio-queue/docs/images/descriptor.png) +![descriptor](https://raw.githubusercontent.com/rust-vmm/vm-virtio/main/virtio-queue/docs/images/descriptor.png) **Requirements for device implementation** diff --git a/src/mock.rs b/src/mock.rs index d026f80..1f43588 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -7,7 +7,9 @@ use std::marker::PhantomData; use std::mem::size_of; -use vm_memory::{Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestUsize}; +use vm_memory::{ + Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestMemoryError, GuestUsize, +}; use crate::defs::{VIRTQ_AVAIL_ELEMENT_SIZE, VIRTQ_AVAIL_RING_HEADER_SIZE}; use crate::{Descriptor, DescriptorChain, Error, Queue, QueueOwnedT, QueueT, VirtqUsedElem}; @@ -23,6 +25,8 @@ pub enum MockError { InvalidIndex, /// Invalid next avail InvalidNextAvail, + /// Guest memory errors + GuestMem(GuestMemoryError), } impl Display for MockError { @@ -39,6 +43,7 @@ impl Display for MockError { f, "invalid next available descriptor chain head in the queue" ), + GuestMem(e) => write!(f, "guest memory error: {}", e), } } } @@ -425,7 +430,7 @@ impl<'a, M: GuestMemory> MockSplitQueue<'a, M> { self.create_queue::<Queue>() .map_err(MockError::InvalidQueueParams)? .iter(self.mem) - .unwrap() + .map_err(MockError::InvalidQueueParams)? .next() .ok_or(MockError::InvalidNextAvail) } @@ -466,7 +471,7 @@ impl<'a, M: GuestMemory> MockSplitQueue<'a, M> { .mem .read_obj::<u16>(self.avail_addr().unchecked_add(2)) .map(u16::from_le) - .unwrap(); + .map_err(MockError::GuestMem)?; for (idx, desc) in descs.iter().enumerate() { let i = idx as u16 + offset; @@ -482,7 +487,7 @@ impl<'a, M: GuestMemory> MockSplitQueue<'a, M> { + (avail_idx + new_entries) as u64 * VIRTQ_AVAIL_ELEMENT_SIZE, ), ) - .unwrap(); + .map_err(MockError::GuestMem)?; new_entries += 1; } } @@ -493,7 +498,7 @@ impl<'a, M: GuestMemory> MockSplitQueue<'a, M> { u16::to_le(avail_idx + new_entries), self.avail_addr().unchecked_add(2), ) - .unwrap(); + .map_err(MockError::GuestMem)?; Ok(()) } |