Skip to content

Commit 55dc43e

Browse files
committed
Update hyperlight-host to 2024 edition
Signed-off-by: Ludvig Liljenberg <[email protected]>
1 parent 19584e8 commit 55dc43e

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/hyperlight_host/src/mem/layout.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,7 @@ impl SandboxMemoryLayout {
739739

740740
// Get the number of pages needed for the PTs
741741

742-
let num_pages: usize = ((total_mapped_memory_size + AMOUNT_OF_MEMORY_PER_PT - 1)
743-
/ AMOUNT_OF_MEMORY_PER_PT)
742+
let num_pages: usize = total_mapped_memory_size.div_ceil(AMOUNT_OF_MEMORY_PER_PT)
744743
+ 1 // Round up
745744
+ 3; // PML4, PDPT, PD
746745

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ where
181181

182182
let mem_size = usize::try_from(mem_size)?;
183183

184-
let num_pages: usize =
185-
((mem_size + AMOUNT_OF_MEMORY_PER_PT - 1) / AMOUNT_OF_MEMORY_PER_PT) + 1;
184+
let num_pages: usize = mem_size.div_ceil(AMOUNT_OF_MEMORY_PER_PT) + 1;
186185

187186
// Create num_pages PT with 512 PTEs
188187
for p in 0..num_pages {

src/hyperlight_host/src/mem/pe/base_relocations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a> BaseRelocations<'a> {
7171
}
7272
}
7373

74-
impl<'a> Iterator for BaseRelocations<'a> {
74+
impl Iterator for BaseRelocations<'_> {
7575
type Item = BaseRelocation;
7676
fn next(&mut self) -> Option<Self::Item> {
7777
// Check if we can read 2 bytes from the array

src/hyperlight_host/src/sandbox_state/transition.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl<Cur: Sandbox, Next: Sandbox> TransitionMetadata<Cur, Next> for Noop<Cur, Ne
100100
/// };
101101
/// let mutating_cb = MultiUseContextCallback::from(my_cb_fn);
102102
/// ```
103-
104103
pub struct MultiUseContextCallback<'func, Cur: Sandbox, F>
105104
where
106105
F: FnOnce(&mut MultiUseGuestCallContext) -> Result<()> + 'func,
@@ -110,14 +109,14 @@ where
110109
cb: F,
111110
}
112111

113-
impl<'a, Cur: Sandbox, Next: Sandbox, F> TransitionMetadata<Cur, Next>
114-
for MultiUseContextCallback<'a, Cur, F>
112+
impl<Cur: Sandbox, Next: Sandbox, F> TransitionMetadata<Cur, Next>
113+
for MultiUseContextCallback<'_, Cur, F>
115114
where
116115
F: FnOnce(&mut MultiUseGuestCallContext) -> Result<()>,
117116
{
118117
}
119118

120-
impl<'a, Cur: Sandbox, F> MultiUseContextCallback<'a, Cur, F>
119+
impl<Cur: Sandbox, F> MultiUseContextCallback<'_, Cur, F>
121120
where
122121
F: FnOnce(&mut MultiUseGuestCallContext) -> Result<()>,
123122
{

0 commit comments

Comments
 (0)