@@ -143,7 +143,7 @@ impl MmapRange {
143
143
/// physical memory may be mapped into the current process due to the limited virtual address
144
144
/// space size of the process.
145
145
#[ derive( Debug ) ]
146
- pub struct MmapRegion < B = ( ) > {
146
+ pub struct GuestRegionXen < B = ( ) > {
147
147
bitmap : B ,
148
148
size : usize ,
149
149
prot : i32 ,
@@ -153,7 +153,7 @@ pub struct MmapRegion<B = ()> {
153
153
mmap : MmapXen ,
154
154
}
155
155
156
- impl < B : Bitmap > GuestMemoryRegion for MmapRegion < B > {
156
+ impl < B : Bitmap > GuestMemoryRegion for GuestRegionXen < B > {
157
157
type B = B ;
158
158
159
159
fn len ( & self ) -> GuestUsize {
@@ -195,23 +195,23 @@ impl<B: Bitmap> GuestMemoryRegion for MmapRegion<B> {
195
195
}
196
196
}
197
197
198
- impl < B : Bitmap > GuestMemoryRegionBytes for MmapRegion < B > { }
198
+ impl < B : Bitmap > GuestMemoryRegionBytes for GuestRegionXen < B > { }
199
199
200
200
/// A collection of Xen guest memory regions.
201
201
///
202
202
/// Represents the entire physical memory of the guest by tracking all its memory regions.
203
- /// Each region is an instance of [`MmapRegionXen `].
204
- pub type GuestMemoryXen < B > = GuestRegionCollection < MmapRegion < B > > ;
203
+ /// Each region is an instance of [`GuestRegionXen `].
204
+ pub type GuestMemoryXen < B > = GuestRegionCollection < GuestRegionXen < B > > ;
205
205
206
206
// SAFETY: Send and Sync aren't automatically inherited for the raw address pointer.
207
207
// Accessing that pointer is only done through the stateless interface which
208
208
// allows the object to be shared by multiple threads without a decrease in
209
209
// safety.
210
- unsafe impl < B : Send > Send for MmapRegion < B > { }
210
+ unsafe impl < B : Send > Send for GuestRegionXen < B > { }
211
211
// SAFETY: See comment above.
212
- unsafe impl < B : Sync > Sync for MmapRegion < B > { }
212
+ unsafe impl < B : Sync > Sync for GuestRegionXen < B > { }
213
213
214
- impl < B : NewBitmap > MmapRegion < B > {
214
+ impl < B : NewBitmap > GuestRegionXen < B > {
215
215
/// Creates a shared anonymous mapping of `size` bytes.
216
216
///
217
217
/// # Arguments
@@ -224,7 +224,7 @@ impl<B: NewBitmap> MmapRegion<B> {
224
224
/// use std::fs::File;
225
225
/// use std::path::Path;
226
226
/// use vm_memory::{
227
- /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, MmapRange, MmapRegionXen , MmapXenFlags,
227
+ /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, MmapRange, GuestRegionXen , MmapXenFlags,
228
228
/// };
229
229
/// # use vmm_sys_util::tempfile::TempFile;
230
230
///
@@ -240,7 +240,7 @@ impl<B: NewBitmap> MmapRegion<B> {
240
240
/// # // We need a UNIX mapping for tests to succeed.
241
241
/// # let range = MmapRange::new_unix(0x400, None, addr);
242
242
///
243
- /// let r = MmapRegionXen ::<()>::from_range(range).expect("Could not create mmap region");
243
+ /// let r = GuestRegionXen ::<()>::from_range(range).expect("Could not create mmap region");
244
244
///
245
245
/// let mut gm = GuestMemoryXen::from_regions(vec![r]).expect("Could not create guest memory");
246
246
/// let res = gm
@@ -255,7 +255,7 @@ impl<B: NewBitmap> MmapRegion<B> {
255
255
/// use std::fs::File;
256
256
/// use std::path::Path;
257
257
/// use vm_memory::{
258
- /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, MmapRange, MmapRegionXen , MmapXenFlags,
258
+ /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, MmapRange, GuestRegionXen , MmapXenFlags,
259
259
/// };
260
260
/// # use vmm_sys_util::tempfile::TempFile;
261
261
///
@@ -271,7 +271,7 @@ impl<B: NewBitmap> MmapRegion<B> {
271
271
/// # // We need a UNIX mapping for tests to succeed.
272
272
/// # let range = MmapRange::new_unix(0x400, None, addr);
273
273
///
274
- /// let r = MmapRegionXen ::<()>::from_range(range).expect("Could not create mmap region");
274
+ /// let r = GuestRegionXen ::<()>::from_range(range).expect("Could not create mmap region");
275
275
///
276
276
/// let mut gm = GuestMemoryXen::from_regions(vec![r]).expect("Could not create guest memory");
277
277
/// let res = gm
@@ -297,7 +297,7 @@ impl<B: NewBitmap> MmapRegion<B> {
297
297
298
298
let mmap = MmapXen :: new ( & range) ?;
299
299
300
- Ok ( MmapRegion {
300
+ Ok ( GuestRegionXen {
301
301
bitmap : B :: with_len ( range. size ) ,
302
302
size : range. size ,
303
303
prot : range. prot . ok_or ( Error :: Unexpected ) ?,
@@ -309,7 +309,7 @@ impl<B: NewBitmap> MmapRegion<B> {
309
309
}
310
310
}
311
311
312
- impl < B : Bitmap > MmapRegion < B > {
312
+ impl < B : Bitmap > GuestRegionXen < B > {
313
313
/// Returns a pointer to the beginning of the memory region. Mutable accesses performed
314
314
/// using the resulting pointer are not automatically accounted for by the dirty bitmap
315
315
/// tracking functionality.
@@ -344,7 +344,7 @@ impl<B: Bitmap> MmapRegion<B> {
344
344
///
345
345
/// This is mostly a sanity check available for convenience, as different file descriptors
346
346
/// can alias the same file.
347
- pub fn fds_overlap < T : Bitmap > ( & self , other : & MmapRegion < T > ) -> bool {
347
+ pub fn fds_overlap < T : Bitmap > ( & self , other : & GuestRegionXen < T > ) -> bool {
348
348
if let Some ( f_off1) = self . file_offset ( ) {
349
349
if let Some ( f_off2) = other. file_offset ( ) {
350
350
if f_off1. file ( ) . as_raw_fd ( ) == f_off2. file ( ) . as_raw_fd ( ) {
@@ -390,7 +390,7 @@ impl<B: Bitmap> MmapRegion<B> {
390
390
}
391
391
}
392
392
393
- impl < B : Bitmap > VolatileMemory for MmapRegion < B > {
393
+ impl < B : Bitmap > VolatileMemory for GuestRegionXen < B > {
394
394
type B = B ;
395
395
396
396
fn len ( & self ) -> usize {
@@ -1035,6 +1035,7 @@ mod tests {
1035
1035
#![ allow( clippy:: undocumented_unsafe_blocks) ]
1036
1036
1037
1037
use super :: * ;
1038
+ use crate :: mmap:: GuestRegionXen ;
1038
1039
use matches:: assert_matches;
1039
1040
use vmm_sys_util:: tempfile:: TempFile ;
1040
1041
@@ -1071,7 +1072,7 @@ mod tests {
1071
1072
}
1072
1073
}
1073
1074
1074
- impl MmapRegion {
1075
+ impl GuestRegionXen {
1075
1076
/// Create an `MmapRegion` with specified `size` at GuestAdress(0)
1076
1077
pub fn new ( size : usize ) -> Result < Self > {
1077
1078
let range = MmapRange :: new_unix ( size, None , GuestAddress ( 0 ) ) ;
0 commit comments