Skip to content

Commit 9dd54fb

Browse files
committed
allow dead code for unused functions triggered by previous commit
Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent b0275a9 commit 9dd54fb

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

src/hyperlight_host/src/mem/layout.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ impl SandboxMemoryLayout {
381381

382382
/// Get the offset in guest memory to the OutB pointer.
383383
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
384+
#[allow(dead_code)]
384385
pub(super) fn get_outb_pointer_offset(&self) -> usize {
385386
// The outb pointer is immediately after the code pointer
386387
// in the `CodeAndOutBPointers` struct which is a u64
@@ -389,6 +390,7 @@ impl SandboxMemoryLayout {
389390

390391
/// Get the offset in guest memory to the OutB context.
391392
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
393+
#[allow(dead_code)]
392394
pub(super) fn get_outb_context_offset(&self) -> usize {
393395
// The outb context is immediately after the outb pointer
394396
// in the `CodeAndOutBPointers` struct which is a u64
@@ -416,6 +418,7 @@ impl SandboxMemoryLayout {
416418
/// This function exists to accommodate the macro that generates C API
417419
/// compatible functions.
418420
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
421+
#[allow(dead_code)]
419422
pub(crate) fn get_output_data_offset(&self) -> usize {
420423
self.output_data_buffer_offset
421424
}
@@ -452,6 +455,7 @@ impl SandboxMemoryLayout {
452455

453456
/// Get the offset in guest memory to the PEB address
454457
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
458+
#[allow(dead_code)]
455459
pub(super) fn get_in_process_peb_offset(&self) -> usize {
456460
self.peb_offset
457461
}
@@ -486,6 +490,7 @@ impl SandboxMemoryLayout {
486490

487491
/// Get the offset to the guest guard page
488492
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
493+
#[allow(dead_code)]
489494
pub fn get_guard_page_offset(&self) -> usize {
490495
self.guard_page_offset
491496
}

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ where
310310
/// `shared_mem` to indicate the address of the outb pointer and context
311311
/// for calling outb function
312312
#[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")]
313+
#[allow(dead_code)]
313314
pub(crate) fn set_outb_address_and_context(&mut self, addr: u64, context: u64) -> Result<()> {
314315
let pointer_offset = self.layout.get_outb_pointer_offset();
315316
let context_offset = self.layout.get_outb_context_offset();

src/hyperlight_host/src/mem/ptr_offset.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ pub(crate) struct Offset(u64);
3232
impl Offset {
3333
/// Get the offset representing `0`
3434
#[instrument(skip_all, parent = Span::current(), level= "Trace")]
35+
#[allow(dead_code)]
3536
pub(super) fn zero() -> Self {
3637
Self::default()
3738
}
3839

3940
/// round up to the nearest multiple of `alignment`
41+
#[allow(dead_code)]
4042
pub(super) fn round_up_to(self, alignment: u64) -> Self {
4143
let remainder = self.0 % alignment;
4244
let multiples = self.0 / alignment;

src/hyperlight_host/src/mem/shared_mem.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ impl ExclusiveSharedMemory {
502502
})
503503
}
504504

505+
#[allow(dead_code)]
505506
pub(super) fn make_memory_executable(&self) -> Result<()> {
506507
#[cfg(target_os = "windows")]
507508
{
@@ -616,6 +617,7 @@ impl ExclusiveSharedMemory {
616617
/// Return the address of memory at an offset to this `SharedMemory` checking
617618
/// that the memory is within the bounds of the `SharedMemory`.
618619
#[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")]
620+
#[allow(dead_code)]
619621
pub(crate) fn calculate_address(&self, offset: usize) -> Result<usize> {
620622
bounds_check!(offset, 0, self.mem_size());
621623
Ok(self.base_addr() + offset)

src/hyperlight_host/src/mem/shared_mem_snapshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl SharedMemorySnapshot {
3939
/// Take another snapshot of the internally-stored `SharedMemory`,
4040
/// then store it internally.
4141
#[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")]
42-
42+
#[allow(dead_code)]
4343
pub(super) fn replace_snapshot<S: SharedMemory>(&mut self, shared_mem: &mut S) -> Result<()> {
4444
self.snapshot = shared_mem.with_exclusivity(|e| e.copy_all_to_vec())??;
4545
Ok(())

src/hyperlight_host/src/sandbox/host_funcs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ impl FunctionRegistry {
9393
/// Return `Ok` if the function was found and was of the right signature,
9494
/// and `Err` otherwise.
9595
#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
96+
#[allow(dead_code)]
9697
pub(super) fn host_print(&mut self, msg: String) -> Result<i32> {
9798
let res = self.call_host_func_impl("HostPrint", vec![ParameterValue::String(msg)])?;
9899
res.try_into()

0 commit comments

Comments
 (0)