mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: Define AccessPlatform trait
Moving the whole codebase to rely on the AccessPlatform definition from vm-virtio so that we can fully remove it from virtio-queue crate. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
8759c3db3e
commit
8eed276d14
@@ -10,7 +10,7 @@
|
||||
|
||||
//! Implements virtio queues
|
||||
|
||||
use std::fmt;
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
pub mod queue;
|
||||
pub use queue::*;
|
||||
@@ -87,3 +87,10 @@ impl fmt::Display for VirtioDeviceType {
|
||||
write!(f, "{}", output)
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait for devices with access to data in memory being limited and/or
|
||||
/// translated.
|
||||
pub trait AccessPlatform: Send + Sync + Debug {
|
||||
/// Provide a way to translate address ranges.
|
||||
fn translate(&self, base: u64, size: u64) -> std::result::Result<u64, std::io::Error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user