@@ -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
@@ -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 {
@@ -1037,6 +1037,7 @@ mod tests {
1037
1037
use super :: * ;
1038
1038
use matches:: assert_matches;
1039
1039
use vmm_sys_util:: tempfile:: TempFile ;
1040
+ use crate :: mmap:: GuestRegionXen ;
1040
1041
1041
1042
// Adding a helper method to extract the errno within an Error::Mmap(e), or return a
1042
1043
// distinctive value when the error is represented by another variant.
@@ -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