libbpf: Deprecate bpf_{map,program}__{prev,next} APIs since v0.7
Deprecate bpf_{map,program}__{prev,next} APIs. Replace them with a new set of APIs named bpf_object__{prev,next}_{program,map} which follow the libbpf API naming convention ([0]). No functionality changes. [0] Closes: https://github.com/libbpf/libbpf/issues/296 Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20211003165844.4054931-2-hengqi.chen@gmail.com
This commit is contained in:
Родитель
4a404a7e8a
Коммит
2088a3a71d
|
@ -7834,6 +7834,12 @@ __bpf_program__iter(const struct bpf_program *p, const struct bpf_object *obj,
|
|||
|
||||
struct bpf_program *
|
||||
bpf_program__next(struct bpf_program *prev, const struct bpf_object *obj)
|
||||
{
|
||||
return bpf_object__next_program(obj, prev);
|
||||
}
|
||||
|
||||
struct bpf_program *
|
||||
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prev)
|
||||
{
|
||||
struct bpf_program *prog = prev;
|
||||
|
||||
|
@ -7846,6 +7852,12 @@ bpf_program__next(struct bpf_program *prev, const struct bpf_object *obj)
|
|||
|
||||
struct bpf_program *
|
||||
bpf_program__prev(struct bpf_program *next, const struct bpf_object *obj)
|
||||
{
|
||||
return bpf_object__prev_program(obj, next);
|
||||
}
|
||||
|
||||
struct bpf_program *
|
||||
bpf_object__prev_program(const struct bpf_object *obj, struct bpf_program *next)
|
||||
{
|
||||
struct bpf_program *prog = next;
|
||||
|
||||
|
@ -8778,6 +8790,12 @@ __bpf_map__iter(const struct bpf_map *m, const struct bpf_object *obj, int i)
|
|||
|
||||
struct bpf_map *
|
||||
bpf_map__next(const struct bpf_map *prev, const struct bpf_object *obj)
|
||||
{
|
||||
return bpf_object__next_map(obj, prev);
|
||||
}
|
||||
|
||||
struct bpf_map *
|
||||
bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *prev)
|
||||
{
|
||||
if (prev == NULL)
|
||||
return obj->maps;
|
||||
|
@ -8787,6 +8805,12 @@ bpf_map__next(const struct bpf_map *prev, const struct bpf_object *obj)
|
|||
|
||||
struct bpf_map *
|
||||
bpf_map__prev(const struct bpf_map *next, const struct bpf_object *obj)
|
||||
{
|
||||
return bpf_object__prev_map(obj, next);
|
||||
}
|
||||
|
||||
struct bpf_map *
|
||||
bpf_object__prev_map(const struct bpf_object *obj, const struct bpf_map *next)
|
||||
{
|
||||
if (next == NULL) {
|
||||
if (!obj->nr_maps)
|
||||
|
|
|
@ -190,16 +190,22 @@ LIBBPF_API int libbpf_find_vmlinux_btf_id(const char *name,
|
|||
|
||||
/* Accessors of bpf_program */
|
||||
struct bpf_program;
|
||||
LIBBPF_API struct bpf_program *bpf_program__next(struct bpf_program *prog,
|
||||
const struct bpf_object *obj);
|
||||
LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__next_program() instead")
|
||||
struct bpf_program *bpf_program__next(struct bpf_program *prog,
|
||||
const struct bpf_object *obj);
|
||||
LIBBPF_API struct bpf_program *
|
||||
bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prog);
|
||||
|
||||
#define bpf_object__for_each_program(pos, obj) \
|
||||
for ((pos) = bpf_program__next(NULL, (obj)); \
|
||||
(pos) != NULL; \
|
||||
(pos) = bpf_program__next((pos), (obj)))
|
||||
#define bpf_object__for_each_program(pos, obj) \
|
||||
for ((pos) = bpf_object__next_program((obj), NULL); \
|
||||
(pos) != NULL; \
|
||||
(pos) = bpf_object__next_program((obj), (pos)))
|
||||
|
||||
LIBBPF_API struct bpf_program *bpf_program__prev(struct bpf_program *prog,
|
||||
const struct bpf_object *obj);
|
||||
LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__prev_program() instead")
|
||||
struct bpf_program *bpf_program__prev(struct bpf_program *prog,
|
||||
const struct bpf_object *obj);
|
||||
LIBBPF_API struct bpf_program *
|
||||
bpf_object__prev_program(const struct bpf_object *obj, struct bpf_program *prog);
|
||||
|
||||
typedef void (*bpf_program_clear_priv_t)(struct bpf_program *, void *);
|
||||
|
||||
|
@ -503,16 +509,21 @@ bpf_object__find_map_fd_by_name(const struct bpf_object *obj, const char *name);
|
|||
LIBBPF_API struct bpf_map *
|
||||
bpf_object__find_map_by_offset(struct bpf_object *obj, size_t offset);
|
||||
|
||||
LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__next_map() instead")
|
||||
struct bpf_map *bpf_map__next(const struct bpf_map *map, const struct bpf_object *obj);
|
||||
LIBBPF_API struct bpf_map *
|
||||
bpf_map__next(const struct bpf_map *map, const struct bpf_object *obj);
|
||||
bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *map);
|
||||
|
||||
#define bpf_object__for_each_map(pos, obj) \
|
||||
for ((pos) = bpf_map__next(NULL, (obj)); \
|
||||
for ((pos) = bpf_object__next_map((obj), NULL); \
|
||||
(pos) != NULL; \
|
||||
(pos) = bpf_map__next((pos), (obj)))
|
||||
(pos) = bpf_object__next_map((obj), (pos)))
|
||||
#define bpf_map__for_each bpf_object__for_each_map
|
||||
|
||||
LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__prev_map() instead")
|
||||
struct bpf_map *bpf_map__prev(const struct bpf_map *map, const struct bpf_object *obj);
|
||||
LIBBPF_API struct bpf_map *
|
||||
bpf_map__prev(const struct bpf_map *map, const struct bpf_object *obj);
|
||||
bpf_object__prev_map(const struct bpf_object *obj, const struct bpf_map *map);
|
||||
|
||||
/**
|
||||
* @brief **bpf_map__fd()** gets the file descriptor of the passed
|
||||
|
|
|
@ -389,6 +389,10 @@ LIBBPF_0.5.0 {
|
|||
|
||||
LIBBPF_0.6.0 {
|
||||
global:
|
||||
bpf_object__next_map;
|
||||
bpf_object__next_program;
|
||||
bpf_object__prev_map;
|
||||
bpf_object__prev_program;
|
||||
btf__add_btf;
|
||||
btf__add_tag;
|
||||
} LIBBPF_0.5.0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче