1 #ifndef __HOT_UPDATE_SKEL_H__
2 #define __HOT_UPDATE_SKEL_H__
6 #include <bpf/libbpf.h>
10 #include "../base64.h"
16 struct bpf_object *
obj;
36 bpf_object__destroy_skeleton(obj->
skeleton);
40 static inline int create_single_prog_skeleton_from_json(
44 struct bpf_object_skeleton *s;
46 s = (
struct bpf_object_skeleton *)calloc(1,
sizeof(*s));
52 s->name = ebpf_data.
name.c_str();
57 s->map_skel_sz =
sizeof(*s->maps);
58 s->maps = (
struct bpf_map_skeleton *)calloc(s->map_cnt, s->map_skel_sz);
62 for (
int i = 0; i < s->map_cnt; i++)
64 s->maps[i].name = ebpf_data.
maps_name[i].c_str();
65 s->maps[i].map = &obj->
maps.
rb;
70 s->prog_skel_sz =
sizeof(*s->progs);
71 s->progs = (
struct bpf_prog_skeleton *)calloc(s->prog_cnt, s->prog_skel_sz);
74 for (
int i = 0; i < s->prog_cnt; i++)
76 s->progs[i].name = ebpf_data.
progs_name[i].c_str();
88 bpf_object__destroy_skeleton(s);
99 if (create_single_prog_skeleton_from_json(
obj, ebpf_data))
101 if (bpf_object__open_skeleton(
obj->skeleton, NULL))
106 update_bpf__destroy(
obj);
112 return bpf_object__load_skeleton(
obj->skeleton);
117 return bpf_object__attach_skeleton(
obj->skeleton);
122 return bpf_object__detach_skeleton(
obj->skeleton);