slightly more type safety for bpf_map_{lookup,update,delete}_elem_unsafe am: b8163155e3
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1552945 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I9d3d9858cb1213ae9efc904eb86529aeb39e88ea
This commit is contained in:
commit
dd27eebb32
1 changed files with 5 additions and 5 deletions
|
|
@ -47,18 +47,18 @@
|
|||
* This will make sure that if you change the type of a map you'll get compile
|
||||
* errors at any spots you forget to update with the new type.
|
||||
*
|
||||
* Note: these all take 'const void* map' because from the C/eBPF point of view
|
||||
* Note: these all take pointers to const map because from the C/eBPF point of view
|
||||
* the map struct is really just a readonly map definition of the in kernel object.
|
||||
* Runtime modification of the map defining struct is meaningless, since
|
||||
* the contents is only ever used during bpf program loading & map creation
|
||||
* by the bpf loader, and not by the eBPF program itself.
|
||||
*/
|
||||
static void* (*bpf_map_lookup_elem_unsafe)(const void* map,
|
||||
static void* (*bpf_map_lookup_elem_unsafe)(const struct bpf_map_def* map,
|
||||
const void* key) = (void*)BPF_FUNC_map_lookup_elem;
|
||||
static int (*bpf_map_update_elem_unsafe)(const void* map, const void* key, const void* value,
|
||||
unsigned long long flags) = (void*)
|
||||
static int (*bpf_map_update_elem_unsafe)(const struct bpf_map_def* map, const void* key,
|
||||
const void* value, unsigned long long flags) = (void*)
|
||||
BPF_FUNC_map_update_elem;
|
||||
static int (*bpf_map_delete_elem_unsafe)(const void* map,
|
||||
static int (*bpf_map_delete_elem_unsafe)(const struct bpf_map_def* map,
|
||||
const void* key) = (void*)BPF_FUNC_map_delete_elem;
|
||||
|
||||
/* type safe macro to declare a map and related accessor functions */
|
||||
|
|
|
|||
Loading…
Reference in a new issue