Lines Matching defs:obj

124 static int codegen_datasec_def(struct bpf_object *obj,
245 static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)
247 struct btf *btf = bpf_object__btf(obj);
258 bpf_object__for_each_map(map, obj) {
276 err = codegen_datasec_def(obj, btf, d, sec, obj_name);
294 static int codegen_subskel_datasecs(struct bpf_object *obj, const char *obj_name)
296 struct btf *btf = bpf_object__btf(obj);
311 bpf_object__for_each_map(map, obj) {
467 static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
469 struct btf *btf = bpf_object__btf(obj);
489 bpf_object__for_each_map(map, obj) {
532 static void codegen_attach_detach(struct bpf_object *obj, const char *obj_name)
536 bpf_object__for_each_program(prog, obj) {
584 bpf_object__for_each_program(prog, obj) {
601 bpf_object__for_each_program(prog, obj) {
614 static void codegen_destroy(struct bpf_object *obj, const char *obj_name)
631 bpf_object__for_each_program(prog, obj) {
638 bpf_object__for_each_map(map, obj) {
658 static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *header_guard)
665 err = bpf_object__gen_loader(obj, &opts);
669 err = bpf_object__load(obj);
685 codegen_attach_detach(obj, obj_name);
687 codegen_destroy(obj, obj_name);
702 bpf_object__for_each_map(map, obj) {
762 bpf_object__for_each_map(map, obj) {
804 codegen_asserts(obj, obj_name);
818 codegen_maps_skeleton(struct bpf_object *obj, size_t map_cnt, bool mmaped)
842 bpf_object__for_each_map(map, obj) {
850 s->maps[%zu].map = &obj->maps.%s; \n\
855 printf("\ts->maps[%zu].mmaped = (void **)&obj->%s;\n",
863 codegen_progs_skeleton(struct bpf_object *obj, size_t prog_cnt, bool populate_links)
886 bpf_object__for_each_program(prog, obj) {
891 s->progs[%1$zu].prog = &obj->progs.%2$s;\n\
898 s->progs[%1$zu].link = &obj->links.%2$s;\n\
912 struct bpf_object *obj = NULL;
977 obj = bpf_object__open_mem(obj_data, file_sz, &opts);
978 if (!obj) {
987 bpf_object__for_each_map(map, obj) {
995 bpf_object__for_each_program(prog, obj) {
1030 struct bpf_object *obj; \n\
1038 bpf_object__for_each_map(map, obj) {
1051 bpf_object__for_each_program(prog, obj) {
1061 bpf_object__for_each_program(prog, obj) {
1072 btf = bpf_object__btf(obj);
1074 err = codegen_datasecs(obj, obj_name);
1079 err = gen_trace(obj, obj_name, header_guard);
1098 %1$s__destroy(struct %1$s *obj) \n\
1100 if (!obj) \n\
1102 if (obj->skeleton) \n\
1103 bpf_object__destroy_skeleton(obj->skeleton);\n\
1104 free(obj); \n\
1108 %1$s__create_skeleton(struct %1$s *obj); \n\
1113 struct %1$s *obj; \n\
1116 obj = (struct %1$s *)calloc(1, sizeof(*obj)); \n\
1117 if (!obj) { \n\
1122 err = %1$s__create_skeleton(obj); \n\
1126 err = bpf_object__open_skeleton(obj->skeleton, opts);\n\
1130 return obj; \n\
1132 %1$s__destroy(obj); \n\
1144 %1$s__load(struct %1$s *obj) \n\
1146 return bpf_object__load_skeleton(obj->skeleton); \n\
1152 struct %1$s *obj; \n\
1155 obj = %1$s__open(); \n\
1156 if (!obj) \n\
1158 err = %1$s__load(obj); \n\
1160 %1$s__destroy(obj); \n\
1164 return obj; \n\
1168 %1$s__attach(struct %1$s *obj) \n\
1170 return bpf_object__attach_skeleton(obj->skeleton); \n\
1174 %1$s__detach(struct %1$s *obj) \n\
1176 bpf_object__detach_skeleton(obj->skeleton); \n\
1188 %1$s__create_skeleton(struct %1$s *obj) \n\
1201 s->obj = &obj->obj; \n\
1206 codegen_maps_skeleton(obj, map_cnt, true /*mmaped*/);
1207 codegen_progs_skeleton(obj, prog_cnt, true /*populate_links*/);
1214 obj->skeleton = s; \n\
1252 codegen_asserts(obj, obj_name);
1262 bpf_object__close(obj);
1284 struct bpf_object *obj = NULL;
1354 * ELF section names out of it. (".data" instead of "obj.data")
1357 obj = bpf_object__open_mem(obj_data, file_sz, &opts);
1358 if (!obj) {
1363 obj = NULL;
1367 btf = bpf_object__btf(obj);
1374 bpf_object__for_each_program(prog, obj) {
1382 bpf_object__for_each_map(map, obj) {
1425 struct bpf_object *obj; \n\
1431 bpf_object__for_each_map(map, obj) {
1441 bpf_object__for_each_program(prog, obj) {
1448 err = codegen_subskel_datasecs(obj, obj_name);
1475 struct %1$s *obj; \n\
1479 obj = (struct %1$s *)calloc(1, sizeof(*obj)); \n\
1480 if (!obj) { \n\
1490 s->obj = src; \n\
1492 obj->subskel = s; \n\
1506 bpf_object__for_each_map(map, obj) {
1532 s->vars[%3$d].map = &obj->maps.%2$s; \n\
1533 s->vars[%3$d].addr = (void **) &obj->%2$s.%1$s;\n\
1540 codegen_maps_skeleton(obj, map_cnt, false /*mmaped*/);
1541 codegen_progs_skeleton(obj, prog_cnt, false /*links*/);
1550 return obj; \n\
1552 %1$s__destroy(obj); \n\
1567 bpf_object__close(obj);