mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block, pci, rate_limiter, vm-allocator: drop legacy numeric constants
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -409,7 +409,7 @@ impl BusDevice for PciConfigMmio {
|
||||
// Only allow reads to the register boundary.
|
||||
let start = offset as usize % 4;
|
||||
let end = start + data.len();
|
||||
if end > 4 || offset > u64::from(u32::max_value()) {
|
||||
if end > 4 || offset > u64::from(u32::MAX) {
|
||||
for d in data {
|
||||
*d = 0xff;
|
||||
}
|
||||
@@ -423,7 +423,7 @@ impl BusDevice for PciConfigMmio {
|
||||
}
|
||||
|
||||
fn write(&mut self, _base: u64, offset: u64, data: &[u8]) -> Option<Arc<Barrier>> {
|
||||
if offset > u64::from(u32::max_value()) {
|
||||
if offset > u64::from(u32::MAX) {
|
||||
return None;
|
||||
}
|
||||
self.config_space_write(offset as u32, offset % 4, data);
|
||||
|
||||
@@ -743,7 +743,7 @@ impl PciConfiguration {
|
||||
.ok_or(Error::BarAddressInvalid(config.addr, config.size))?;
|
||||
match config.region_type {
|
||||
PciBarRegionType::Memory32BitRegion | PciBarRegionType::IoRegion => {
|
||||
if end_addr > u64::from(u32::max_value()) {
|
||||
if end_addr > u64::from(u32::MAX) {
|
||||
return Err(Error::BarAddressInvalid(config.addr, config.size));
|
||||
}
|
||||
|
||||
@@ -814,7 +814,7 @@ impl PciConfiguration {
|
||||
.checked_add(config.size - 1)
|
||||
.ok_or(Error::RomBarAddressInvalid(config.addr, config.size))?;
|
||||
|
||||
if end_addr > u64::from(u32::max_value()) {
|
||||
if end_addr > u64::from(u32::MAX) {
|
||||
return Err(Error::RomBarAddressInvalid(config.addr, config.size));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ use std::any::Any;
|
||||
use std::os::unix::prelude::AsRawFd;
|
||||
use std::ptr::null_mut;
|
||||
use std::sync::{Arc, Barrier, Mutex};
|
||||
use std::u32;
|
||||
use thiserror::Error;
|
||||
use vfio_bindings::bindings::vfio::*;
|
||||
use vfio_ioctls::VfioIrq;
|
||||
|
||||
Reference in New Issue
Block a user