From 461c752f65ba57b6ee4119e032a1e78cd031e742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20L=C3=B3pez?= Date: Mon, 17 Jun 2024 17:11:19 +0200 Subject: [PATCH] Various minor fixes for rust 1.79.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergio López --- src/arch/src/x86_64/mptable.rs | 2 +- src/devices/src/virtio/block/worker.rs | 1 + src/devices/src/virtio/fs/filesystem.rs | 4 ++-- src/devices/src/virtio/fs/linux/passthrough.rs | 4 ++-- src/devices/src/virtio/fs/macos/passthrough.rs | 4 ++-- src/devices/src/virtio/fs/server.rs | 6 +++--- src/devices/src/virtio/net/backend.rs | 3 +++ src/devices/src/virtio/vsock/proxy.rs | 1 + src/rutabaga_gfx/src/renderer_utils.rs | 1 + 9 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/arch/src/x86_64/mptable.rs b/src/arch/src/x86_64/mptable.rs index 5abcc462..4d3eab58 100644 --- a/src/arch/src/x86_64/mptable.rs +++ b/src/arch/src/x86_64/mptable.rs @@ -90,7 +90,7 @@ const MPC_SIGNATURE: [c_char; 4] = char_array!(c_char; 'P', 'C', 'M', 'P'); const MPC_SPEC: i8 = 4; const MPC_OEM: [c_char; 8] = char_array!(c_char; 'F', 'C', ' ', ' ', ' ', ' ', ' ', ' '); const MPC_PRODUCT_ID: [c_char; 12] = ['0' as c_char; 12]; -const BUS_TYPE_ISA: [u8; 6] = char_array!(u8; 'I', 'S', 'A', ' ', ' ', ' '); +const BUS_TYPE_ISA: [u8; 6] = char_array!(u8; b'I', b'S', b'A', b' ', b' ', b' '); const IO_APIC_DEFAULT_PHYS_BASE: u32 = 0xfec0_0000; // source: linux/arch/x86/include/asm/apicdef.h const APIC_DEFAULT_PHYS_BASE: u32 = 0xfee0_0000; // source: linux/arch/x86/include/asm/apicdef.h const APIC_VERSION: u8 = 0x14; diff --git a/src/devices/src/virtio/block/worker.rs b/src/devices/src/virtio/block/worker.rs index 0cf2870e..cf7e5a36 100644 --- a/src/devices/src/virtio/block/worker.rs +++ b/src/devices/src/virtio/block/worker.rs @@ -16,6 +16,7 @@ use utils::eventfd::EventFd; use virtio_bindings::virtio_blk::*; use vm_memory::{ByteValued, GuestMemoryMmap}; +#[allow(dead_code)] #[derive(Debug)] pub enum RequestError { FlushingToDisk(io::Error), diff --git a/src/devices/src/virtio/fs/filesystem.rs b/src/devices/src/virtio/fs/filesystem.rs index 3dd62de3..80ebdb09 100644 --- a/src/devices/src/virtio/fs/filesystem.rs +++ b/src/devices/src/virtio/fs/filesystem.rs @@ -175,7 +175,7 @@ pub trait ZeroCopyReader { fn copy_to_end(&mut self, f: &mut File, mut off: u64) -> io::Result { let mut out = 0; loop { - match self.read_to(f, ::std::usize::MAX, off) { + match self.read_to(f, usize::MAX, off) { Ok(0) => return Ok(out), Ok(n) => { off = off.saturating_add(n as u64); @@ -268,7 +268,7 @@ pub trait ZeroCopyWriter { fn copy_to_end(&mut self, f: &mut File, mut off: u64) -> io::Result { let mut out = 0; loop { - match self.write_from(f, ::std::usize::MAX, off) { + match self.write_from(f, usize::MAX, off) { Ok(0) => return Ok(out), Ok(n) => { off = off.saturating_add(n as u64); diff --git a/src/devices/src/virtio/fs/linux/passthrough.rs b/src/devices/src/virtio/fs/linux/passthrough.rs index d984320c..ee181428 100644 --- a/src/devices/src/virtio/fs/linux/passthrough.rs +++ b/src/devices/src/virtio/fs/linux/passthrough.rs @@ -1120,13 +1120,13 @@ impl FileSystem for PassthroughFs { attr.st_uid } else { // Cannot use -1 here because these are unsigned values. - ::std::u32::MAX + u32::MAX }; let gid = if valid.contains(SetattrValid::GID) { attr.st_gid } else { // Cannot use -1 here because these are unsigned values. - ::std::u32::MAX + u32::MAX }; // Safe because this is a constant value and a valid C string. diff --git a/src/devices/src/virtio/fs/macos/passthrough.rs b/src/devices/src/virtio/fs/macos/passthrough.rs index f71ff38a..ae42a5fd 100644 --- a/src/devices/src/virtio/fs/macos/passthrough.rs +++ b/src/devices/src/virtio/fs/macos/passthrough.rs @@ -1169,13 +1169,13 @@ impl FileSystem for PassthroughFs { attr.st_uid } else { // Cannot use -1 here because these are unsigned values. - ::std::u32::MAX + u32::MAX }; let gid = if valid.contains(SetattrValid::GID) { attr.st_gid } else { // Cannot use -1 here because these are unsigned values. - ::std::u32::MAX + u32::MAX }; set_xattr_stat(StatFile::Path(&c_path), Some((uid, gid)), None)?; diff --git a/src/devices/src/virtio/fs/server.rs b/src/devices/src/virtio/fs/server.rs index ac9edb80..2133cec7 100644 --- a/src/devices/src/virtio/fs/server.rs +++ b/src/devices/src/virtio/fs/server.rs @@ -880,8 +880,8 @@ impl Server { minor: KERNEL_MINOR_VERSION, max_readahead, flags: enabled as u32, - max_background: ::std::u16::MAX, - congestion_threshold: (::std::u16::MAX / 4) * 3, + max_background: u16::MAX, + congestion_threshold: (u16::MAX / 4) * 3, max_write: MAX_BUFFER_SIZE, time_gran: 1, // nanoseconds max_pages: max_pages.try_into().unwrap(), @@ -1432,7 +1432,7 @@ fn add_dirent( d: DirEntry, entry: Option, ) -> io::Result { - if d.name.len() > ::std::u32::MAX as usize { + if d.name.len() > u32::MAX as usize { return Err(io::Error::from_raw_os_error(libc::EOVERFLOW)); } diff --git a/src/devices/src/virtio/net/backend.rs b/src/devices/src/virtio/net/backend.rs index f88c9fdd..c3da3290 100644 --- a/src/devices/src/virtio/net/backend.rs +++ b/src/devices/src/virtio/net/backend.rs @@ -1,5 +1,6 @@ use std::os::fd::RawFd; +#[allow(dead_code)] #[derive(Debug)] pub enum ConnectError { InvalidAddress(nix::Error), @@ -8,6 +9,7 @@ pub enum ConnectError { SendingMagic(nix::Error), } +#[allow(dead_code)] #[derive(Debug)] pub enum ReadError { /// Nothing was written @@ -16,6 +18,7 @@ pub enum ReadError { Internal(nix::Error), } +#[allow(dead_code)] #[derive(Debug)] pub enum WriteError { /// Nothing was written, you can drop the frame or try to resend it later diff --git a/src/devices/src/virtio/vsock/proxy.rs b/src/devices/src/virtio/vsock/proxy.rs index 70ea5528..e7e19f15 100644 --- a/src/devices/src/virtio/vsock/proxy.rs +++ b/src/devices/src/virtio/vsock/proxy.rs @@ -14,6 +14,7 @@ pub enum RecvPkt { WaitForCredit, } +#[allow(dead_code)] #[derive(Debug)] pub enum ProxyError { CreatingSocket(nix::errno::Errno), diff --git a/src/rutabaga_gfx/src/renderer_utils.rs b/src/rutabaga_gfx/src/renderer_utils.rs index 8c239596..3458e013 100644 --- a/src/rutabaga_gfx/src/renderer_utils.rs +++ b/src/rutabaga_gfx/src/renderer_utils.rs @@ -28,6 +28,7 @@ pub fn ret_to_res(ret: i32) -> RutabagaResult<()> { } } +#[allow(dead_code)] pub struct RutabagaCookie { pub render_server_fd: Option, pub fence_handler: Option,