From d6bcd9d6aab7f7bbb6eefa36b4f2ca6b9a3bc030 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Fri, 7 Feb 2025 17:17:03 +0000 Subject: [PATCH] fix: delete never constructed error enum variants All of these were dead code (but the compiler isn't able to tell us because the vmm crate is a library crate where everything is `pub`, and it doesn't know that no downstream users outside of the `firecracker` crate exist, and that everything that's not used in `firecracker` is dead code). Signed-off-by: Patrick Roy --- src/vmm/src/persist.rs | 13 ------------- src/vmm/src/vstate/memory.rs | 4 ---- src/vmm/src/vstate/vm/mod.rs | 2 -- src/vmm/src/vstate/vm/x86_64.rs | 4 ---- 4 files changed, 23 deletions(-) diff --git a/src/vmm/src/persist.rs b/src/vmm/src/persist.rs index 05529107b6b4..d62ffc846004 100644 --- a/src/vmm/src/persist.rs +++ b/src/vmm/src/persist.rs @@ -114,18 +114,10 @@ pub struct GuestRegionUffdMapping { /// Errors related to saving and restoring Microvm state. #[derive(Debug, thiserror::Error, displaydoc::Display)] pub enum MicrovmStateError { - /// Compatibility checks failed: {0} - IncompatibleState(String), - /// Provided MicroVM state is invalid. - InvalidInput, /// Operation not allowed: {0} NotAllowed(String), /// Cannot restore devices: {0} RestoreDevices(DevicePersistError), - /// Cannot restore Vcpu state: {0} - RestoreVcpuState(vstate::vcpu::VcpuError), - /// Cannot restore Vm state: {0} - RestoreVmState(vstate::vm::VmError), /// Cannot save Vcpu state: {0} SaveVcpuState(vstate::vcpu::VcpuError), /// Cannot save Vm state: {0} @@ -142,9 +134,6 @@ pub enum MicrovmStateError { pub enum CreateSnapshotError { /// Cannot get dirty bitmap: {0} DirtyBitmap(VmmError), - #[rustfmt::skip] - /// Cannot translate microVM version to snapshot data version - UnsupportedVersion, /// Cannot write memory file: {0} Memory(MemoryError), /// Cannot perform {0} on the memory backing file: {1} @@ -155,8 +144,6 @@ pub enum CreateSnapshotError { SerializeMicrovmState(crate::snapshot::SnapshotError), /// Cannot perform {0} on the snapshot backing file: {1} SnapshotBackingFile(&'static str, io::Error), - /// Size mismatch when writing diff snapshot on top of base layer: base layer size is {0} but diff layer is size {1}. - SnapshotBackingFileLengthMismatch(u64, u64), } /// Snapshot version diff --git a/src/vmm/src/vstate/memory.rs b/src/vmm/src/vstate/memory.rs index b89de3453c2a..a8373654d102 100644 --- a/src/vmm/src/vstate/memory.rs +++ b/src/vmm/src/vstate/memory.rs @@ -36,10 +36,6 @@ pub type GuestMmapRegion = vm_memory::MmapRegion>; /// Errors associated with dumping guest memory to file. #[derive(Debug, thiserror::Error, displaydoc::Display)] pub enum MemoryError { - /// Cannot create memory: {0} - CreateMemory(VmMemoryError), - /// Cannot create memory region: {0} - CreateRegion(MmapRegionError), /// Cannot fetch system's page size: {0} PageSize(errno::Error), /// Cannot dump memory: {0} diff --git a/src/vmm/src/vstate/vm/mod.rs b/src/vmm/src/vstate/vm/mod.rs index 7d9d3e04ba9c..c9c0e7e7c2ff 100644 --- a/src/vmm/src/vstate/vm/mod.rs +++ b/src/vmm/src/vstate/vm/mod.rs @@ -32,8 +32,6 @@ pub enum VmError { SetUserMemoryRegion(kvm_ioctls::Error), /// Cannot open the VM file descriptor: {0} VmFd(kvm_ioctls::Error), - /// Cannot configure the microvm: {0} - VmSetup(kvm_ioctls::Error), /// {0} Arch(#[from] ArchVmError), /// Error during eventfd operations: {0} diff --git a/src/vmm/src/vstate/vm/x86_64.rs b/src/vmm/src/vstate/vm/x86_64.rs index 625513352c68..87232098f0a3 100644 --- a/src/vmm/src/vstate/vm/x86_64.rs +++ b/src/vmm/src/vstate/vm/x86_64.rs @@ -35,10 +35,6 @@ pub enum ArchVmError { VmGetClock(kvm_ioctls::Error), /// Failed to get KVM vm irqchip: {0} VmGetIrqChip(kvm_ioctls::Error), - /// Failed to set KVM vm pit state: {0} - VmSetPit2(kvm_ioctls::Error), - /// Failed to set KVM vm clock: {0} - VmSetClock(kvm_ioctls::Error), /// Failed to set KVM vm irqchip: {0} VmSetIrqChip(kvm_ioctls::Error), /// Failed to get MSR index list to save into snapshots: {0}