diff --git a/src/arch/src/x86_64/layout.rs b/src/arch/src/x86_64/layout.rs index fd5b2ef4..ca92736b 100644 --- a/src/arch/src/x86_64/layout.rs +++ b/src/arch/src/x86_64/layout.rs @@ -5,7 +5,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the THIRD-PARTY file. -/// Magic addresses externally used to lay out x86_64 VMs. +//! Magic addresses externally used to lay out x86_64 VMs. /// Initial stack for the boot CPU. pub const BOOT_STACK_POINTER: u64 = 0x8ff0; diff --git a/src/devices/src/virtio/descriptor_utils.rs b/src/devices/src/virtio/descriptor_utils.rs index 8af40cec..a43e66f8 100644 --- a/src/devices/src/virtio/descriptor_utils.rs +++ b/src/devices/src/virtio/descriptor_utils.rs @@ -307,7 +307,7 @@ impl<'a> Reader<'a> { } } -impl<'a> io::Read for Reader<'a> { +impl io::Read for Reader<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.buffer.consume(buf.len(), |bufs| { let mut rem = buf; @@ -448,7 +448,7 @@ impl<'a> Writer<'a> { } } -impl<'a> io::Write for Writer<'a> { +impl io::Write for Writer<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.buffer.consume(buf.len(), |bufs| { let mut rem = buf; diff --git a/src/devices/src/virtio/file_traits.rs b/src/devices/src/virtio/file_traits.rs index 2e13eb67..72ab0e31 100644 --- a/src/devices/src/virtio/file_traits.rs +++ b/src/devices/src/virtio/file_traits.rs @@ -97,7 +97,7 @@ pub trait FileReadWriteVolatile { } } -impl<'a, T: FileReadWriteVolatile + ?Sized> FileReadWriteVolatile for &'a mut T { +impl FileReadWriteVolatile for &mut T { fn read_volatile(&mut self, slice: VolatileSlice) -> Result { (**self).read_volatile(slice) } @@ -194,7 +194,7 @@ pub trait FileReadWriteAtVolatile { } } -impl<'a, T: FileReadWriteAtVolatile + ?Sized> FileReadWriteAtVolatile for &'a T { +impl FileReadWriteAtVolatile for &T { fn read_at_volatile(&self, slice: VolatileSlice, offset: u64) -> Result { (**self).read_at_volatile(slice, offset) } diff --git a/src/devices/src/virtio/fs/filesystem.rs b/src/devices/src/virtio/fs/filesystem.rs index 4d032cf8..ed1284d8 100644 --- a/src/devices/src/virtio/fs/filesystem.rs +++ b/src/devices/src/virtio/fs/filesystem.rs @@ -198,7 +198,7 @@ pub trait ZeroCopyReader { } } -impl<'a, R: ZeroCopyReader> ZeroCopyReader for &'a mut R { +impl ZeroCopyReader for &mut R { fn read_to(&mut self, f: &File, count: usize, off: u64) -> io::Result { (**self).read_to(f, count, off) } @@ -291,7 +291,7 @@ pub trait ZeroCopyWriter { } } -impl<'a, W: ZeroCopyWriter> ZeroCopyWriter for &'a mut W { +impl ZeroCopyWriter for &mut W { fn write_from(&mut self, f: &File, count: usize, off: u64) -> io::Result { (**self).write_from(f, count, off) } diff --git a/src/devices/src/virtio/fs/server.rs b/src/devices/src/virtio/fs/server.rs index 5efb1f3b..b477a099 100644 --- a/src/devices/src/virtio/fs/server.rs +++ b/src/devices/src/virtio/fs/server.rs @@ -34,13 +34,13 @@ const DIRENT_PADDING: [u8; 8] = [0; 8]; struct ZCReader<'a>(Reader<'a>); -impl<'a> ZeroCopyReader for ZCReader<'a> { +impl ZeroCopyReader for ZCReader<'_> { fn read_to(&mut self, f: &File, count: usize, off: u64) -> io::Result { self.0.read_to_at(f, count, off) } } -impl<'a> io::Read for ZCReader<'a> { +impl io::Read for ZCReader<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } @@ -48,13 +48,13 @@ impl<'a> io::Read for ZCReader<'a> { struct ZCWriter<'a>(Writer<'a>); -impl<'a> ZeroCopyWriter for ZCWriter<'a> { +impl ZeroCopyWriter for ZCWriter<'_> { fn write_from(&mut self, f: &File, count: usize, off: u64) -> io::Result { self.0.write_from_at(f, count, off) } } -impl<'a> io::Write for ZCWriter<'a> { +impl io::Write for ZCWriter<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) } diff --git a/src/devices/src/virtio/net/worker.rs b/src/devices/src/virtio/net/worker.rs index fb669058..d07f905e 100644 --- a/src/devices/src/virtio/net/worker.rs +++ b/src/devices/src/virtio/net/worker.rs @@ -398,9 +398,7 @@ impl NetWorker { let mut result: std::result::Result<(), FrontendError> = Ok(()); let queue = &mut self.queues[RX_INDEX]; - let head_descriptor = queue - .pop(&self.mem) - .ok_or_else(|| FrontendError::EmptyQueue)?; + let head_descriptor = queue.pop(&self.mem).ok_or(FrontendError::EmptyQueue)?; let head_index = head_descriptor.index; let mut frame_slice = &self.rx_frame_buf[..self.rx_frame_buf_len]; diff --git a/src/devices/src/virtio/queue.rs b/src/devices/src/virtio/queue.rs index 954d415f..a0bdc04a 100644 --- a/src/devices/src/virtio/queue.rs +++ b/src/devices/src/virtio/queue.rs @@ -151,7 +151,6 @@ unsafe impl ByteValued for VirtqUsedElem {} /// An iterator over a single descriptor chain. Not to be confused with AvailIter, /// which iterates over the descriptor chain heads in a queue. - pub struct DescIter<'a> { next: Option>, } diff --git a/src/hvf/src/lib.rs b/src/hvf/src/lib.rs index caa00a90..67af35f7 100644 --- a/src/hvf/src/lib.rs +++ b/src/hvf/src/lib.rs @@ -247,7 +247,7 @@ pub struct HvfVcpu<'a> { pending_advance_pc: bool, } -impl<'a> HvfVcpu<'a> { +impl HvfVcpu<'_> { pub fn new() -> Result { let mut vcpuid: hv_vcpu_t = 0; let vcpu_exit_ptr: *mut hv_vcpu_exit_t = std::ptr::null_mut(); diff --git a/src/vmm/src/vmm_config/boot_source.rs b/src/vmm/src/vmm_config/boot_source.rs index 9c70d5b1..bb6d2cb2 100644 --- a/src/vmm/src/vmm_config/boot_source.rs +++ b/src/vmm/src/vmm_config/boot_source.rs @@ -3,23 +3,9 @@ use std::fmt::{Display, Formatter, Result}; -/// Default guest kernel command line: -/// - `reboot=k` shut down the guest on reboot, instead of well... rebooting; -/// - `panic=1` on panic, reboot after 1 second; -/// - `pci=off` do not scan for PCI devices (save boot time); -/// - `nomodule` disable loadable kernel module support; -/// - `8250.nr_uarts=0` disable 8250 serial interface; -/// - `i8042.noaux` do not probe the i8042 controller for an attached mouse (save boot time); -/// - `i8042.nomux` do not probe i8042 for a multiplexing controller (save boot time); -/// - `i8042.nopnp` do not use ACPIPnP to discover KBD/AUX controllers (save boot time); -/// - `i8042.dumbkbd` do not attempt to control kbd state via the i8042 (save boot time). -//pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=1 pci=off nomodule 8250.nr_uarts=0 \ -// i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd"; - #[cfg(all(target_os = "linux", not(feature = "tee")))] pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=hvc0 \ rootfstype=virtiofs rw quiet no-kvmapf"; - #[cfg(feature = "amd-sev")] pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=hvc0 \ root=/dev/vda rw quiet no-kvmapf"; @@ -27,9 +13,6 @@ pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodu pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=-1 panic_print=0 nomodule console=hvc0 \ rootfstype=virtiofs rw quiet no-kvmapf"; -//pub const DEFAULT_KERNEL_CMDLINE: &str = "reboot=k panic=1 pci=off nomodule earlyprintk=ttyS0 \ -// console=ttyS0"; - /// Strongly typed data structure used to configure the boot source of the /// microvm. #[derive(Debug, Default, Eq, PartialEq)]