mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio, virtio-devices: Address Rust 1.51.0 clippy issue (upper_case_acronyms)
error: name `TYPE_UNKNOWN` contains a capitalized acronym --> vm-virtio/src/lib.rs:48:5 | 48 | TYPE_UNKNOWN = 0xFF, | ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `Type_Unknown` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -328,7 +328,7 @@ impl Balloon {
|
||||
|
||||
Ok(Balloon {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_BALLOON as u32,
|
||||
device_type: VirtioDeviceType::Balloon as u32,
|
||||
avail_features,
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
|
||||
@@ -430,7 +430,7 @@ impl Block {
|
||||
|
||||
Ok(Block {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_BLOCK as u32,
|
||||
device_type: VirtioDeviceType::Block as u32,
|
||||
avail_features,
|
||||
paused_sync: Some(Arc::new(Barrier::new(num_queues + 1))),
|
||||
queue_sizes: vec![queue_size; num_queues],
|
||||
|
||||
@@ -344,7 +344,7 @@ impl Console {
|
||||
Ok((
|
||||
Console {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_CONSOLE as u32,
|
||||
device_type: VirtioDeviceType::Console as u32,
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
avail_features,
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
|
||||
@@ -769,7 +769,7 @@ impl Iommu {
|
||||
Iommu {
|
||||
id,
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_IOMMU as u32,
|
||||
device_type: VirtioDeviceType::Iommu as u32,
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
avail_features: 1u64 << VIRTIO_F_VERSION_1
|
||||
| 1u64 << VIRTIO_IOMMU_F_MAP_UNMAP
|
||||
|
||||
@@ -816,7 +816,7 @@ impl Mem {
|
||||
|
||||
Ok(Mem {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_MEM as u32,
|
||||
device_type: VirtioDeviceType::Mem as u32,
|
||||
avail_features,
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
|
||||
@@ -251,7 +251,7 @@ impl Net {
|
||||
|
||||
Ok(Net {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_NET as u32,
|
||||
device_type: VirtioDeviceType::Net as u32,
|
||||
avail_features,
|
||||
queue_sizes: vec![queue_size; queue_num],
|
||||
paused_sync: Some(Arc::new(Barrier::new((num_queues / 2) + 1))),
|
||||
|
||||
@@ -300,7 +300,7 @@ impl Pmem {
|
||||
|
||||
Ok(Pmem {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_PMEM as u32,
|
||||
device_type: VirtioDeviceType::Pmem as u32,
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
avail_features,
|
||||
|
||||
@@ -154,7 +154,7 @@ impl Rng {
|
||||
|
||||
Ok(Rng {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_RNG as u32,
|
||||
device_type: VirtioDeviceType::Rng as u32,
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
avail_features,
|
||||
|
||||
@@ -384,11 +384,11 @@ impl VirtioPciDevice {
|
||||
// to firmware without requiring excessive identity mapping.
|
||||
let mut use_64bit_bar = true;
|
||||
let (class, subclass) = match VirtioDeviceType::from(locked_device.device_type()) {
|
||||
VirtioDeviceType::TYPE_NET => (
|
||||
VirtioDeviceType::Net => (
|
||||
PciClassCode::NetworkController,
|
||||
&PciNetworkControllerSubclass::EthernetController as &dyn PciSubclass,
|
||||
),
|
||||
VirtioDeviceType::TYPE_BLOCK => {
|
||||
VirtioDeviceType::Block => {
|
||||
use_64bit_bar = false;
|
||||
(
|
||||
PciClassCode::MassStorage,
|
||||
|
||||
@@ -139,7 +139,7 @@ impl Blk {
|
||||
|
||||
Ok(Blk {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_BLOCK as u32,
|
||||
device_type: VirtioDeviceType::Block as u32,
|
||||
queue_sizes: vec![vu_cfg.queue_size; vu_cfg.num_queues],
|
||||
avail_features,
|
||||
acked_features,
|
||||
|
||||
@@ -356,7 +356,7 @@ impl Fs {
|
||||
|
||||
Ok(Fs {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_FS as u32,
|
||||
device_type: VirtioDeviceType::Fs as u32,
|
||||
avail_features,
|
||||
acked_features,
|
||||
queue_sizes: vec![queue_size; num_queues],
|
||||
|
||||
@@ -151,7 +151,7 @@ impl Net {
|
||||
Ok(Net {
|
||||
id,
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_NET as u32,
|
||||
device_type: VirtioDeviceType::Net as u32,
|
||||
queue_sizes: vec![vu_cfg.queue_size; queue_num],
|
||||
avail_features,
|
||||
acked_features,
|
||||
|
||||
@@ -333,7 +333,7 @@ where
|
||||
|
||||
Ok(Vsock {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_VSOCK as u32,
|
||||
device_type: VirtioDeviceType::Vsock as u32,
|
||||
avail_features,
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
@@ -566,10 +566,7 @@ mod tests {
|
||||
(driver_features & 0xffff_ffff) as u32,
|
||||
(driver_features >> 32) as u32,
|
||||
];
|
||||
assert_eq!(
|
||||
ctx.device.device_type(),
|
||||
VirtioDeviceType::TYPE_VSOCK as u32
|
||||
);
|
||||
assert_eq!(ctx.device.device_type(), VirtioDeviceType::Vsock as u32);
|
||||
assert_eq!(ctx.device.queue_max_sizes(), QUEUE_SIZES);
|
||||
assert_eq!(ctx.device.features() as u32, device_pages[0]);
|
||||
assert_eq!((ctx.device.features() >> 32) as u32, device_pages[1]);
|
||||
|
||||
@@ -189,7 +189,7 @@ impl Watchdog {
|
||||
let timer = unsafe { File::from_raw_fd(timer_fd) };
|
||||
Ok(Watchdog {
|
||||
common: VirtioCommon {
|
||||
device_type: VirtioDeviceType::TYPE_WATCHDOG as u32,
|
||||
device_type: VirtioDeviceType::Watchdog as u32,
|
||||
queue_sizes: QUEUE_SIZES.to_vec(),
|
||||
paused_sync: Some(Arc::new(Barrier::new(2))),
|
||||
avail_features,
|
||||
|
||||
Reference in New Issue
Block a user