@@ -20,7 +20,7 @@ macro_rules! call {
2020 ( $f: expr) => { {
2121 let code = unsafe { $f } ;
2222 match code {
23- :: hv_sys :: HV_SUCCESS => Ok ( ( ) ) ,
23+ 0 => Ok ( ( ) ) ,
2424 _ => Err ( Error :: from( code) ) ,
2525 }
2626 } } ;
@@ -58,13 +58,17 @@ impl fmt::Display for Error {
5858
5959impl From < sys:: hv_return_t > for Error {
6060 fn from ( value : sys:: hv_return_t ) -> Self {
61- match value {
62- sys:: HV_ERROR => Error :: Unsuccessful ,
63- sys:: HV_BUSY => Error :: Busy ,
64- sys:: HV_BAD_ARGUMENT => Error :: BadArgument ,
65- sys:: HV_NO_RESOURCES => Error :: NoResources ,
66- sys:: HV_NO_DEVICE => Error :: NoDevice ,
67- sys:: HV_UNSUPPORTED => Error :: Unsupported ,
61+ // Looks like bindgen gets confused sometimes and produces different code for these
62+ // constants (`sys::HV_ERROR` vs `hv_return_t_HV_ERROR`) on different machines making things
63+ // to fail. It's probably easier to just hardcode them.
64+ let v = value as i64 ;
65+ match v {
66+ 0xfae94001 => Error :: Unsuccessful ,
67+ 0xfae94002 => Error :: Busy ,
68+ 0xfae94003 => Error :: BadArgument ,
69+ 0xfae94005 => Error :: NoResources ,
70+ 0xfae94006 => Error :: NoDevice ,
71+ 0xfae9400f => Error :: Unsupported ,
6872 _ => Error :: Unknown ( value) ,
6973 }
7074 }
0 commit comments