From 9552c9c23d12a201d9bd66197542073467c1a2ef Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Tue, 2 Jul 2024 16:35:19 +0200 Subject: [PATCH] sysinfo: Remove duplicate FrequencyDetectionFailed --- src/arch/mod.rs | 8 ++++---- src/arch/x86_64/mod.rs | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/arch/mod.rs b/src/arch/mod.rs index 594b290e..8b7147c6 100644 --- a/src/arch/mod.rs +++ b/src/arch/mod.rs @@ -1,6 +1,10 @@ use sysinfo::System; use thiserror::Error; +#[derive(Error, Debug)] +#[error("Frequency detection failed")] +pub struct FrequencyDetectionFailed; + #[cfg(target_arch = "x86_64")] pub mod x86_64; @@ -13,10 +17,6 @@ pub mod aarch64; #[cfg(target_arch = "aarch64")] pub use self::aarch64::*; -#[derive(Error, Debug)] -#[error("Frequency detection failed")] -pub struct FrequencyDetectionFailed; - pub fn detect_freq_from_sysinfo() -> std::result::Result { debug!("Trying to detect CPU frequency using sysinfo"); diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index a898b314..4c6341fa 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -8,7 +8,6 @@ use std::{ use log::{debug, warn}; use raw_cpuid::{CpuId, CpuIdReaderNative}; -use thiserror::Error; use uhyve_interface::{GuestPhysAddr, GuestVirtAddr}; use x86_64::{ structures::paging::{ @@ -24,9 +23,7 @@ pub const RAM_START: GuestPhysAddr = GuestPhysAddr::new(0x00); const MHZ_TO_HZ: u64 = 1000000; const KHZ_TO_HZ: u64 = 1000; -#[derive(Error, Debug)] -#[error("Frequency detection failed")] -pub struct FrequencyDetectionFailed; +use crate::arch::FrequencyDetectionFailed; pub fn detect_freq_from_cpuid( cpuid: &CpuId,