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:
Rob Bradford
2021-03-25 16:54:09 +00:00
parent 261c039831
commit aa34d545f6
16 changed files with 66 additions and 69 deletions

View File

@@ -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(),

View File

@@ -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],

View File

@@ -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))),

View File

@@ -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

View File

@@ -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(),

View File

@@ -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))),

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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],

View File

@@ -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,

View File

@@ -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]);

View File

@@ -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,