pub struct RepInput<T> { /* private fields */ }Expand description
This file contains helper functions for the MSHV_ROOT_HVCALL ioctl. 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
use mshv_bindings::bindings::*;
#[repr(C, packed)]
struct hv_input_foo {
some_field: __u64,
variable_array_field: __IncompleteArrayField<__u64>,
}The struct cannot be used as-is because it can’t store anything in the
__IncompleteArrayField
RepInput
Note also that the length of the variable length array field is not stored in
this struct. Rather, it is passed to the hypercall in the ‘rep count’ field
of the hypercall args (mshv_root_hvcall.reps). RepInput
RepInput
[1] HyperV TLFS describing the hypercall interface and rep hypercalls: https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/hypercall-interface
Implementations§
Source§impl<T: Default> RepInput<T>
impl<T: Default> RepInput<T>
Sourcepub fn new(vec: Vec<T>, size: usize, rep_count: usize) -> Self
pub fn new(vec: Vec<T>, size: usize, rep_count: usize) -> Self
Create a RepInput
§Arguments
vec- Vecfrom input_with_arr_field_as_vec(). T is hv_input_* struct size- Size of the hypercall input, including the rep datarep_count- number of reps
pub fn as_mut_struct_ref(&mut self) -> &mut T
pub fn as_struct_ptr(&self) -> *const T
pub fn rep_count(&self) -> usize
pub fn size(&self) -> usize
Sourcepub fn input_with_arr_field_as_vec(
t: T,
entry_size: usize,
count: usize,
) -> Vec<T>
pub fn input_with_arr_field_as_vec( t: T, entry_size: usize, count: usize, ) -> Vec<T>
Make Vec<T> with at least enough space for count entries of
entry_size, plus one additional entry
Populate the first element of the Vec with the T. The rest will hold
elements of size entry_size (note the Vec cannot be used normally to
modify these since size_of::