Skip to content

Commit

Permalink
mshv-bindings: Fix rust clippy warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jinank Jain <[email protected]>
  • Loading branch information
jinankjain committed Dec 18, 2024
1 parent 269bb2e commit cb573b4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mshv-bindings/src/hvcall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::vec::Vec;
/// MSHV_ROOT_HVCALL is basically a 'passthrough' hypercall. The kernel makes a
/// hypercall on behalf of the VMM without interpreting the arguments or result
/// or changing any state in the kernel.
///
/// RepInput<T> wraps a buffer containing the input for a "rep"[1] hypercall.
/// Rep hypercalls have rep-eated data, i.e. a variable length array as part of
/// the input structure e.g.:
Expand Down Expand Up @@ -83,7 +83,7 @@ impl<T: Default> RepInput<T> {
pub fn input_with_arr_field_as_vec(t: T, entry_size: usize, count: usize) -> Vec<T> {
let element_space = count * entry_size;
let vec_size_bytes = size_of::<T>() + element_space;
let rounded_size = (vec_size_bytes + size_of::<T>() - 1) / size_of::<T>();
let rounded_size = vec_size_bytes.div_ceil(size_of::<T>());
let mut v = Vec::with_capacity(rounded_size);
v.resize_with(rounded_size, T::default);
v[0] = t;
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion mshv-ioctls/src/ioctls/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Mshv {
pub fn open_with_cloexec(close_on_exec: bool) -> Result<RawFd> {
let open_flags = O_NONBLOCK | if close_on_exec { O_CLOEXEC } else { 0 };
// SAFETY: we give a constant null-terminated string and verify the result.
let ret = unsafe { open("/dev/mshv\0".as_ptr() as *const c_char, open_flags) };
let ret = unsafe { open(c"/dev/mshv".as_ptr() as *const c_char, open_flags) };
if ret < 0 {
Err(errno::Error::last().into())
} else {
Expand Down
2 changes: 1 addition & 1 deletion mshv-ioctls/src/ioctls/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ impl VmFd {
// For ease of access we are saving the bitmap in a u64 vector. We are using ceil to
// make sure we count all dirty pages even when `memory_size` is not a multiple of
// `page_size * 64`.
let div_ceil = |dividend, divisor| (dividend + divisor - 1) / divisor;
let div_ceil = |dividend: usize, divisor| dividend.div_ceil(divisor);
let bitmap_size = div_ceil(memory_size, HV_PAGE_SIZE * 64);
let mut bitmap: Vec<u64> = Vec::with_capacity(bitmap_size);
let mut completed = 0;
Expand Down

0 comments on commit cb573b4

Please sign in to comment.