summary refs log tree commit diff
path: root/devices/src/virtio/descriptor_utils.rs
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2019-09-10 16:11:18 -0700
committerCommit Bot <commit-bot@chromium.org>2019-09-11 09:34:12 +0000
commit506105dc0dcfbbdec907f672e8d782b2f8604447 (patch)
treede31f815541f9195f537bc8142832b68f766762c /devices/src/virtio/descriptor_utils.rs
parent532533dd3994ef2047dea770e799831b4c38418e (diff)
downloadcrosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.gz
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.bz2
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.lz
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.xz
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.tar.zst
crosvm-506105dc0dcfbbdec907f672e8d782b2f8604447.zip
use `SharedMemory::{named, anon}` to replace `::new`
The new constructors are shorter and omit the bare `None` in the `anon`
call sites which gave no clues to the reader what the effect of that
`None` was. This should improve readability.

TEST=./build_test
BUG=None

Change-Id: I2e34e7df9a4ccc5da50edf4e963a6a42e3d84b22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1797188
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'devices/src/virtio/descriptor_utils.rs')
-rw-r--r--devices/src/virtio/descriptor_utils.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/devices/src/virtio/descriptor_utils.rs b/devices/src/virtio/descriptor_utils.rs
index 5142ecf..0ea4faa 100644
--- a/devices/src/virtio/descriptor_utils.rs
+++ b/devices/src/virtio/descriptor_utils.rs
@@ -675,7 +675,7 @@ mod tests {
         let mut reader = Reader::new(&memory, chain);
 
         // GuestMemory's write_from_memory requires raw file descriptor.
-        let mut shm = SharedMemory::new(None).unwrap();
+        let mut shm = SharedMemory::anon().unwrap();
         shm.set_size(384).unwrap();
 
         // Prevent shared memory from growing on `write` call.
@@ -712,7 +712,7 @@ mod tests {
         let mut writer = Writer::new(&memory, chain);
 
         // GuestMemory's read_to_memory requires raw file descriptor.
-        let mut shm = SharedMemory::new(None).unwrap();
+        let mut shm = SharedMemory::anon().unwrap();
         shm.set_size(384).unwrap();
 
         if let Ok(_) = writer.write_from(&shm, 512) {