Skip to content

Commit

Permalink
Various minor fixes for rust 1.79.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sergio López <slp@redhat.com>
  • Loading branch information
slp committed Jun 18, 2024
1 parent b79f690 commit 461c752
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/arch/src/x86_64/mptable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/devices/src/virtio/block/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/devices/src/virtio/fs/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub trait ZeroCopyReader {
fn copy_to_end(&mut self, f: &mut File, mut off: u64) -> io::Result<usize> {
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);
Expand Down Expand Up @@ -268,7 +268,7 @@ pub trait ZeroCopyWriter {
fn copy_to_end(&mut self, f: &mut File, mut off: u64) -> io::Result<usize> {
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);
Expand Down
4 changes: 2 additions & 2 deletions src/devices/src/virtio/fs/linux/passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/devices/src/virtio/fs/macos/passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
6 changes: 3 additions & 3 deletions src/devices/src/virtio/fs/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,8 @@ impl<F: FileSystem + Sync> Server<F> {
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(),
Expand Down Expand Up @@ -1432,7 +1432,7 @@ fn add_dirent(
d: DirEntry,
entry: Option<Entry>,
) -> io::Result<usize> {
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));
}

Expand Down
3 changes: 3 additions & 0 deletions src/devices/src/virtio/net/backend.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::os::fd::RawFd;

#[allow(dead_code)]
#[derive(Debug)]
pub enum ConnectError {
InvalidAddress(nix::Error),
Expand All @@ -8,6 +9,7 @@ pub enum ConnectError {
SendingMagic(nix::Error),
}

#[allow(dead_code)]
#[derive(Debug)]
pub enum ReadError {
/// Nothing was written
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/devices/src/virtio/vsock/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub enum RecvPkt {
WaitForCredit,
}

#[allow(dead_code)]
#[derive(Debug)]
pub enum ProxyError {
CreatingSocket(nix::errno::Errno),
Expand Down
1 change: 1 addition & 0 deletions src/rutabaga_gfx/src/renderer_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub fn ret_to_res(ret: i32) -> RutabagaResult<()> {
}
}

#[allow(dead_code)]
pub struct RutabagaCookie {
pub render_server_fd: Option<SafeDescriptor>,
pub fence_handler: Option<RutabagaFenceHandler>,
Expand Down

0 comments on commit 461c752

Please sign in to comment.