summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2019-05-14 14:38:13 -0700
committerMaciej Żenczykowski <maze@google.com>2019-05-14 14:48:58 -0700
commitc1d2e029f441f98c5189296139fa2518edabd4b2 (patch)
tree763f08893a5557ed065736aca2a392516e416fa5 /progs
parentc2925ab93ebe8dd0586ef91029fdcda5f9f120b0 (diff)
downloadbpf-c1d2e029f441f98c5189296139fa2518edabd4b2.tar.gz
bpf_helpers.h - change unsafe_bpf_map_* to bpf_map_*_unsafe
Test: treehugger will, plus no other references found by: repo grep 'unsafe_bpf_map_(lookup|update|delete)_elem' Bug: 132703771 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I59b8fe8f5a00fd005f466f8f2177a2e01cff58aa
Diffstat (limited to 'progs')
-rw-r--r--progs/include/bpf_helpers.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/progs/include/bpf_helpers.h b/progs/include/bpf_helpers.h
index c6b417f..3ab68af 100644
--- a/progs/include/bpf_helpers.h
+++ b/progs/include/bpf_helpers.h
@@ -18,7 +18,7 @@
* Type-unsafe bpf map functions - avoid if possible.
*
* Using these it is possible to pass in keys/values of the wrong type/size,
- * or, for 'unsafe_bpf_map_lookup_elem' receive into a pointer to the wrong type.
+ * or, for 'bpf_map_lookup_elem_unsafe' receive into a pointer to the wrong type.
* You will not get a compile time failure, and for certain types of errors you
* might not even get a failure from the kernel's ebpf verifier during program load,
* instead stuff might just not work right at runtime.
@@ -36,11 +36,11 @@
* 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.
*/
-static void* (*unsafe_bpf_map_lookup_elem)(void* map, void* key) = (void*)BPF_FUNC_map_lookup_elem;
-static int (*unsafe_bpf_map_update_elem)(void* map, void* key, void* value,
+static void* (*bpf_map_lookup_elem_unsafe)(void* map, void* key) = (void*)BPF_FUNC_map_lookup_elem;
+static int (*bpf_map_update_elem_unsafe)(void* map, void* key, void* value,
unsigned long long flags) = (void*)
BPF_FUNC_map_update_elem;
-static int (*unsafe_bpf_map_delete_elem)(void* map, void* key) = (void*)BPF_FUNC_map_delete_elem;
+static int (*bpf_map_delete_elem_unsafe)(void* map, void* key) = (void*)BPF_FUNC_map_delete_elem;
/* type safe macro to declare a map and related accessor functions */
#define DEFINE_BPF_MAP_NO_ACCESSORS(the_map, TYPE, TypeOfKey, TypeOfValue, num_entries) \
@@ -56,16 +56,16 @@ static int (*unsafe_bpf_map_delete_elem)(void* map, void* key) = (void*)BPF_FUNC
\
static inline __always_inline __unused TypeOfValue* bpf_##the_map##_lookup_elem( \
TypeOfKey* k) { \
- return unsafe_bpf_map_lookup_elem(&the_map, k); \
+ return bpf_map_lookup_elem_unsafe(&the_map, k); \
}; \
\
static inline __always_inline __unused int bpf_##the_map##_update_elem( \
TypeOfKey* k, TypeOfValue* v, unsigned long long flags) { \
- return unsafe_bpf_map_update_elem(&the_map, k, v, flags); \
+ return bpf_map_update_elem_unsafe(&the_map, k, v, flags); \
}; \
\
static inline __always_inline __unused int bpf_##the_map##_delete_elem(TypeOfKey* k) { \
- return unsafe_bpf_map_delete_elem(&the_map, k); \
+ return bpf_map_delete_elem_unsafe(&the_map, k); \
};
static int (*bpf_probe_read)(void* dst, int size, void* unsafe_ptr) = (void*) BPF_FUNC_probe_read;