@@ -125,10 +125,14 @@ impl<'obj> OpenMapMut<'obj> {
125
125
}
126
126
}
127
127
128
+ /// Bind map to a particular network device.
129
+ ///
130
+ /// Used for offloading maps to hardware.
128
131
pub fn set_map_ifindex ( & mut self , idx : u32 ) {
129
132
unsafe { libbpf_sys:: bpf_map__set_ifindex ( self . ptr . as_ptr ( ) , idx) } ;
130
133
}
131
134
135
+ /// Set the initial value of the map.
132
136
pub fn set_initial_value ( & mut self , data : & [ u8 ] ) -> Result < ( ) > {
133
137
let ret = unsafe {
134
138
libbpf_sys:: bpf_map__set_initial_value (
@@ -141,53 +145,68 @@ impl<'obj> OpenMapMut<'obj> {
141
145
util:: parse_ret ( ret)
142
146
}
143
147
148
+ /// Set the type of the map.
144
149
pub fn set_type ( & mut self , ty : MapType ) -> Result < ( ) > {
145
150
let ret = unsafe { libbpf_sys:: bpf_map__set_type ( self . ptr . as_ptr ( ) , ty as u32 ) } ;
146
151
util:: parse_ret ( ret)
147
152
}
148
153
154
+ /// Set the key size of the map in bytes.
149
155
pub fn set_key_size ( & mut self , size : u32 ) -> Result < ( ) > {
150
156
let ret = unsafe { libbpf_sys:: bpf_map__set_key_size ( self . ptr . as_ptr ( ) , size) } ;
151
157
util:: parse_ret ( ret)
152
158
}
153
159
160
+ /// Set the value size of the map in bytes.
154
161
pub fn set_value_size ( & mut self , size : u32 ) -> Result < ( ) > {
155
162
let ret = unsafe { libbpf_sys:: bpf_map__set_value_size ( self . ptr . as_ptr ( ) , size) } ;
156
163
util:: parse_ret ( ret)
157
164
}
158
165
166
+ /// Set the maximum number of entries this map can have.
159
167
pub fn set_max_entries ( & mut self , count : u32 ) -> Result < ( ) > {
160
168
let ret = unsafe { libbpf_sys:: bpf_map__set_max_entries ( self . ptr . as_ptr ( ) , count) } ;
161
169
util:: parse_ret ( ret)
162
170
}
163
171
172
+ /// Set flags on this map.
164
173
pub fn set_map_flags ( & mut self , flags : u32 ) -> Result < ( ) > {
165
174
let ret = unsafe { libbpf_sys:: bpf_map__set_map_flags ( self . ptr . as_ptr ( ) , flags) } ;
166
175
util:: parse_ret ( ret)
167
176
}
168
177
178
+ // TODO: Document member.
179
+ #[ allow( missing_docs) ]
169
180
pub fn set_numa_node ( & mut self , numa_node : u32 ) -> Result < ( ) > {
170
181
let ret = unsafe { libbpf_sys:: bpf_map__set_numa_node ( self . ptr . as_ptr ( ) , numa_node) } ;
171
182
util:: parse_ret ( ret)
172
183
}
173
184
185
+ // TODO: Document member.
186
+ #[ allow( missing_docs) ]
174
187
pub fn set_inner_map_fd ( & mut self , inner_map_fd : BorrowedFd < ' _ > ) -> Result < ( ) > {
175
188
let ret = unsafe {
176
189
libbpf_sys:: bpf_map__set_inner_map_fd ( self . ptr . as_ptr ( ) , inner_map_fd. as_raw_fd ( ) )
177
190
} ;
178
191
util:: parse_ret ( ret)
179
192
}
180
193
194
+ // TODO: Document member.
195
+ #[ allow( missing_docs) ]
181
196
pub fn set_map_extra ( & mut self , map_extra : u64 ) -> Result < ( ) > {
182
197
let ret = unsafe { libbpf_sys:: bpf_map__set_map_extra ( self . ptr . as_ptr ( ) , map_extra) } ;
183
198
util:: parse_ret ( ret)
184
199
}
185
200
201
+ /// Set whether or not libbpf should automatically create this map during load phase.
186
202
pub fn set_autocreate ( & mut self , autocreate : bool ) -> Result < ( ) > {
187
203
let ret = unsafe { libbpf_sys:: bpf_map__set_autocreate ( self . ptr . as_ptr ( ) , autocreate) } ;
188
204
util:: parse_ret ( ret)
189
205
}
190
206
207
+ /// Set where the map should be pinned.
208
+ ///
209
+ /// Note this does not actually create the pin.
191
210
pub fn set_pin_path < P : AsRef < Path > > ( & mut self , path : P ) -> Result < ( ) > {
192
211
let path_c = util:: path_to_cstring ( path) ?;
193
212
let path_ptr = path_c. as_ptr ( ) ;
0 commit comments