@@ -98,23 +98,23 @@ impl<'a> ObjectSkeletonConfigBuilder<'a> {
9898 }
9999
100100 fn build_maps (
101- & mut self ,
101+ maps : & mut [ MapSkelConfig ] ,
102102 s : & mut bpf_object_skeleton ,
103103 string_pool : & mut Vec < CString > ,
104104 ) -> Option < Layout > {
105- if self . maps . is_empty ( ) {
105+ if maps. is_empty ( ) {
106106 return None ;
107107 }
108108
109- s. map_cnt = self . maps . len ( ) as i32 ;
109+ s. map_cnt = maps. len ( ) as i32 ;
110110 s. map_skel_sz = size_of :: < bpf_map_skeleton > ( ) as i32 ;
111111
112- let layout = Layout :: array :: < bpf_map_skeleton > ( self . maps . len ( ) )
112+ let layout = Layout :: array :: < bpf_map_skeleton > ( maps. len ( ) )
113113 . expect ( "Failed to allocate memory for maps skeleton" ) ;
114114
115115 unsafe {
116116 s. maps = alloc_zeroed ( layout) as * mut bpf_map_skeleton ;
117- for ( i, map) in self . maps . iter_mut ( ) . enumerate ( ) {
117+ for ( i, map) in maps. iter_mut ( ) . enumerate ( ) {
118118 let current_map = s. maps . add ( i) ;
119119
120120 // Opt to panic on error here. We've already allocated memory and we'd rather not
@@ -183,7 +183,7 @@ impl<'a> ObjectSkeletonConfigBuilder<'a> {
183183
184184 s. obj = & mut * self . p ;
185185
186- let maps_layout = self . build_maps ( & mut s, & mut string_pool) ;
186+ let maps_layout = Self :: build_maps ( & mut self . maps , & mut s, & mut string_pool) ;
187187 let progs_layout = self . build_progs ( & mut s, & mut string_pool) ;
188188
189189 Ok ( ObjectSkeletonConfig {
0 commit comments