Skip to content

Commit 45f60a9

Browse files
committed
Rename HostFuncsWrapper -> FunctionRegistry
Signed-off-by: Jorge Prendes <[email protected]>
1 parent 6b1951c commit 45f60a9

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

src/hyperlight_host/src/sandbox/host_funcs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::{new_error, Result};
2828

2929
#[derive(Default, Clone)]
3030
/// A Wrapper around details of functions exposed by the Host
31-
pub struct HostFuncsWrapper {
31+
pub struct FunctionRegistry {
3232
functions_map: HashMap<String, FunctionEntry>,
3333
}
3434

@@ -38,7 +38,7 @@ pub struct FunctionEntry {
3838
pub extra_allowed_syscalls: Option<Vec<ExtraAllowedSyscall>>,
3939
}
4040

41-
impl HostFuncsWrapper {
41+
impl FunctionRegistry {
4242
/// Register a host function with the sandbox.
4343
#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
4444
pub(crate) fn register_host_function(

src/hyperlight_host/src/sandbox/initialized_multi_use.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use hyperlight_common::flatbuffer_wrappers::function_types::{
2121
};
2222
use tracing::{instrument, Span};
2323

24-
use super::host_funcs::HostFuncsWrapper;
24+
use super::host_funcs::FunctionRegistry;
2525
use super::{MemMgrWrapper, WrapperGetter};
2626
use crate::func::call_ctx::MultiUseGuestCallContext;
2727
use crate::func::guest_dispatch::call_function_on_guest;
@@ -41,7 +41,7 @@ use crate::Result;
4141
/// in this case the state of the sandbox is not reset until the context is finished and the `MultiUseSandbox` is returned.
4242
pub struct MultiUseSandbox {
4343
// We need to keep a reference to the host functions, even if the compiler marks it as unused. The compiler cannot detect our dynamic usages of the host function in `HyperlightFunction::call`.
44-
pub(super) _host_funcs: Arc<Mutex<HostFuncsWrapper>>,
44+
pub(super) _host_funcs: Arc<Mutex<FunctionRegistry>>,
4545
pub(crate) mem_mgr: MemMgrWrapper<HostSharedMemory>,
4646
hv_handler: HypervisorHandler,
4747
}
@@ -73,7 +73,7 @@ impl MultiUseSandbox {
7373
/// (as a `From` implementation would be)
7474
#[instrument(skip_all, parent = Span::current(), level = "Trace")]
7575
pub(super) fn from_uninit(
76-
host_funcs: Arc<Mutex<HostFuncsWrapper>>,
76+
host_funcs: Arc<Mutex<FunctionRegistry>>,
7777
mgr: MemMgrWrapper<HostSharedMemory>,
7878
hv_handler: HypervisorHandler,
7979
) -> MultiUseSandbox {

src/hyperlight_host/src/sandbox/outb.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use log::{Level, Record};
2424
use tracing::{instrument, Span};
2525
use tracing_log::format_trace;
2626

27-
use super::host_funcs::HostFuncsWrapper;
27+
use super::host_funcs::FunctionRegistry;
2828
use super::mem_mgr::MemMgrWrapper;
2929
use crate::hypervisor::handlers::{OutBHandler, OutBHandlerFunction, OutBHandlerWrapper};
3030
use crate::mem::mgr::SandboxMemoryManager;
@@ -97,7 +97,7 @@ pub(super) fn outb_log(mgr: &mut SandboxMemoryManager<HostSharedMemory>) -> Resu
9797
#[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")]
9898
fn handle_outb_impl(
9999
mem_mgr: &mut MemMgrWrapper<HostSharedMemory>,
100-
host_funcs: Arc<Mutex<HostFuncsWrapper>>,
100+
host_funcs: Arc<Mutex<FunctionRegistry>>,
101101
port: u16,
102102
data: Vec<u8>,
103103
) -> Result<()> {
@@ -153,7 +153,7 @@ fn handle_outb_impl(
153153
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
154154
pub(crate) fn outb_handler_wrapper(
155155
mut mem_mgr_wrapper: MemMgrWrapper<HostSharedMemory>,
156-
host_funcs_wrapper: Arc<Mutex<HostFuncsWrapper>>,
156+
host_funcs_wrapper: Arc<Mutex<FunctionRegistry>>,
157157
) -> OutBHandlerWrapper {
158158
let outb_func: OutBHandlerFunction = Box::new(move |port, payload| {
159159
handle_outb_impl(

src/hyperlight_host/src/sandbox/uninitialized.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use tracing::{instrument, Span};
2525

2626
#[cfg(gdb)]
2727
use super::config::DebugInfo;
28-
use super::host_funcs::{default_writer_func, HostFuncsWrapper};
28+
use super::host_funcs::{default_writer_func, FunctionRegistry};
2929
use super::mem_mgr::MemMgrWrapper;
3030
use super::run_options::SandboxRunOptions;
3131
use super::uninitialized_evolve::evolve_impl_multi_use;
@@ -48,7 +48,7 @@ use crate::{log_build_details, log_then_return, new_error, MultiUseSandbox, Resu
4848
/// `UninitializedSandbox` into an initialized `Sandbox`.
4949
pub struct UninitializedSandbox {
5050
/// Registered host functions
51-
pub(crate) host_funcs: Arc<Mutex<HostFuncsWrapper>>,
51+
pub(crate) host_funcs: Arc<Mutex<FunctionRegistry>>,
5252
/// The memory manager for the sandbox.
5353
pub(crate) mgr: MemMgrWrapper<ExclusiveSharedMemory>,
5454
pub(crate) run_inprocess: bool,
@@ -184,7 +184,7 @@ impl UninitializedSandbox {
184184

185185
mem_mgr_wrapper.write_memory_layout(run_inprocess)?;
186186

187-
let host_funcs = Arc::new(Mutex::new(HostFuncsWrapper::default()));
187+
let host_funcs = Arc::new(Mutex::new(FunctionRegistry::default()));
188188

189189
let mut sandbox = Self {
190190
host_funcs,

src/hyperlight_host/src/sandbox/uninitialized_evolve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use crate::mem::ptr::RawPtr;
3131
use crate::mem::shared_mem::GuestSharedMemory;
3232
#[cfg(gdb)]
3333
use crate::sandbox::config::DebugInfo;
34-
use crate::sandbox::host_funcs::HostFuncsWrapper;
34+
use crate::sandbox::host_funcs::FunctionRegistry;
3535
use crate::sandbox::mem_access::mem_access_handler_wrapper;
3636
use crate::sandbox::outb::outb_handler_wrapper;
3737
use crate::sandbox::{HostSharedMemory, MemMgrWrapper};
@@ -56,7 +56,7 @@ fn evolve_impl<TransformFunc, ResSandbox: Sandbox>(
5656
) -> Result<ResSandbox>
5757
where
5858
TransformFunc: Fn(
59-
Arc<Mutex<HostFuncsWrapper>>,
59+
Arc<Mutex<FunctionRegistry>>,
6060
MemMgrWrapper<HostSharedMemory>,
6161
HypervisorHandler,
6262
) -> Result<ResSandbox>,
@@ -105,7 +105,7 @@ pub(super) fn evolve_impl_multi_use(u_sbox: UninitializedSandbox) -> Result<Mult
105105
fn hv_init(
106106
hshm: &MemMgrWrapper<HostSharedMemory>,
107107
gshm: SandboxMemoryManager<GuestSharedMemory>,
108-
host_funcs: Arc<Mutex<HostFuncsWrapper>>,
108+
host_funcs: Arc<Mutex<FunctionRegistry>>,
109109
max_init_time: Duration,
110110
max_exec_time: Duration,
111111
max_wait_for_cancellation: Duration,

0 commit comments

Comments
 (0)