Snap for 11421525 from 5f6d8f6f393df674d5056410c14794388efcb301 to simpleperf-release

Change-Id: I90c7de6168200e476e64807ac6b035a1c406ab29
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
diff --git a/Android.bp b/Android.bp
index 8e6354a..21921c9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -5,7 +5,7 @@
     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
diff --git a/Cargo.toml b/Cargo.toml
index 7ef9e3e..9b6bc53 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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 @@
 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 @@
 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.
-
----
-
diff --git a/METADATA b/METADATA
index 51ab4f1..bce4f7a 100644
--- a/METADATA
+++ b/METADATA
@@ -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"
   }
 }
diff --git a/README.md b/README.md
index 0adc1b1..66eed4e 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@
 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 @@
 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 @@
     InvalidIndex,
     /// Invalid next avail
     InvalidNextAvail,
+    /// Guest memory errors
+    GuestMem(GuestMemoryError),
 }
 
 impl Display for MockError {
@@ -39,6 +43,7 @@
                 f,
                 "invalid next available descriptor chain head in the queue"
             ),
+            GuestMem(e) => write!(f, "guest memory error: {}", e),
         }
     }
 }
@@ -425,7 +430,7 @@
         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 @@
             .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 @@
                                 + (avail_idx + new_entries) as u64 * VIRTQ_AVAIL_ELEMENT_SIZE,
                         ),
                     )
-                    .unwrap();
+                    .map_err(MockError::GuestMem)?;
                 new_entries += 1;
             }
         }
@@ -493,7 +498,7 @@
                 u16::to_le(avail_idx + new_entries),
                 self.avail_addr().unchecked_add(2),
             )
-            .unwrap();
+            .map_err(MockError::GuestMem)?;
 
         Ok(())
     }