@@ -90,7 +90,7 @@ impl<'obj> OpenMap<'obj> {
9090 fn initial_value_raw ( & self ) -> ( * mut u8 , usize ) {
9191 let mut size = 0u64 ;
9292 let ptr = unsafe {
93- libbpf_sys:: bpf_map__initial_value ( self . ptr . as_ptr ( ) , & mut size as * mut _ as _ )
93+ libbpf_sys:: bpf_map__initial_value ( self . ptr . as_ptr ( ) , ( & raw mut size ) . cast ( ) )
9494 } ;
9595 ( ptr. cast ( ) , size as _ )
9696 }
@@ -149,7 +149,7 @@ impl<'obj> OpenMapMut<'obj> {
149149 let ret = unsafe {
150150 libbpf_sys:: bpf_map__set_initial_value (
151151 self . ptr . as_ptr ( ) ,
152- data. as_ptr ( ) as * const c_void ,
152+ data. as_ptr ( ) . cast :: < c_void > ( ) ,
153153 data. len ( ) as libbpf_sys:: size_t ,
154154 )
155155 } ;
@@ -317,7 +317,7 @@ where
317317 return ptr:: null ( ) ;
318318 }
319319
320- key. as_ptr ( ) as * const c_void
320+ key. as_ptr ( ) . cast :: < c_void > ( )
321321}
322322
323323/// Internal function to perform a map lookup and write the value into raw pointer.
@@ -414,7 +414,7 @@ where
414414 libbpf_sys:: bpf_map_update_elem (
415415 map. as_fd ( ) . as_raw_fd ( ) ,
416416 map_key ( map, key) ,
417- value. as_ptr ( ) as * const c_void ,
417+ value. as_ptr ( ) . cast :: < c_void > ( ) ,
418418 flags. bits ( ) ,
419419 )
420420 } ;
@@ -605,7 +605,7 @@ pub trait MapCore: Debug + AsFd + private::Sealed {
605605 libbpf_sys:: bpf_map_lookup_elem (
606606 self . as_fd ( ) . as_raw_fd ( ) ,
607607 ptr:: null ( ) ,
608- value. to_vec ( ) . as_mut_ptr ( ) as * mut c_void ,
608+ value. to_vec ( ) . as_mut_ptr ( ) . cast :: < c_void > ( ) ,
609609 )
610610 } ;
611611
@@ -661,7 +661,7 @@ pub trait MapCore: Debug + AsFd + private::Sealed {
661661 } ;
662662
663663 let ret = unsafe {
664- libbpf_sys:: bpf_map_delete_elem ( self . as_fd ( ) . as_raw_fd ( ) , key. as_ptr ( ) as * const c_void )
664+ libbpf_sys:: bpf_map_delete_elem ( self . as_fd ( ) . as_raw_fd ( ) , key. as_ptr ( ) . cast :: < c_void > ( ) )
665665 } ;
666666 util:: parse_ret ( ret)
667667 }
@@ -698,7 +698,7 @@ pub trait MapCore: Debug + AsFd + private::Sealed {
698698 let ret = unsafe {
699699 libbpf_sys:: bpf_map_delete_batch (
700700 self . as_fd ( ) . as_raw_fd ( ) ,
701- keys. as_ptr ( ) as * const c_void ,
701+ keys. as_ptr ( ) . cast :: < c_void > ( ) ,
702702 & mut count,
703703 & opts as * const libbpf_sys:: bpf_map_batch_opts ,
704704 )
@@ -727,7 +727,7 @@ pub trait MapCore: Debug + AsFd + private::Sealed {
727727 libbpf_sys:: bpf_map_lookup_and_delete_elem (
728728 self . as_fd ( ) . as_raw_fd ( ) ,
729729 map_key ( self , key) ,
730- out. as_mut_ptr ( ) as * mut c_void ,
730+ out. as_mut_ptr ( ) . cast :: < c_void > ( ) ,
731731 )
732732 } ;
733733
@@ -814,8 +814,8 @@ pub trait MapCore: Debug + AsFd + private::Sealed {
814814 let ret = unsafe {
815815 libbpf_sys:: bpf_map_update_batch (
816816 self . as_fd ( ) . as_raw_fd ( ) ,
817- keys. as_ptr ( ) as * const c_void ,
818- values. as_ptr ( ) as * const c_void ,
817+ keys. as_ptr ( ) . cast :: < c_void > ( ) ,
818+ values. as_ptr ( ) . cast :: < c_void > ( ) ,
819819 & mut count,
820820 & opts as * const libbpf_sys:: bpf_map_batch_opts ,
821821 )
@@ -1571,8 +1571,8 @@ impl Iterator for MapKeyIter<'_> {
15711571 let ret = unsafe {
15721572 libbpf_sys:: bpf_map_get_next_key (
15731573 self . map_fd . as_raw_fd ( ) ,
1574- prev as _ ,
1575- self . next . as_mut_ptr ( ) as _ ,
1574+ prev. cast ( ) ,
1575+ self . next . as_mut_ptr ( ) . cast ( ) ,
15761576 )
15771577 } ;
15781578 if ret != 0 {
@@ -1717,7 +1717,7 @@ impl MapInfo {
17171717 let ( ) = util:: parse_ret ( unsafe {
17181718 bpf_obj_get_info_by_fd (
17191719 fd. as_raw_fd ( ) ,
1720- & mut map_info as * mut bpf_map_info as * mut c_void ,
1720+ ( & mut map_info as * mut bpf_map_info ) . cast :: < c_void > ( ) ,
17211721 & mut size as * mut u32 ,
17221722 )
17231723 } ) ?;
0 commit comments