@@ -12,7 +12,7 @@ use std::fs::File;
12
12
use std:: os:: raw:: c_char;
13
13
use std:: os:: unix:: io:: { FromRawFd , RawFd } ;
14
14
use vmm_sys_util:: errno;
15
- use vmm_sys_util:: ioctl:: ioctl_with_ref;
15
+ use vmm_sys_util:: ioctl:: { ioctl_with_mut_ref , ioctl_with_ref} ;
16
16
17
17
/// Helper function to populate synthetic features for the partition to create
18
18
fn make_synthetic_features_mask ( ) -> u64 {
@@ -163,12 +163,17 @@ impl Mshv {
163
163
}
164
164
165
165
/// Retrieve the host partition property given a property code.
166
- pub fn get_host_partition_property ( & self , property_code : u64 ) -> Result < i32 > {
166
+ pub fn get_host_partition_property ( & self , property_code : u32 ) -> Result < u64 > {
167
+ let mut property = mshv_partition_property {
168
+ property_code : property_code as u64 ,
169
+ ..Default :: default ( )
170
+ } ;
167
171
// SAFETY: IOCTL call with the correct types.
168
- let ret =
169
- unsafe { ioctl_with_ref ( & self . hv , MSHV_GET_HOST_PARTITION_PROPERTY ( ) , & property_code) } ;
170
- if ret >= 0 {
171
- Ok ( ret)
172
+ let ret = unsafe {
173
+ ioctl_with_mut_ref ( & self . hv , MSHV_GET_HOST_PARTITION_PROPERTY ( ) , & mut property)
174
+ } ;
175
+ if ret == 0 {
176
+ Ok ( property. property_value )
172
177
} else {
173
178
Err ( errno:: Error :: last ( ) . into ( ) )
174
179
}
@@ -226,7 +231,7 @@ mod tests {
226
231
fn test_get_host_ipa_limit ( ) {
227
232
let hv = Mshv :: new ( ) . unwrap ( ) ;
228
233
let host_ipa_limit = hv. get_host_partition_property (
229
- hv_partition_property_code_HV_PARTITION_PROPERTY_PHYSICAL_ADDRESS_WIDTH as u64 ,
234
+ hv_partition_property_code_HV_PARTITION_PROPERTY_PHYSICAL_ADDRESS_WIDTH,
230
235
) ;
231
236
assert ! ( host_ipa_limit. is_ok( ) ) ;
232
237
}
0 commit comments