Skip to content

Commit bd7b26d

Browse files
committed
License header + cargo fmt
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 1146fb7 commit bd7b26d

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

src/hyperlight_host/src/hypervisor/hyperlight_vm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,18 @@ use crate::hypervisor::LinuxInterruptHandle;
4141
#[cfg(crashdump)]
4242
use crate::hypervisor::crashdump;
4343
use crate::hypervisor::regs::CommonSpecialRegisters;
44-
use crate::hypervisor::vm::HypervisorType;
4544
#[cfg(not(gdb))]
4645
use crate::hypervisor::vm::Vm;
47-
use crate::hypervisor::vm::get_available_hypervisor;
4846
#[cfg(kvm)]
4947
use crate::hypervisor::vm::kvm::KvmVm;
5048
#[cfg(mshv3)]
5149
use crate::hypervisor::vm::mshv::MshvVm;
5250
#[cfg(target_os = "windows")]
5351
use crate::hypervisor::vm::whp::WhpVm;
52+
use crate::hypervisor::vm::{HypervisorType, VmExit, get_available_hypervisor};
5453
#[cfg(target_os = "windows")]
5554
use crate::hypervisor::wrappers::HandleWrapper;
56-
use crate::hypervisor::{InterruptHandle, InterruptHandleImpl, get_max_log_level, vm::VmExit};
55+
use crate::hypervisor::{InterruptHandle, InterruptHandleImpl, get_max_log_level};
5756
use crate::mem::memory_region::{MemoryRegion, MemoryRegionFlags, MemoryRegionType};
5857
use crate::mem::mgr::SandboxMemoryManager;
5958
use crate::mem::ptr::{GuestPtr, RawPtr};

src/hyperlight_host/src/hypervisor/vm/kvm.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use tracing::{Span, instrument};
2626
#[cfg(gdb)]
2727
use crate::hypervisor::gdb::DebuggableVm;
2828
use crate::hypervisor::regs::{CommonFpu, CommonRegisters, CommonSpecialRegisters};
29-
use crate::hypervisor::vm::{VmExit, Vm};
29+
use crate::hypervisor::vm::{Vm, VmExit};
3030
use crate::mem::memory_region::MemoryRegion;
3131
use crate::{Result, new_error};
3232

@@ -119,10 +119,7 @@ impl Vm for KvmVm {
119119
// InterruptHandle::kill() sends a signal (SIGRTMIN+offset) to interrupt the vcpu, which causes EINTR
120120
libc::EINTR => Ok(VmExit::Cancelled()),
121121
libc::EAGAIN => Ok(VmExit::Retry()),
122-
_ => Ok(VmExit::Unknown(format!(
123-
"Unknown KVM VCPU error: {}",
124-
e
125-
))),
122+
_ => Ok(VmExit::Unknown(format!("Unknown KVM VCPU error: {}", e))),
126123
},
127124
Ok(other) => Ok(VmExit::Unknown(format!(
128125
"Unknown KVM VCPU exit: {:?}",

src/hyperlight_host/src/hypervisor/vm/mod.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
/*
2+
Copyright 2025 The Hyperlight Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
use std::fmt::Debug;
18+
use std::sync::OnceLock;
19+
120
use tracing::{Span, instrument};
221

322
use crate::Result;
423
use crate::hypervisor::regs::{CommonFpu, CommonRegisters, CommonSpecialRegisters};
524
use crate::mem::memory_region::MemoryRegion;
6-
use std::fmt::Debug;
725

826
#[cfg(kvm)]
927
/// Functionality to manipulate KVM-based virtual machines
@@ -14,8 +32,6 @@ pub(crate) mod mshv;
1432
#[cfg(target_os = "windows")]
1533
pub(crate) mod whp;
1634

17-
use std::sync::OnceLock;
18-
1935
static AVAILABLE_HYPERVISOR: OnceLock<Option<HypervisorType>> = OnceLock::new();
2036

2137
/// Returns which type of hypervisor is available, if any

src/hyperlight_host/src/hypervisor/vm/mshv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use tracing::{Span, instrument};
3434
#[cfg(gdb)]
3535
use crate::hypervisor::gdb::DebuggableVm;
3636
use crate::hypervisor::regs::{CommonFpu, CommonRegisters, CommonSpecialRegisters};
37-
use crate::hypervisor::vm::{VmExit, Vm};
37+
use crate::hypervisor::vm::{Vm, VmExit};
3838
use crate::mem::memory_region::{MemoryRegion, MemoryRegionFlags};
3939
use crate::{Result, new_error};
4040

src/hyperlight_host/src/hypervisor/vm/whp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::hypervisor::regs::{
3131
};
3232
use crate::hypervisor::surrogate_process::SurrogateProcess;
3333
use crate::hypervisor::surrogate_process_manager::get_surrogate_process_manager;
34-
use crate::hypervisor::vm::{VmExit, Vm};
34+
use crate::hypervisor::vm::{Vm, VmExit};
3535
use crate::hypervisor::wrappers::HandleWrapper;
3636
use crate::mem::memory_region::{MemoryRegion, MemoryRegionFlags};
3737
use crate::{Result, log_then_return, new_error};

0 commit comments

Comments
 (0)