mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-16 06:07:15 +00:00
virtio-devices: Add default implementations for {read,write}_config
Not every virtio device has any config fields that can be read and most have none that can be written to. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
f1419d116d
commit
6ba1c4318e
@ -11,6 +11,7 @@ use std::collections::HashMap;
|
|||||||
use std::num::Wrapping;
|
use std::num::Wrapping;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use vm_memory::{GuestAddress, GuestMemoryAtomic, GuestMemoryMmap, GuestUsize};
|
use vm_memory::{GuestAddress, GuestMemoryAtomic, GuestMemoryMmap, GuestUsize};
|
||||||
|
use vm_virtio::VirtioDeviceType;
|
||||||
use vmm_sys_util::eventfd::EventFd;
|
use vmm_sys_util::eventfd::EventFd;
|
||||||
|
|
||||||
pub enum VirtioInterruptType {
|
pub enum VirtioInterruptType {
|
||||||
@ -82,10 +83,20 @@ pub trait VirtioDevice: Send {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reads this device configuration space at `offset`.
|
/// Reads this device configuration space at `offset`.
|
||||||
fn read_config(&self, offset: u64, data: &mut [u8]);
|
fn read_config(&self, _offset: u64, _data: &mut [u8]) {
|
||||||
|
warn!(
|
||||||
|
"No readable configuration fields for {}",
|
||||||
|
VirtioDeviceType::from(self.device_type())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Writes to this device configuration space at `offset`.
|
/// Writes to this device configuration space at `offset`.
|
||||||
fn write_config(&mut self, offset: u64, data: &[u8]);
|
fn write_config(&mut self, _offset: u64, _data: &[u8]) {
|
||||||
|
warn!(
|
||||||
|
"No writable configuration fields for {}",
|
||||||
|
VirtioDeviceType::from(self.device_type())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Activates this device for real usage.
|
/// Activates this device for real usage.
|
||||||
fn activate(
|
fn activate(
|
||||||
|
Loading…
Reference in New Issue
Block a user