mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-24 17:01:16 +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 {
|
Ok(Balloon {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
resize: VirtioBalloonResize::new()?,
|
resize: VirtioBalloonResize::new()?,
|
||||||
|
@ -339,7 +339,7 @@ impl<T: DiskFile> Block<T> {
|
|||||||
Ok(Block {
|
Ok(Block {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -374,7 +374,7 @@ impl BlockIoUring {
|
|||||||
Ok(BlockIoUring {
|
Ok(BlockIoUring {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -352,7 +352,7 @@ impl Console {
|
|||||||
Console {
|
Console {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -183,6 +183,7 @@ pub trait DmaRemapping: Send + Sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Structure to handle device state common to all devices
|
/// Structure to handle device state common to all devices
|
||||||
|
#[derive(Default)]
|
||||||
pub struct VirtioCommon {
|
pub struct VirtioCommon {
|
||||||
pub avail_features: u64,
|
pub avail_features: u64,
|
||||||
pub acked_features: u64,
|
pub acked_features: u64,
|
||||||
|
@ -782,7 +782,7 @@ impl Iommu {
|
|||||||
avail_features: 1u64 << VIRTIO_F_VERSION_1
|
avail_features: 1u64 << VIRTIO_F_VERSION_1
|
||||||
| 1u64 << VIRTIO_IOMMU_F_MAP_UNMAP
|
| 1u64 << VIRTIO_IOMMU_F_MAP_UNMAP
|
||||||
| 1u64 << VIRTIO_IOMMU_F_PROBE,
|
| 1u64 << VIRTIO_IOMMU_F_PROBE,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
config,
|
config,
|
||||||
config_topo_pci_ranges: Vec::new(),
|
config_topo_pci_ranges: Vec::new(),
|
||||||
|
@ -738,7 +738,7 @@ impl Mem {
|
|||||||
Ok(Mem {
|
Ok(Mem {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
resize,
|
resize,
|
||||||
|
@ -259,7 +259,7 @@ impl Net {
|
|||||||
Ok(Net {
|
Ok(Net {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -331,7 +331,7 @@ impl Pmem {
|
|||||||
Ok(Pmem {
|
Ok(Pmem {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -165,7 +165,7 @@ impl Rng {
|
|||||||
Ok(Rng {
|
Ok(Rng {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -142,6 +142,7 @@ impl Blk {
|
|||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features,
|
acked_features,
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
vhost_user_blk,
|
vhost_user_blk,
|
||||||
|
@ -358,6 +358,7 @@ impl Fs {
|
|||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features,
|
acked_features,
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
vu: master,
|
vu: master,
|
||||||
|
@ -151,6 +151,7 @@ impl Net {
|
|||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features,
|
acked_features,
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
vhost_user_net,
|
vhost_user_net,
|
||||||
kill_evt: None,
|
kill_evt: None,
|
||||||
|
@ -338,7 +338,7 @@ where
|
|||||||
Ok(Vsock {
|
Ok(Vsock {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
avail_features,
|
avail_features,
|
||||||
acked_features: 0u64,
|
..Default::default()
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
cid,
|
cid,
|
||||||
|
Loading…
Reference in New Issue
Block a user