Add an abstraction for a block request descriptor chain
There are multiple of these in the test code at the moment, so we
consolidate them.
@@ -140,6 +140,10 @@ impl<'a> VirtqDesc<'a> {
self.next.set(next);
}
+ pub fn memory(&self) -> &'a GuestMemoryMmap {
+ self.addr.mem
+ }
+
pub fn set_data(&mut self, data: &[u8]) {
assert!(self.len.get() as usize >= data.len());
let mem = self.addr.mem;
@@ -259,6 +263,10 @@ impl<'a> VirtQueue<'a> {
}
}
+ pub fn memory(&self) -> &'a GuestMemoryMmap {
+ self.used.flags.mem
+ }
+
pub fn size(&self) -> u16 {
self.dtable.len() as u16
}
