Skip to content

Commit 7a42e11

Browse files
committed
[guest/guest-handle/host-comm] change name of call_host_without_returning function
Signed-off-by: danbugs <[email protected]>
1 parent c250903 commit 7a42e11

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ use hyperlight_common::flatbuffer_wrappers::util::get_flatbuffer_result_from_int
8989
use hyperlight_guest::error::{HyperlightGuestError, Result};
9090
use hyperlight_guest_bin::guest_function::definition::GuestFunctionDefinition;
9191
use hyperlight_guest_bin::guest_function::register::register_function;
92-
use hyperlight_guest_bin::host_comm::{call_host_function, call_host_function_without_returning};
92+
use hyperlight_guest_bin::host_comm::{call_host_function, call_host_function_without_returning_result};
9393

9494
fn print_output(function_call: &FunctionCall) -> Result<Vec<u8>> {
9595
if let ParameterValue::String(message) = function_call.parameters.clone().unwrap()[0].clone() {

src/hyperlight_guest/src/guest_handle/host_comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl GuestHandle {
5858
///
5959
/// Note: The function return value must be obtained by calling
6060
/// `get_host_return_value`.
61-
pub fn call_host_function_without_returning(
61+
pub fn call_host_function_without_returning_result(
6262
&self,
6363
function_name: &str,
6464
parameters: Option<Vec<ParameterValue>>,
@@ -95,7 +95,7 @@ impl GuestHandle {
9595
parameters: Option<Vec<ParameterValue>>,
9696
return_type: ReturnType,
9797
) -> Result<T> {
98-
self.call_host_function_without_returning(function_name, parameters, return_type)?;
98+
self.call_host_function_without_returning_result(function_name, parameters, return_type)?;
9999
self.get_host_return_value::<T>()
100100
}
101101

src/hyperlight_guest_bin/src/host_comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ where
4444
handle.call_host_function::<T>(function_name, parameters, return_type)
4545
}
4646

47-
pub fn call_host_function_without_returning(
47+
pub fn call_host_function_without_returning_result(
4848
function_name: &str,
4949
parameters: Option<Vec<ParameterValue>>,
5050
return_type: ReturnType,
5151
) -> Result<()> {
5252
let handle = unsafe { GUEST_HANDLE };
53-
handle.call_host_function_without_returning(function_name, parameters, return_type)
53+
handle.call_host_function_without_returning_result(function_name, parameters, return_type)
5454
}
5555

5656
pub fn get_host_return_value<T: TryFrom<ReturnValue>>() -> Result<T> {

src/hyperlight_guest_capi/src/dispatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use hyperlight_common::flatbuffer_wrappers::guest_error::ErrorCode;
1010
use hyperlight_guest::error::{HyperlightGuestError, Result};
1111
use hyperlight_guest_bin::guest_function::definition::GuestFunctionDefinition;
1212
use hyperlight_guest_bin::guest_function::register::GuestFunctionRegister;
13-
use hyperlight_guest_bin::host_comm::call_host_function_without_returning;
13+
use hyperlight_guest_bin::host_comm::call_host_function_without_returning_result;
1414

1515
use crate::types::{FfiFunctionCall, FfiVec};
1616
static mut REGISTERED_C_GUEST_FUNCTIONS: GuestFunctionRegister = GuestFunctionRegister::new();
@@ -95,6 +95,6 @@ pub extern "C" fn hl_call_host_function(function_call: &FfiFunctionCall) {
9595

9696
// Use the non-generic internal implementation
9797
// The C API will then call specific getter functions to fetch the properly typed return value
98-
let _ = call_host_function_without_returning(&func_name, Some(parameters), return_type)
98+
let _ = call_host_function_without_returning_result(&func_name, Some(parameters), return_type)
9999
.expect("Failed to call host function");
100100
}

src/tests/rust_guests/simpleguest/src/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ use hyperlight_guest::error::{HyperlightGuestError, Result};
4545
use hyperlight_guest::exit::{abort_with_code, abort_with_code_and_message};
4646
use hyperlight_guest_bin::guest_function::definition::GuestFunctionDefinition;
4747
use hyperlight_guest_bin::guest_function::register::register_function;
48-
use hyperlight_guest_bin::host_comm::{call_host_function, call_host_function_without_returning};
48+
use hyperlight_guest_bin::host_comm::{
49+
call_host_function, call_host_function_without_returning_result,
50+
};
4951
use hyperlight_guest_bin::memory::malloc;
5052
use hyperlight_guest_bin::{guest_logger, MIN_STACK_ADDRESS};
5153
use log::{error, LevelFilter};
@@ -1194,9 +1196,13 @@ fn fuzz_host_function(func: FunctionCall) -> Result<Vec<u8>> {
11941196

11951197
// Because we do not know at compile time the actual return type of the host function to be called
11961198
// we cannot use the `call_host_function<T>` generic function.
1197-
// We need to use the `call_host_function_without_returning` function that does not retrieve the return
1199+
// We need to use the `call_host_function_without_returning_result` function that does not retrieve the return
11981200
// value
1199-
call_host_function_without_returning(&host_func_name, Some(params), func.expected_return_type)
1200-
.expect("failed to call host function");
1201+
call_host_function_without_returning_result(
1202+
&host_func_name,
1203+
Some(params),
1204+
func.expected_return_type,
1205+
)
1206+
.expect("failed to call host function");
12011207
Ok(get_flatbuffer_result(()))
12021208
}

0 commit comments

Comments
 (0)