Lines Matching refs:sec_def

432 	const struct bpf_sec_def *sec_def;  member
7466 if (prog->sec_def && prog->sec_def->prog_prepare_load_fn) { in bpf_object_load_prog()
7467 err = prog->sec_def->prog_prepare_load_fn(prog, &load_attr, prog->sec_def->cookie); in bpf_object_load_prog()
7880 prog->sec_def = find_sec_def(prog->sec_name); in bpf_object_init_progs()
7881 if (!prog->sec_def) { in bpf_object_init_progs()
7888 prog->type = prog->sec_def->prog_type; in bpf_object_init_progs()
7889 prog->expected_attach_type = prog->sec_def->expected_attach_type; in bpf_object_init_progs()
7894 if (prog->sec_def->prog_setup_fn) { in bpf_object_init_progs()
7895 err = prog->sec_def->prog_setup_fn(prog, prog->sec_def->cookie); in bpf_object_init_progs()
9265 if (prog->sec_def != &custom_fallback_def) in bpf_program__set_type()
9266 prog->sec_def = NULL; in bpf_program__set_type()
9467 struct bpf_sec_def *sec_def; in libbpf_register_prog_handler() local
9476 sec_def = libbpf_reallocarray(custom_sec_defs, custom_sec_def_cnt + 1, in libbpf_register_prog_handler()
9477 sizeof(*sec_def)); in libbpf_register_prog_handler()
9478 if (!sec_def) in libbpf_register_prog_handler()
9481 custom_sec_defs = sec_def; in libbpf_register_prog_handler()
9482 sec_def = &custom_sec_defs[custom_sec_def_cnt]; in libbpf_register_prog_handler()
9487 sec_def = &custom_fallback_def; in libbpf_register_prog_handler()
9490 sec_def->sec = sec ? strdup(sec) : NULL; in libbpf_register_prog_handler()
9491 if (sec && !sec_def->sec) in libbpf_register_prog_handler()
9494 sec_def->prog_type = prog_type; in libbpf_register_prog_handler()
9495 sec_def->expected_attach_type = exp_attach_type; in libbpf_register_prog_handler()
9496 sec_def->cookie = OPTS_GET(opts, cookie, 0); in libbpf_register_prog_handler()
9498 sec_def->prog_setup_fn = OPTS_GET(opts, prog_setup_fn, NULL); in libbpf_register_prog_handler()
9499 sec_def->prog_prepare_load_fn = OPTS_GET(opts, prog_prepare_load_fn, NULL); in libbpf_register_prog_handler()
9500 sec_def->prog_attach_fn = OPTS_GET(opts, prog_attach_fn, NULL); in libbpf_register_prog_handler()
9502 sec_def->handler_id = ++last_custom_sec_def_handler_id; in libbpf_register_prog_handler()
9509 return sec_def->handler_id; in libbpf_register_prog_handler()
9551 static bool sec_def_matches(const struct bpf_sec_def *sec_def, const char *sec_name) in sec_def_matches() argument
9553 size_t len = strlen(sec_def->sec); in sec_def_matches()
9556 if (sec_def->sec[len - 1] == '/') { in sec_def_matches()
9557 if (str_has_pfx(sec_name, sec_def->sec)) in sec_def_matches()
9565 if (sec_def->sec[len - 1] == '+') { in sec_def_matches()
9568 if (strncmp(sec_name, sec_def->sec, len) != 0) in sec_def_matches()
9576 return strcmp(sec_name, sec_def->sec) == 0; in sec_def_matches()
9581 const struct bpf_sec_def *sec_def; in find_sec_def() local
9586 sec_def = &custom_sec_defs[i]; in find_sec_def()
9587 if (sec_def_matches(sec_def, sec_name)) in find_sec_def()
9588 return sec_def; in find_sec_def()
9593 sec_def = &section_defs[i]; in find_sec_def()
9594 if (sec_def_matches(sec_def, sec_name)) in find_sec_def()
9595 return sec_def; in find_sec_def()
9618 const struct bpf_sec_def *sec_def = &section_defs[i]; in libbpf_get_type_names() local
9621 if (sec_def->prog_prepare_load_fn != libbpf_prepare_prog_load) in libbpf_get_type_names()
9624 if (!(sec_def->cookie & SEC_ATTACHABLE)) in libbpf_get_type_names()
9642 const struct bpf_sec_def *sec_def; in libbpf_prog_type_by_name() local
9648 sec_def = find_sec_def(name); in libbpf_prog_type_by_name()
9649 if (sec_def) { in libbpf_prog_type_by_name()
9650 *prog_type = sec_def->prog_type; in libbpf_prog_type_by_name()
9651 *expected_attach_type = sec_def->expected_attach_type; in libbpf_prog_type_by_name()
10039 const struct bpf_sec_def *sec_def; in libbpf_attach_type_by_name() local
10044 sec_def = find_sec_def(name); in libbpf_attach_type_by_name()
10045 if (!sec_def) { in libbpf_attach_type_by_name()
10056 if (sec_def->prog_prepare_load_fn != libbpf_prepare_prog_load) in libbpf_attach_type_by_name()
10058 if (!(sec_def->cookie & SEC_ATTACHABLE)) in libbpf_attach_type_by_name()
10061 *attach_type = sec_def->expected_attach_type; in libbpf_attach_type_by_name()
12880 if (!prog->sec_def || !prog->sec_def->prog_attach_fn) in bpf_program__attach()
12889 err = prog->sec_def->prog_attach_fn(prog, prog->sec_def->cookie, &link); in bpf_program__attach()
13938 if (!prog->sec_def || !prog->sec_def->prog_attach_fn) in bpf_object__attach_skeleton()
13945 err = prog->sec_def->prog_attach_fn(prog, prog->sec_def->cookie, link); in bpf_object__attach_skeleton()