Skip to content

Commit 4e29019

Browse files
bonzinijiangliu
authored andcommitted
guest_memory: provide default file_offset implementation
Just like for example as_slice, not having a file and offset behind a memory region is a sane default. Add it to the GuestMemoryRegion trait. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 1a6cf3b commit 4e29019

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/guest_memory.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ pub trait GuestMemoryRegion: Bytes<MemoryRegionAddress, E = Error> {
216216
}
217217

218218
/// Returns information regarding the file and offset backing this memory region.
219-
fn file_offset(&self) -> Option<&FileOffset>;
219+
fn file_offset(&self) -> Option<&FileOffset> {
220+
None
221+
}
220222

221223
/// Returns a slice corresponding to the data in the region.
222224
///

0 commit comments

Comments
 (0)