mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
virtio-devices: Use Default::default() for transitioning to VirtioCommon
In order to simplify the transition to VirtioCommon and to avoid needing to set empty fields derive Default for VirtioCommon. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
008cf4a5ae
commit
a9a138460b
@ -333,7 +333,7 @@ impl Balloon {
|
||||
Ok(Balloon {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
resize: VirtioBalloonResize::new()?,
|
||||
|
@ -339,7 +339,7 @@ impl<T: DiskFile> Block<T> {
|
||||
Ok(Block {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
kill_evt: None,
|
||||
|
@ -374,7 +374,7 @@ impl BlockIoUring {
|
||||
Ok(BlockIoUring {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
kill_evt: None,
|
||||
|
@ -352,7 +352,7 @@ impl Console {
|
||||
Console {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
kill_evt: None,
|
||||
|
@ -183,6 +183,7 @@ pub trait DmaRemapping: Send + Sync {
|
||||
}
|
||||
|
||||
/// Structure to handle device state common to all devices
|
||||
#[derive(Default)]
|
||||
pub struct VirtioCommon {
|
||||
pub avail_features: u64,
|
||||
pub acked_features: u64,
|
||||
|
@ -782,7 +782,7 @@ impl Iommu {
|
||||
avail_features: 1u64 << VIRTIO_F_VERSION_1
|
||||
| 1u64 << VIRTIO_IOMMU_F_MAP_UNMAP
|
||||
| 1u64 << VIRTIO_IOMMU_F_PROBE,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
config,
|
||||
config_topo_pci_ranges: Vec::new(),
|
||||
|
@ -738,7 +738,7 @@ impl Mem {
|
||||
Ok(Mem {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
resize,
|
||||
|
@ -259,7 +259,7 @@ impl Net {
|
||||
Ok(Net {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
kill_evt: None,
|
||||
|
@ -331,7 +331,7 @@ impl Pmem {
|
||||
Ok(Pmem {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
kill_evt: None,
|
||||
|
@ -165,7 +165,7 @@ impl Rng {
|
||||
Ok(Rng {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
kill_evt: None,
|
||||
|
@ -142,6 +142,7 @@ impl Blk {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
vhost_user_blk,
|
||||
|
@ -358,6 +358,7 @@ impl Fs {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
vu: master,
|
||||
|
@ -151,6 +151,7 @@ impl Net {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features,
|
||||
..Default::default()
|
||||
},
|
||||
vhost_user_net,
|
||||
kill_evt: None,
|
||||
|
@ -338,7 +338,7 @@ where
|
||||
Ok(Vsock {
|
||||
common: VirtioCommon {
|
||||
avail_features,
|
||||
acked_features: 0u64,
|
||||
..Default::default()
|
||||
},
|
||||
id,
|
||||
cid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user