Skip to content

Commit

Permalink
fix: delete never constructed error enum variants
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
roypat committed Feb 17, 2025
1 parent 53da073 commit d6bcd9d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 23 deletions.
13 changes: 0 additions & 13 deletions src/vmm/src/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/vmm/src/vstate/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ pub type GuestMmapRegion = vm_memory::MmapRegion<Option<AtomicBitmap>>;
/// 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}
Expand Down
2 changes: 0 additions & 2 deletions src/vmm/src/vstate/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 0 additions & 4 deletions src/vmm/src/vstate/vm/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit d6bcd9d

Please sign in to comment.