Skip to content

Commit 3da5e42

Browse files
committed
Use a struct instead of a tuple for HostFuncsWrapper
Signed-off-by: Jorge Prendes <[email protected]>
1 parent fb5f547 commit 3da5e42

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/hyperlight_host/src/sandbox/host_funcs.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ use crate::{new_error, Result};
2929
#[derive(Default, Clone)]
3030
/// A Wrapper around details of functions exposed by the Host
3131
pub struct HostFuncsWrapper {
32-
functions_map: HashMap<String, (HyperlightFunction, Option<Vec<ExtraAllowedSyscall>>)>,
32+
functions_map: HashMap<String, FunctionEntry>,
33+
}
34+
35+
#[derive(Clone)]
36+
pub struct FunctionEntry {
37+
pub function: HyperlightFunction,
38+
pub extra_allowed_syscalls: Option<Vec<ExtraAllowedSyscall>>,
3339
}
3440

3541
impl HostFuncsWrapper {
@@ -86,7 +92,7 @@ impl HostFuncsWrapper {
8692
fn register_host_function_helper(
8793
&mut self,
8894
name: String,
89-
func: HyperlightFunction,
95+
function: HyperlightFunction,
9096
extra_allowed_syscalls: Option<Vec<ExtraAllowedSyscall>>,
9197
) -> Result<()> {
9298
#[cfg(not(all(feature = "seccomp", target_os = "linux")))]
@@ -95,8 +101,13 @@ impl HostFuncsWrapper {
95101
"Extra syscalls are only supported on Linux with seccomp"
96102
));
97103
}
98-
self.functions_map
99-
.insert(name, (func, extra_allowed_syscalls));
104+
self.functions_map.insert(
105+
name,
106+
FunctionEntry {
107+
function,
108+
extra_allowed_syscalls,
109+
},
110+
);
100111
Ok(())
101112
}
102113

0 commit comments

Comments
 (0)