Skip to content

Commit eff9d5c

Browse files
lauraltalexandruag
authored andcommitted
some minor fixes here and there
+ coverage score update caused by switching to Rust 1.41.1. Signed-off-by: Laura Loghin <[email protected]>
1 parent 47663db commit eff9d5c

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

benches/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
//
3-
// Use of this source code is governed by a BSD-style license that can be
4-
// found in the LICENSE-BSD-3-Clause file.
5-
//
6-
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
3+
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
74

85
extern crate criterion;
96

benches/mmap/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
//
3-
// Use of this source code is governed by a BSD-style license that can be
4-
// found in the LICENSE-BSD-3-Clause file.
5-
//
6-
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
3+
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
74
#![cfg(feature = "backend-mmap")]
85

96
extern crate criterion;
107
extern crate vm_memory;
11-
extern crate vmm_sys_util;
128

139
use std::fs::{File, OpenOptions};
1410
use std::io::Cursor;
@@ -176,7 +172,7 @@ pub fn benchmark_for_mmap(c: &mut Criterion) {
176172
})
177173
});
178174

179-
c.bench_function(format!("write_exact_to_{:#0x}", offset).as_str(), |b| {
175+
c.bench_function(format!("write_exact_to_{:#0X}", offset).as_str(), |b| {
180176
b.iter(|| {
181177
black_box(
182178
memory

coverage_config_x86_64.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"coverage_score": 85.2,
2+
"coverage_score": 85.4,
33
"exclude_path": "mmap_windows.rs",
44
"crate_features": "backend-mmap,backend-atomic"
55
}

src/guest_memory.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ pub trait GuestMemory {
521521

522522
/// Invokes callback `f` to handle data in the address range `[addr, addr + count)`.
523523
///
524-
/// /// The address range `[addr, addr + count)` may span more than one
525-
/// [`GuestMemoryRegion`](trait.GuestMemoryRegion.html) objects, or even have holes in it.
524+
/// The address range `[addr, addr + count)` may span more than one
525+
/// [`GuestMemoryRegion`](trait.GuestMemoryRegion.html) object, or even have holes in it.
526526
/// So [`try_access()`](trait.GuestMemory.html#method.try_access) invokes the callback 'f'
527527
/// for each [`GuestMemoryRegion`](trait.GuestMemoryRegion.html) object involved and returns:
528528
/// - the error code returned by the callback 'f'
@@ -577,7 +577,7 @@ pub trait GuestMemory {
577577
/// concurrent accesses to the underlying guest memory.
578578
///
579579
/// # Arguments
580-
/// * `guest_addr` - Guest address to convert.
580+
/// * `addr` - Guest address to convert.
581581
///
582582
/// # Examples
583583
///
@@ -640,14 +640,14 @@ impl<T: GuestMemory> Bytes<GuestAddress> for T {
640640
}
641641

642642
/// # Examples
643-
/// * Write a slice at guestaddress 0x200.
643+
/// * Write a slice at guestaddress 0x1000.
644644
///
645645
/// ```
646646
/// # #[cfg(feature = "backend-mmap")]
647647
/// # use vm_memory::{Bytes, GuestAddress, mmap::GuestMemoryMmap};
648648
///
649649
/// # #[cfg(feature = "backend-mmap")]
650-
/// # fn test_write_u64() {
650+
/// # fn test_write_slice() {
651651
/// let start_addr = GuestAddress(0x1000);
652652
/// let mut gm =
653653
/// GuestMemoryMmap::from_ranges(&vec![(start_addr, 0x400)])
@@ -657,7 +657,7 @@ impl<T: GuestMemory> Bytes<GuestAddress> for T {
657657
/// # }
658658
///
659659
/// # #[cfg(feature = "backend-mmap")]
660-
/// # test_write_u64();
660+
/// # test_write_slice();
661661
/// ```
662662
fn write_slice(&self, buf: &[u8], addr: GuestAddress) -> Result<()> {
663663
let res = self.write(buf, addr)?;
@@ -671,14 +671,14 @@ impl<T: GuestMemory> Bytes<GuestAddress> for T {
671671
}
672672

673673
/// # Examples
674-
/// * Read a slice of length 16 at guestaddress 0x200.
674+
/// * Read a slice of length 16 at guestaddress 0x1000.
675675
///
676676
/// ```
677677
/// # #[cfg(feature = "backend-mmap")]
678678
/// # use vm_memory::{Bytes, GuestAddress, mmap::GuestMemoryMmap};
679679
///
680680
/// # #[cfg(feature = "backend-mmap")]
681-
/// # fn test_write_u64() {
681+
/// # fn test_read_slice() {
682682
/// let start_addr = GuestAddress(0x1000);
683683
/// let mut gm =
684684
/// GuestMemoryMmap::from_ranges(&vec![(start_addr, 0x400)])
@@ -689,7 +689,7 @@ impl<T: GuestMemory> Bytes<GuestAddress> for T {
689689
/// # }
690690
///
691691
/// # #[cfg(feature = "backend-mmap")]
692-
/// # test_write_u64()
692+
/// # test_read_slice()
693693
/// ```
694694
fn read_slice(&self, buf: &mut [u8], addr: GuestAddress) -> Result<()> {
695695
let res = self.read(buf, addr)?;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
//! Traits for allocating, handling and interacting with the VM's physical memory.
1010
//!
11-
//! For a typical hypervisor, there are seveval components, such as boot loader, virtual device
11+
//! For a typical hypervisor, there are several components, such as boot loader, virtual device
1212
//! drivers, virtio backend drivers and vhost drivers etc, that need to access VM's physical memory.
1313
//! This crate aims to provide a set of stable traits to decouple VM memory consumers from VM
1414
//! memory providers. Based on these traits, VM memory consumers could access VM's physical memory

0 commit comments

Comments
 (0)