@@ -143,7 +143,7 @@ impl MmapRange {
143143/// physical memory may be mapped into the current process due to the limited virtual address
144144/// space size of the process.
145145#[ derive( Debug ) ]
146- pub struct MmapRegion < B = ( ) > {
146+ pub struct GuestRegionXen < B = ( ) > {
147147 bitmap : B ,
148148 size : usize ,
149149 prot : i32 ,
@@ -153,7 +153,7 @@ pub struct MmapRegion<B = ()> {
153153 mmap : MmapXen ,
154154}
155155
156- impl < B : Bitmap > GuestMemoryRegion for MmapRegion < B > {
156+ impl < B : Bitmap > GuestMemoryRegion for GuestRegionXen < B > {
157157 type B = B ;
158158
159159 fn len ( & self ) -> GuestUsize {
@@ -195,23 +195,23 @@ impl<B: Bitmap> GuestMemoryRegion for MmapRegion<B> {
195195 }
196196}
197197
198- impl < B : Bitmap > GuestMemoryRegionBytes for MmapRegion < B > { }
198+ impl < B : Bitmap > GuestMemoryRegionBytes for GuestRegionXen < B > { }
199199
200200/// A collection of Xen guest memory regions.
201201///
202202/// 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 > > ;
205205
206206// SAFETY: Send and Sync aren't automatically inherited for the raw address pointer.
207207// Accessing that pointer is only done through the stateless interface which
208208// allows the object to be shared by multiple threads without a decrease in
209209// safety.
210- unsafe impl < B : Send > Send for MmapRegion < B > { }
210+ unsafe impl < B : Send > Send for GuestRegionXen < B > { }
211211// SAFETY: See comment above.
212- unsafe impl < B : Sync > Sync for MmapRegion < B > { }
212+ unsafe impl < B : Sync > Sync for GuestRegionXen < B > { }
213213
214- impl < B : NewBitmap > MmapRegion < B > {
214+ impl < B : NewBitmap > GuestRegionXen < B > {
215215 /// Creates a shared anonymous mapping of `size` bytes.
216216 ///
217217 /// # Arguments
@@ -224,7 +224,7 @@ impl<B: NewBitmap> MmapRegion<B> {
224224 /// use std::fs::File;
225225 /// use std::path::Path;
226226 /// use vm_memory::{
227- /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, MmapRange, MmapRegionXen , MmapXenFlags,
227+ /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, GuestRegionXen, MmapRange , MmapXenFlags,
228228 /// };
229229 /// # use vmm_sys_util::tempfile::TempFile;
230230 ///
@@ -240,7 +240,7 @@ impl<B: NewBitmap> MmapRegion<B> {
240240 /// # // We need a UNIX mapping for tests to succeed.
241241 /// # let range = MmapRange::new_unix(0x400, None, addr);
242242 ///
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");
244244 ///
245245 /// let mut gm = GuestMemoryXen::from_regions(vec![r]).expect("Could not create guest memory");
246246 /// let res = gm
@@ -255,7 +255,7 @@ impl<B: NewBitmap> MmapRegion<B> {
255255 /// use std::fs::File;
256256 /// use std::path::Path;
257257 /// use vm_memory::{
258- /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, MmapRange, MmapRegionXen , MmapXenFlags,
258+ /// Bytes, FileOffset, GuestAddress, GuestMemoryXen, GuestRegionXen, MmapRange , MmapXenFlags,
259259 /// };
260260 /// # use vmm_sys_util::tempfile::TempFile;
261261 ///
@@ -271,7 +271,7 @@ impl<B: NewBitmap> MmapRegion<B> {
271271 /// # // We need a UNIX mapping for tests to succeed.
272272 /// # let range = MmapRange::new_unix(0x400, None, addr);
273273 ///
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");
275275 ///
276276 /// let mut gm = GuestMemoryXen::from_regions(vec![r]).expect("Could not create guest memory");
277277 /// let res = gm
@@ -297,7 +297,7 @@ impl<B: NewBitmap> MmapRegion<B> {
297297
298298 let mmap = MmapXen :: new ( & range) ?;
299299
300- Ok ( MmapRegion {
300+ Ok ( GuestRegionXen {
301301 bitmap : B :: with_len ( range. size ) ,
302302 size : range. size ,
303303 prot : range. prot . ok_or ( Error :: Unexpected ) ?,
@@ -309,7 +309,7 @@ impl<B: NewBitmap> MmapRegion<B> {
309309 }
310310}
311311
312- impl < B : Bitmap > MmapRegion < B > {
312+ impl < B : Bitmap > GuestRegionXen < B > {
313313 /// Returns a pointer to the beginning of the memory region. Mutable accesses performed
314314 /// using the resulting pointer are not automatically accounted for by the dirty bitmap
315315 /// tracking functionality.
@@ -344,7 +344,7 @@ impl<B: Bitmap> MmapRegion<B> {
344344 ///
345345 /// This is mostly a sanity check available for convenience, as different file descriptors
346346 /// 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 {
348348 if let Some ( f_off1) = self . file_offset ( ) {
349349 if let Some ( f_off2) = other. file_offset ( ) {
350350 if f_off1. file ( ) . as_raw_fd ( ) == f_off2. file ( ) . as_raw_fd ( ) {
@@ -390,7 +390,7 @@ impl<B: Bitmap> MmapRegion<B> {
390390 }
391391}
392392
393- impl < B : Bitmap > VolatileMemory for MmapRegion < B > {
393+ impl < B : Bitmap > VolatileMemory for GuestRegionXen < B > {
394394 type B = B ;
395395
396396 fn len ( & self ) -> usize {
@@ -1035,6 +1035,7 @@ mod tests {
10351035 #![ allow( clippy:: undocumented_unsafe_blocks) ]
10361036
10371037 use super :: * ;
1038+ use crate :: mmap:: GuestRegionXen ;
10381039 use matches:: assert_matches;
10391040 use vmm_sys_util:: tempfile:: TempFile ;
10401041
@@ -1071,7 +1072,7 @@ mod tests {
10711072 }
10721073 }
10731074
1074- impl MmapRegion {
1075+ impl GuestRegionXen {
10751076 /// Create an `MmapRegion` with specified `size` at GuestAdress(0)
10761077 pub fn new ( size : usize ) -> Result < Self > {
10771078 let range = MmapRange :: new_unix ( size, None , GuestAddress ( 0 ) ) ;
0 commit comments