@@ -218,12 +218,13 @@ impl BootServices {
218218 ( self . free_pages ) ( addr,  count) . into ( ) 
219219 } 
220220
221-  /// Retrieves the size, in bytes, of the current memory map. 
221+  /// Returns struct which contains the size of a single memory descriptor 
222+ /// as well as the size of the current memory map. 
222223/// 
223- /// A buffer of this  size will be capable of holding the whole current memory map , 
224- /// including padding. Note, however, that allocations will increase  the size of the  
225- /// memory map, therefore it is better to allocate some extra space . 
226- pub  fn  memory_map_size ( & self )  -> usize  { 
224+ /// Note that the  size of the memory map can increase any time an allocation happens , 
225+ /// so when creating a buffer to put  the memory map into, it's recommended to allocate a few extra  
226+ /// elements worth of space above the size of the current memory map . 
227+ pub  fn  memory_map_size ( & self )  -> MemoryMapSize  { 
227228 let  mut  map_size = 0 ; 
228229 let  mut  map_key = MemoryMapKey ( 0 ) ; 
229230 let  mut  entry_size = 0 ; 
@@ -240,7 +241,10 @@ impl BootServices {
240241 } ; 
241242 assert_eq ! ( status,  Status :: BUFFER_TOO_SMALL ) ; 
242243
243-  map_size
244+  MemoryMapSize  { 
245+  entry_size, 
246+  map_size, 
247+  } 
244248 } 
245249
246250 /// Retrieves the current memory map. 
@@ -1297,6 +1301,14 @@ bitflags! {
12971301#[ repr( C ) ]  
12981302pub  struct  MemoryMapKey ( usize ) ; 
12991303
1304+ /// A structure containing the size of a memory descriptor and the size of the memory map 
1305+ pub  struct  MemoryMapSize  { 
1306+  /// Size of a single memory descriptor in bytes 
1307+ pub  entry_size :  usize , 
1308+  /// Size of the entire memory map in bytes 
1309+ pub  map_size :  usize , 
1310+ } 
1311+ 
13001312/// An iterator of memory descriptors 
13011313#[ derive( Debug ,  Clone ) ]  
13021314struct  MemoryMapIter < ' buf >  { 
0 commit comments