Fix compiler warnings

This commit is contained in:
Bruce Leidl 2023-01-26 15:49:12 -05:00
parent 45bfd42fec
commit ced3f6a4a8
9 changed files with 29 additions and 29 deletions

View File

@ -46,15 +46,15 @@ pub trait FileSystemOps: Clone+Sync+Send {
#[derive(Clone)]
pub struct FileSystem {
root: PathBuf,
readonly: bool,
_root: PathBuf,
_readonly: bool,
euid_root: bool,
}
impl FileSystem {
pub fn new(root: PathBuf, readonly: bool) -> FileSystem {
let euid_root = Self::is_euid_root();
FileSystem { root, readonly, euid_root }
FileSystem { _root: root, _readonly: readonly, euid_root }
}
pub fn is_euid_root() -> bool {

View File

@ -22,7 +22,7 @@ struct NodeData {
qid: Qid,
size: u64,
mode: u32,
inode: u32,
_inode: u32,
}
impl NodeData {
@ -163,7 +163,7 @@ impl NodeData {
NodeData {
name: name.into(),
qid: Self::create_qid(qtype, inode),
size, mode, inode,
size, mode, _inode: inode,
}
}

View File

@ -7,10 +7,10 @@ use crate::virtio::{VirtioBus, VirtioDeviceOps, VirtQueue, DeviceConfigArea, Cha
use crate::memory::MemoryManager;
use crate::disk::DiskImage;
const VIRTIO_BLK_F_RO: u64 = (1 << 5);
const VIRTIO_BLK_F_BLK_SIZE: u64 = (1 << 6);
const VIRTIO_BLK_F_FLUSH: u64 = (1 << 9);
const VIRTIO_BLK_F_SEG_MAX: u64 = (1 << 2);
const VIRTIO_BLK_F_RO: u64 = 1 << 5;
const VIRTIO_BLK_F_BLK_SIZE: u64 = 1 << 6;
const VIRTIO_BLK_F_FLUSH: u64 = 1 << 9;
const VIRTIO_BLK_F_SEG_MAX: u64 = 1 << 2;
const VIRTIO_BLK_T_IN: u32 = 0;
const VIRTIO_BLK_T_OUT: u32 = 1;

View File

@ -119,14 +119,14 @@ impl Kvm {
#[derive(Clone)]
pub struct KvmVcpu {
id: usize,
_id: usize,
cpufd: Arc<ioctl::VcpuFd>,
sysfd: Arc<ioctl::SysFd>,
}
impl KvmVcpu {
fn new(id: usize, cpufd: Arc<ioctl::VcpuFd>, sysfd: Arc<ioctl::SysFd>) -> KvmVcpu {
KvmVcpu { id, cpufd, sysfd }
KvmVcpu { _id: id, cpufd, sysfd }
}
pub fn raw_fd(&self) -> RawFd {

View File

@ -97,9 +97,9 @@ pub const _VIRTIO_CONFIG_S_FAILED : u8 = 0x80;
pub const _VRING_USED_F_NO_NOTIFY: u16 = 1;
pub const _VRING_AVAIL_F_NO_INTERRUPT: u16 = 1;
pub const _VIRTIO_F_INDIRECT_DESC: u64 = (1 << 28);
pub const VIRTIO_F_EVENT_IDX: u64 = (1 << 29);
pub const VIRTIO_F_VERSION_1: u64 = (1 << 32);
pub const _VIRTIO_F_INDIRECT_DESC: u64 = 1 << 28;
pub const VIRTIO_F_EVENT_IDX: u64 = 1 << 29;
pub const VIRTIO_F_VERSION_1: u64 = 1 << 32;
pub const VRING_DESC_F_NEXT: u16 = 1;
pub const VRING_DESC_F_WRITE: u16 = 2;

View File

@ -100,26 +100,26 @@ pub fn load_elf_kernel(memory: &GuestRam) -> io::Result<()> {
struct ElfPhdr {
pub p_type: u32,
pub p_flags: u32,
pub _p_flags: u32,
pub p_offset: u64,
pub p_vaddr: u64,
pub _p_vaddr: u64,
pub p_paddr: u64,
pub p_filesz: u64,
pub p_memsz: u64,
pub p_align: u64,
pub _p_memsz: u64,
pub _p_align: u64,
}
impl ElfPhdr {
fn load_from(buf: &mut ByteBuffer<&[u8]>) -> Self {
ElfPhdr {
p_type: buf.read(),
p_flags: buf.read(),
_p_flags: buf.read(),
p_offset: buf.read(),
p_vaddr: buf.read(),
_p_vaddr: buf.read(),
p_paddr: buf.read(),
p_filesz: buf.read(),
p_memsz: buf.read(),
p_align: buf.read(),
_p_memsz: buf.read(),
_p_align: buf.read(),
}
}

View File

@ -8,8 +8,8 @@ use crate::system;
use crate::vm::arch::x86::mptable::setup_mptable;
use crate::virtio::PciIrq;
pub const HIMEM_BASE: u64 = (1 << 32);
pub const PCI_MMIO_RESERVED_SIZE: usize = (512 << 20);
pub const HIMEM_BASE: u64 = 1 << 32;
pub const PCI_MMIO_RESERVED_SIZE: usize = 512 << 20;
pub const PCI_MMIO_RESERVED_BASE: u64 = HIMEM_BASE - PCI_MMIO_RESERVED_SIZE as u64;
@ -69,9 +69,9 @@ fn write_gdt_table(table: &[u64], memory: &GuestRam) -> system::Result<()> {
}
pub fn gdt_entry(flags: u16, base: u32, limit: u32) -> u64 {
((((base as u64) & 0xff000000u64) << (56 - 24)) | (((flags as u64) & 0x0000f0ffu64) << 40) |
(((base as u64) & 0xff000000u64) << (56 - 24)) | (((flags as u64) & 0x0000f0ffu64) << 40) |
(((limit as u64) & 0x000f0000u64) << (48 - 16)) |
(((base as u64) & 0x00ffffffu64) << 16) | ((limit as u64) & 0x0000ffffu64))
(((base as u64) & 0x00ffffffu64) << 16) | ((limit as u64) & 0x0000ffffu64)
}
pub fn setup_gdt(memory: &GuestRam) -> Result<()> {

View File

@ -56,7 +56,7 @@ const X86_CR0_PG: u64 = 0x80000000;
const X86_CR4_PAE: u64 = 0x20;
const EFER_LME: u64 = 0x100;
const EFER_LMA: u64 = (1 << 10);
const EFER_LMA: u64 = 1 << 10;
pub fn setup_pm_sregs(vcpu: &KvmVcpu) -> Result<()> {

View File

@ -166,9 +166,9 @@ impl KvmRunArea {
fn handle_exit_mmio(&mut self) {
let exit = self.get_mmio_exit();
if exit.write {
self.handle_mmio_write(exit.phys, exit.size)
self.handle_mmio_write(exit.phys, exit.size);
} else {
self.handle_mmio_read(exit.phys, exit.size)
self.handle_mmio_read(exit.phys, exit.size);
}
}