Skip to content

Commit 9cf6760

Browse files
committed
Update vm-memory dependency to 0.18
Update the vm-memory dependency to 0.18 to get the latest and greatest. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent 4fb56c1 commit 9cf6760

9 files changed

Lines changed: 37 additions & 31 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ pe = ["elf"]
2626
elf = []
2727

2828
[dependencies]
29-
vm-memory = ">=0.16.0, <=0.17.1"
29+
vm-memory = "0.18"
3030

3131
[dev-dependencies]
3232
criterion = { version = "0.7.0", features = ["html_reports"] }
33-
vm-memory = { version = ">=0.16.0, <=0.17.1", features = ["backend-mmap"] }
33+
vm-memory = { version = "0.18", features = ["backend-mmap"] }
3434

3535
[[bench]]
3636
name = "main"

src/configurator/fdt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//! Traits and structs for loading the device tree.
66
7-
use vm_memory::{Bytes, GuestMemory};
7+
use vm_memory::{Bytes, GuestMemoryBackend};
88

99
use std::fmt;
1010

@@ -56,7 +56,7 @@ impl BootConfigurator for FdtBootConfigurator {
5656
/// # extern crate vm_memory;
5757
/// # use linux_loader::configurator::{BootConfigurator, BootParams};
5858
/// # use linux_loader::configurator::fdt::FdtBootConfigurator;
59-
/// # use vm_memory::{Address, ByteValued, GuestMemory, GuestMemoryMmap, GuestAddress};
59+
/// # use vm_memory::{Address, ByteValued, GuestMemoryBackend, GuestMemoryMmap, GuestAddress};
6060
/// # #[derive(Clone, Copy, Default)]
6161
/// # struct FdtPlaceholder([u8; 0x20]);
6262
/// # unsafe impl ByteValued for FdtPlaceholder {}
@@ -79,7 +79,7 @@ impl BootConfigurator for FdtBootConfigurator {
7979
/// ```
8080
fn write_bootparams<M>(params: &BootParams, guest_memory: &M) -> Result<()>
8181
where
82-
M: GuestMemory,
82+
M: GuestMemoryBackend,
8383
{
8484
guest_memory
8585
.checked_offset(params.header_start, params.header.len())

src/configurator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
#![cfg(any(feature = "elf", feature = "pe", feature = "bzimage"))]
2020

21-
use vm_memory::{Address, ByteValued, GuestAddress, GuestMemory};
21+
use vm_memory::{Address, ByteValued, GuestAddress, GuestMemoryBackend};
2222

2323
use std::fmt;
2424

@@ -123,7 +123,7 @@ pub trait BootConfigurator {
123123
/// * `guest_memory` - guest's physical memory.
124124
fn write_bootparams<M>(params: &BootParams, guest_memory: &M) -> Result<()>
125125
where
126-
M: GuestMemory;
126+
M: GuestMemoryBackend;
127127
}
128128

129129
/// Boot parameters to be written in guest memory.

src/configurator/x86_64/linux.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! Traits and structs for configuring and loading boot parameters on `x86_64` using the Linux
1313
//! boot protocol.
1414
15-
use vm_memory::{Bytes, GuestMemory};
15+
use vm_memory::{Bytes, GuestMemoryBackend};
1616

1717
use crate::configurator::{BootConfigurator, BootParams, Error as BootConfiguratorError, Result};
1818

@@ -66,7 +66,7 @@ impl BootConfigurator for LinuxBootConfigurator {
6666
/// # use linux_loader::configurator::{BootConfigurator, BootParams};
6767
/// # use linux_loader::configurator::linux::LinuxBootConfigurator;
6868
/// # use linux_loader::loader::bootparam::boot_params;
69-
/// # use vm_memory::{Address, ByteValued, GuestMemory, GuestMemoryMmap, GuestAddress};
69+
/// # use vm_memory::{Address, ByteValued, GuestMemoryBackend, GuestMemoryMmap, GuestAddress};
7070
/// # const KERNEL_BOOT_FLAG_MAGIC: u16 = 0xaa55;
7171
/// # const KERNEL_HDR_MAGIC: u32 = 0x53726448;
7272
/// # const KERNEL_LOADER_OTHER: u8 = 0xff;
@@ -97,7 +97,7 @@ impl BootConfigurator for LinuxBootConfigurator {
9797
/// [`boot_params`]: ../loader/bootparam/struct.boot_params.html
9898
fn write_bootparams<M>(params: &BootParams, guest_memory: &M) -> Result<()>
9999
where
100-
M: GuestMemory,
100+
M: GuestMemoryBackend,
101101
{
102102
// The VMM has filled a `boot_params` struct and its e820 map.
103103
// This will be written in guest memory at the zero page.

src/configurator/x86_64/pvh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
#![cfg(any(feature = "elf", feature = "bzimage"))]
1616

17-
use vm_memory::{ByteValued, Bytes, GuestMemory};
17+
use vm_memory::{ByteValued, Bytes, GuestMemoryBackend};
1818

1919
use crate::configurator::{BootConfigurator, BootParams, Error as BootConfiguratorError, Result};
2020
use crate::loader_gen::start_info::{hvm_memmap_table_entry, hvm_modlist_entry, hvm_start_info};
@@ -108,7 +108,7 @@ impl BootConfigurator for PvhBootConfigurator {
108108
/// # use linux_loader::configurator::{BootConfigurator, BootParams};
109109
/// # use linux_loader::configurator::pvh::PvhBootConfigurator;
110110
/// # use linux_loader::loader::elf::start_info::{hvm_start_info, hvm_memmap_table_entry};
111-
/// # use vm_memory::{Address, ByteValued, GuestMemory, GuestMemoryMmap, GuestAddress};
111+
/// # use vm_memory::{Address, ByteValued, GuestMemoryBackend, GuestMemoryMmap, GuestAddress};
112112
/// # const XEN_HVM_START_MAGIC_VALUE: u32 = 0x336ec578;
113113
/// # const MEM_SIZE: u64 = 0x100_0000;
114114
/// # const E820_RAM: u32 = 1;
@@ -145,7 +145,7 @@ impl BootConfigurator for PvhBootConfigurator {
145145
/// ```
146146
fn write_bootparams<M>(params: &BootParams, guest_memory: &M) -> Result<()>
147147
where
148-
M: GuestMemory,
148+
M: GuestMemoryBackend,
149149
{
150150
// The VMM has filled an `hvm_start_info` struct and a `Vec<hvm_memmap_table_entry>`
151151
// and has passed them on to this function.

src/loader/bzimage/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
use std::fmt;
1515
use std::io::{Seek, SeekFrom};
1616

17-
use vm_memory::{Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestUsize, ReadVolatile};
17+
use vm_memory::{
18+
Address, ByteValued, Bytes, GuestAddress, GuestMemoryBackend, GuestUsize, ReadVolatile
19+
};
1820

1921
use crate::loader::{
2022
bootparam, Error as KernelLoaderError, KernelLoader, KernelLoaderResult, Result,
@@ -71,7 +73,7 @@ impl KernelLoader for BzImage {
7173
///
7274
/// # Arguments
7375
///
74-
/// * `guest_mem`: [`GuestMemory`] to load the kernel in.
76+
/// * `guest_mem`: [`GuestMemoryBackend`] to load the kernel in.
7577
/// * `kernel_offset`: Address in guest memory where the kernel is loaded.
7678
/// * `kernel_image` - Input bzImage image.
7779
/// * `highmem_start_address`: Address where high memory starts.
@@ -99,8 +101,8 @@ impl KernelLoader for BzImage {
99101
/// .unwrap();
100102
/// ```
101103
///
102-
/// [`GuestMemory`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemory.html
103-
fn load<F, M: GuestMemory>(
104+
/// [`GuestMemoryBackend`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemoryBackend.html
105+
fn load<F, M: GuestMemoryBackend>(
104106
guest_mem: &M,
105107
kernel_offset: Option<GuestAddress>,
106108
kernel_image: &mut F,

src/loader/elf/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ use std::io::{Read, Seek, SeekFrom};
1717
use std::mem;
1818
use std::result;
1919

20-
use vm_memory::{Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestUsize, ReadVolatile};
20+
use vm_memory::{
21+
Address, ByteValued, Bytes, GuestAddress, GuestMemoryBackend, GuestUsize, ReadVolatile
22+
};
2123

2224
use crate::loader::{Error as KernelLoaderError, KernelLoader, KernelLoaderResult, Result};
2325
use crate::loader_gen::elf;
@@ -169,7 +171,7 @@ impl KernelLoader for Elf {
169171
///
170172
/// # Arguments
171173
///
172-
/// * `guest_mem`: [`GuestMemory`] to load the kernel in.
174+
/// * `guest_mem`: [`GuestMemoryBackend`] to load the kernel in.
173175
/// * `kernel_offset`: Offset to be added to default kernel load address in guest memory.
174176
/// * `kernel_image` - Input vmlinux image.
175177
/// * `highmem_start_address`: Address where high memory starts.
@@ -197,8 +199,8 @@ impl KernelLoader for Elf {
197199
/// .unwrap();
198200
/// ```
199201
///
200-
/// [`GuestMemory`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemory.html
201-
fn load<F, M: GuestMemory>(
202+
/// [`GuestMemoryBackend`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemoryBackend.html
203+
fn load<F, M: GuestMemoryBackend>(
202204
guest_mem: &M,
203205
kernel_offset: Option<GuestAddress>,
204206
kernel_image: &mut F,

src/loader/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::io::{Read, Seek};
2424

2525
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
2626
use vm_memory::ByteValued;
27-
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory, GuestUsize, ReadVolatile};
27+
use vm_memory::{Address, Bytes, GuestAddress, GuestMemoryBackend, GuestUsize, ReadVolatile};
2828

2929
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
3030
pub use crate::loader_gen::bootparam;
@@ -167,13 +167,13 @@ pub trait KernelLoader {
167167
///
168168
/// # Arguments
169169
///
170-
/// * `guest_mem`: [`GuestMemory`] to load the kernel in.
170+
/// * `guest_mem`: [`GuestMemoryBackend`] to load the kernel in.
171171
/// * `kernel_offset`: Usage varies between implementations.
172172
/// * `kernel_image`: Kernel image to be loaded.
173173
/// * `highmem_start_address`: Address where high memory starts.
174174
///
175-
/// [`GuestMemory`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemory.html
176-
fn load<F, M: GuestMemory>(
175+
/// [`GuestMemoryBackend`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemoryBackend.html
176+
fn load<F, M: GuestMemoryBackend>(
177177
guest_mem: &M,
178178
kernel_offset: Option<GuestAddress>,
179179
kernel_image: &mut F,
@@ -197,11 +197,11 @@ unsafe impl ByteValued for bootparam::boot_params {}
197197
///
198198
/// # Arguments
199199
///
200-
/// * `guest_mem` - [`GuestMemory`] that will be partially overwritten by the command line.
200+
/// * `guest_mem` - [`GuestMemoryBackend`] that will be partially overwritten by the command line.
201201
/// * `guest_addr` - The address in `guest_mem` at which to load the command line.
202202
/// * `cmdline` - The kernel command line.
203203
///
204-
/// [`GuestMemory`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemory.html
204+
/// [`GuestMemoryBackend`]: https://docs.rs/vm-memory/latest/vm_memory/guest_memory/trait.GuestMemoryBackend.html
205205
///
206206
/// # Examples
207207
///
@@ -219,7 +219,7 @@ unsafe impl ByteValued for bootparam::boot_params {}
219219
/// let result = load_cmdline(&gm, GuestAddress(0x1000), &cl).unwrap();
220220
/// gm.read_slice(buf.as_mut_slice(), GuestAddress(0x1000)).unwrap();
221221
/// assert_eq!(buf.as_slice(), "foo=bar\0".as_bytes());
222-
pub fn load_cmdline<M: GuestMemory>(
222+
pub fn load_cmdline<M: GuestMemoryBackend>(
223223
guest_mem: &M,
224224
guest_addr: GuestAddress,
225225
cmdline: &Cmdline,

src/loader/pe/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
use std::fmt;
1515
use std::io::{Read, Seek, SeekFrom};
1616

17-
use vm_memory::{Address, ByteValued, Bytes, GuestAddress, GuestMemory, GuestUsize, ReadVolatile};
17+
use vm_memory::{
18+
Address, ByteValued, Bytes, GuestAddress, GuestMemoryBackend, GuestUsize, ReadVolatile
19+
};
1820

1921
use crate::loader::{Error as KernelLoaderError, KernelLoader, KernelLoaderResult, Result};
2022

@@ -131,7 +133,7 @@ impl KernelLoader for PE {
131133
///
132134
/// # Returns
133135
/// * KernelLoaderResult
134-
fn load<F, M: GuestMemory>(
136+
fn load<F, M: GuestMemoryBackend>(
135137
guest_mem: &M,
136138
kernel_offset: Option<GuestAddress>,
137139
kernel_image: &mut F,
@@ -213,7 +215,7 @@ impl KernelLoader for PE {
213215
/// * `guest_addr` - The address in `guest_mem` at which to load the device tree blob.
214216
/// * `dtb_image` - The device tree blob.
215217
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
216-
pub fn load_dtb<F, M: GuestMemory>(
218+
pub fn load_dtb<F, M: GuestMemoryBackend>(
217219
guest_mem: &M,
218220
guest_addr: GuestAddress,
219221
dtb_image: &mut F,

0 commit comments

Comments
 (0)