Lines Matching defs:name

399  * bpf_prog should be a better name but it has been used in
403 char *name;
519 char *name;
522 * name. This is important to be able to find corresponding BTF
570 const char *name;
602 char *name;
645 size_t shstrndx; /* section index for section name strings */
660 char name[BPF_OBJ_NAME_LEN];
721 static Elf_Scn *elf_sec_by_name(const struct bpf_object *obj, const char *name);
736 static Elf_Data *elf_sec_data_by_name(const struct bpf_object *obj, const char *name, Elf_Data *data);
759 zfree(&prog->name);
791 const char *name, size_t sec_idx, const char *sec_name,
796 sec_name, name, sec_off, insn_data_sz);
819 /* from now on forget there was ? in section name */
834 prog->name = strdup(name);
835 if (!prog->name)
845 pr_warn("sec '%s': failed to allocate memory for prog '%s'\n", sec_name, name);
859 const char *name;
877 name = elf_sym_str(obj, sym->st_name);
878 if (!name) {
879 pr_warn("sec '%s': failed to get symbol name for offset %zu\n",
891 pr_warn("sec '%s': program '%s' is static and not supported\n", sec_name, name);
896 sec_name, name, sec_off / BPF_INSN_SZ, sec_off, prog_sz / BPF_INSN_SZ, prog_sz);
906 sec_name, name);
913 err = bpf_object__init_prog(obj, prog, name, sec_idx, sec_name,
953 const char *name)
959 if (!strcmp(btf__name_by_offset(btf, m->name_off), name))
968 const char *name, __u32 kind);
1058 map->name, st_ops->type_id, kern_type_id, kern_vtype_id);
1085 map->name, mname);
1093 map->name, mname);
1109 map->name, mname, BTF_INFO_KIND(mtype->info),
1131 map->name, mname);
1141 map->name, mname, prog->name, moff,
1151 map->name, mname, (ssize_t)msize,
1157 map->name, mname, (unsigned int)msize,
1240 map->name = strdup(var_name);
1241 if (!map->name)
1310 libbpf_strlcpy(obj->name, obj_name, sizeof(obj->name));
1313 libbpf_strlcpy(obj->name, basename((void *)path), sizeof(obj->name));
1314 end = strchr(obj->name, '.');
1526 static int find_elf_sec_sz(const struct bpf_object *obj, const char *name, __u32 *size)
1533 if (!name)
1536 scn = elf_sec_by_name(obj, name);
1541 data = elf_sec_data_by_name(obj, name, data);
1551 static Elf64_Sym *find_elf_var_sym(const struct bpf_object *obj, const char *name)
1569 pr_warn("failed to get sym name string for var %s\n", name);
1572 if (strcmp(name, sname) == 0)
1635 * internal names was to include as much of BPF object name prefix as
1640 * map name advertised to user and to the kernel will be
1641 * 'my_objec.rodata', taking first 8 characters of object name and
1643 * Somewhat confusingly, if internal map ELF section name is shorter
1648 * object name is somewhat consistent in this case. But if the map
1649 * name is '.kconfig', we'll still have entirety of '.kconfig' added
1651 * object name ('my_obje'). Happy guessing, user, that the final map
1652 * name will be "my_obje.kconfig".
1654 * and .data.* data sections, it's possible that ELF section name is
1656 * only up to 15 first characters of ELF name, taking no BPF object
1657 * name characters at all. So '.rodata.abracadabra' will result in
1658 * '.rodata.abracad' kernel and user-visible name.
1661 * maps we use their ELF names as is, not prepending bpf_object name
1663 * kernel. Full name can be recovered for such maps by using DATASEC
1669 /* if there are two or more dots in map name, it's a custom dot map */
1673 pfx_len = min((size_t)BPF_OBJ_NAME_LEN - sfx_len - 1, strlen(obj->name));
1675 snprintf(map_name, sizeof(map_name), "%.*s%.*s", pfx_len, obj->name,
1678 /* sanitise map name to characters allowed by kernel */
1737 map->name = internal_map_name(obj, real_name);
1738 if (!map->real_name || !map->name) {
1740 zfree(&map->name);
1759 map->name, map->sec_idx, map->sec_offset, def->map_flags);
1768 map->name, err);
1770 zfree(&map->name);
1777 pr_debug("map %td is \"%s\"\n", map - obj->maps, map->name);
1844 const void *name)
1849 if (strcmp(obj->externs[i].name, name) == 0)
1862 ext->name, value);
1883 ext->name, value);
1897 ext->name, value);
1904 ext->name, value);
1912 ext->name, value, len, ext->kcfg.sz - 1);
1971 ext->name, (unsigned long long)value);
1976 ext->name, (unsigned long long)value);
1982 ext->name, (unsigned long long)value, ext->kcfg.sz);
2053 pr_warn("extern (kcfg) '%s': value '%s' isn't a valid integer\n", ext->name, value);
2057 pr_warn("extern (kcfg) '%s': value '%s' implies integer type\n", ext->name, value);
2065 pr_debug("extern (kcfg) '%s': set to %s\n", ext->name, value);
2235 const char *name = btf__name_by_offset(btf, m->name_off);
2241 map_name, name, btf_kind_str(t));
2248 map_name, name, t->type);
2253 map_name, name, btf_kind_str(arr_t));
2261 static int pathname_concat(char *buf, size_t buf_sz, const char *path, const char *name)
2265 len = snprintf(buf, buf_sz, "%s/%s", path, name);
2292 /* PIN_BY_NAME: pin maps by name (in /sys/fs/bpf by default) */
2308 const char *name = btf__name_by_offset(btf, m->name_off);
2310 if (!name) {
2314 if (strcmp(name, "type") == 0) {
2318 } else if (strcmp(name, "max_entries") == 0) {
2322 } else if (strcmp(name, "map_flags") == 0) {
2326 } else if (strcmp(name, "numa_node") == 0) {
2330 } else if (strcmp(name, "key_size") == 0) {
2342 } else if (strcmp(name, "key") == 0) {
2370 } else if (strcmp(name, "value_size") == 0) {
2382 } else if (strcmp(name, "value") == 0) {
2411 else if (strcmp(name, "values") == 0) {
2425 map_name, name);
2477 } else if (strcmp(name, "pinning") == 0) {
2493 } else if (strcmp(name, "map_extra") == 0) {
2502 pr_warn("map '%s': unknown field '%s'.\n", map_name, name);
2505 pr_debug("map '%s': ignoring unknown field '%s'.\n", map_name, name);
2572 pr_debug("map '%s': found type = %u.\n", map->name, def->map_type);
2576 map->name, def->key_type_id, def->key_size);
2578 pr_debug("map '%s': found key_size = %u.\n", map->name, def->key_size);
2582 map->name, def->value_type_id, def->value_size);
2584 pr_debug("map '%s': found value_size = %u.\n", map->name, def->value_size);
2587 pr_debug("map '%s': found max_entries = %u.\n", map->name, def->max_entries);
2589 pr_debug("map '%s': found map_flags = 0x%x.\n", map->name, def->map_flags);
2591 pr_debug("map '%s': found map_extra = 0x%llx.\n", map->name,
2594 pr_debug("map '%s': found pinning = %u.\n", map->name, def->pinning);
2596 pr_debug("map '%s': found numa_node = %u.\n", map->name, def->numa_node);
2599 pr_debug("map '%s': found inner map definition.\n", map->name);
2632 pr_warn("map #%d: empty name.\n", var_idx);
2664 map->name = strdup(map_name);
2665 if (!map->name) {
2666 pr_warn("map '%s': failed to alloc map name.\n", map_name);
2677 err = parse_btf_map_def(map->name, obj->btf, def, strict, &map_def, &inner_def);
2686 pr_warn("map '%s': couldn't build pin path.\n", map->name);
2697 map->inner_map->name = malloc(strlen(map_name) + sizeof(".inner") + 1);
2698 if (!map->inner_map->name)
2700 sprintf(map->inner_map->name, "%s.inner", map_name);
2718 const char *name;
2745 name = btf__name_by_offset(obj->btf, t->name_off);
2746 if (strcmp(name, MAPS_ELF_SEC) == 0) {
2849 char *name;
2851 name = (char *)btf__name_by_offset(btf, t->name_off);
2852 while (*name) {
2853 if (*name == '.')
2854 *name = '_';
2855 name++;
2864 /* preserve variable name as member name */
2882 * valid struct name, make it anonymous
3043 pr_debug("No name found in string section for DATASEC kind.\n");
3094 pr_debug("sec '%s': failed to find name of DATASEC's member #%d\n",
3247 const char *name;
3259 name = btf__str_by_offset(obj->btf, t->name_off);
3260 if (strcmp(name, prog->name) != 0)
3278 const char *str = "exception_callback:", *name;
3286 name = btf__str_by_offset(obj->btf, t->name_off);
3287 if (strncmp(name, str, len))
3293 prog->name);
3296 if (strcmp(prog->name, btf__str_by_offset(obj->btf, t->name_off)))
3307 name += len;
3308 if (str_is_empty(name)) {
3310 prog->name);
3319 if (strcmp(name, subprog->name))
3327 prog->name, subprog->name);
3330 /* Let's see if we already saw a static exception callback with the same name */
3332 pr_warn("prog '%s': multiple subprogs with same name as exception callback '%s'\n",
3333 prog->name, subprog->name);
3342 pr_warn("prog '%s': cannot find exception callback '%s'\n", prog->name, name);
3405 const char *name;
3407 name = elf_strptr(obj->efile.elf, obj->efile.strtabidx, off);
3409 name = elfio_string_get_string(obj->efile.strstring, off);
3411 if (!name) {
3412 pr_warn("elf: failed to get section name string at offset %zu from %s: %s\n",
3417 return name;
3422 const char *name;
3424 name = elf_strptr(obj->efile.elf, obj->efile.shstrndx, off);
3426 name = elfio_string_get_string(obj->efile.shstring, off);
3429 if (!name) {
3430 pr_warn("elf: failed to get section name string at offset %zu from %s: %s\n",
3435 return name;
3452 static Elf_Scn *elf_sec_by_name(const struct bpf_object *obj, const char *name)
3463 if (strcmp(sec_name, name) != 0)
3490 const char *name;
3500 name = elf_sec_str(obj, sh->sh_name);
3501 if (!name) {
3502 pr_warn("elf: failed to get section(%zu) name from %s: %s\n",
3507 return name;
3530 const char *name;
3535 name = elf_sec_str(obj, sh.sh_name);
3536 if (!name) {
3537 pr_warn("elf: failed to get section(%zu) name from %s: %s\n",
3542 return name;
3565 static Elf_Data *elf_sec_data_by_name(const struct bpf_object *obj, const char *name, Elf_Data *data)
3568 psection_t psection_name = elfio_get_section_by_name(elf, name);
3602 static bool is_sec_name_dwarf(const char *name)
3605 return str_has_pfx(name, ".debug_");
3608 static bool ignore_elf_section(Elf64_Shdr *hdr, const char *name)
3620 strcmp(name, ".text") == 0)
3624 if (is_sec_name_dwarf(name))
3627 if (str_has_pfx(name, ".rel")) {
3628 name += sizeof(".rel") - 1;
3630 if (is_sec_name_dwarf(name))
3634 if (strcmp(name, BTF_ELF_SEC) == 0 ||
3635 strcmp(name, BTF_EXT_ELF_SEC) == 0)
3665 const char *name;
3794 name = elf_sec_str(obj, sh->sh_name);
3795 if (!name)
3798 if (ignore_elf_section(sh, name))
3810 idx, name, (unsigned long)data->d_size,
3814 if (strcmp(name, "license") == 0) {
3818 } else if (strcmp(name, "version") == 0) {
3822 } else if (strcmp(name, "maps") == 0) {
3825 } else if (strcmp(name, MAPS_ELF_SEC) == 0) {
3827 } else if (strcmp(name, BTF_ELF_SEC) == 0) {
3831 } else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) {
3839 if (strcmp(name, ".text") == 0)
3841 err = bpf_object__add_programs(obj, data, name, idx);
3844 } else if (strcmp(name, DATA_SEC) == 0 ||
3845 str_has_pfx(name, DATA_SEC ".")) {
3856 } else if (strcmp(name, RODATA_SEC) == 0 ||
3857 str_has_pfx(name, RODATA_SEC ".")) {
3869 } else if (strcmp(name, STRUCT_OPS_SEC) == 0) {
3880 idx, name);
3891 strcmp(name, ".rel" STRUCT_OPS_SEC) &&
3892 strcmp(name, ".rel" MAPS_ELF_SEC)) {
3895 idx, name, targ_sec_idx,
3899 idx, name, targ_sec_idx,
3912 } else if (sh->sh_type == SHT_NOBITS && (strcmp(name, BSS_SEC) == 0 ||
3913 str_has_pfx(name, BSS_SEC "."))) {
3922 pr_info("elf: skipping section(%d) %s (size %zu)\n", idx, name,
3932 /* sort BPF programs by section name and in-section instruction offset
4029 const char *name;
4032 name = btf__name_by_offset(btf, t->name_off);
4053 if (strcmp(name, "libbpf_tristate"))
4057 if (strcmp(name, "libbpf_tristate"))
4088 /* resolve ties by name */
4089 return strcmp(a->name, b->name);
4209 ext->name = btf__name_by_offset(obj->btf, t->name_off);
4213 ext_essent_len = bpf_core_essential_name_len(ext->name);
4215 if (ext_essent_len != strlen(ext->name)) {
4216 ext->essent_name = strndup(ext->name, ext_essent_len);
4233 ext->name, KCONFIG_SEC);
4271 /* sort externs by type, for kcfg ones also by (align, size, name) */
4285 * its name string will be used to refill
4286 * the missing param's name.
4295 pr_debug("extern (ksym) #%d: symbol %d, name %s\n",
4296 i, ext->sym_idx, ext->name);
4322 * func proto does not have param name.
4352 pr_debug("extern (kcfg) #%d: symbol %d, off %u, name %s\n",
4353 i, ext->sym_idx, ext->kcfg.data_off, ext->name);
4382 const char *name)
4389 if (!strcmp(prog->name, name))
4447 prog->name, sym_name, insn_idx, insn->code);
4463 prog->name, sym_name, sym_idx);
4467 prog->name, i, ext->name, ext->sym_idx, insn_idx);
4480 pr_warn("prog '%s': incorrect bpf_call opcode\n", prog->name);
4491 prog->name, sym_name, sym_sec_name);
4496 prog->name, sym_name, (size_t)sym->st_value);
4507 prog->name, sym_name, shdr_idx);
4518 prog->name, sym_name, (size_t)sym->st_value, insn->imm);
4538 prog->name, sym_name, sym_sec_name);
4548 prog->name, map_idx, map->name, map->sec_idx,
4554 prog->name, sym_sec_name, (size_t)sym->st_value);
4567 prog->name, sym_sec_name);
4575 prog->name, map_idx, map->name, map->sec_idx,
4581 prog->name, sym_sec_name);
4699 * will point to empty string (0), so fetch section name
4834 name_len = strlen(info.name);
4835 if (name_len == BPF_OBJ_NAME_LEN - 1 && strncmp(map->name, info.name, name_len) == 0)
4836 new_name = strdup(map->name);
4838 new_name = strdup(info.name);
4859 free(map->name);
4862 map->name = new_name;
4968 /* make sure loading with name works */
5196 char name[16];
5204 info.name = ptr_to_u64(name);
5205 info.name_len = sizeof(name);
5207 /* check that BPF_OBJ_GET_INFO_BY_FD supports specifying name pointer;
5209 * name/name_len fields in struct bpf_btf_info.
5314 "BPF program name", probe_kern_prog_name,
5485 map->name, cp);
5496 map->name, cp);
5513 map_name = map->name;
5533 map->name, err);
5586 map->name, cp, err);
5632 map->name, i, targ_map->name, fd, err);
5636 map->name, i, targ_map->name, fd);
5665 map->name, i, targ_prog->name, fd, err);
5669 map->name, i, targ_prog->name, fd);
5706 map->name, nr_cpus);
5709 pr_debug("map '%s': setting size to %d\n", map->name, nr_cpus);
5732 * out with program name and relocation index logged.
5746 pr_debug("map '%s': skipped auto-creating...\n", map->name);
5760 map->name);
5765 map->name);
5773 map->name, map->fd);
5780 map->name, map->fd);
5808 map->name, map->pin_path, err);
5818 pr_warn("map '%s': failed to create: %s(%d)\n", map->name, cp, err);
5827 /* check X___Y name pattern, where X and Y are not underscores */
5833 /* Given 'some_struct_name___with_flavor' return the length of a name prefix
5834 * before last triple underscore. Struct name part after last triple
5837 size_t bpf_core_essential_name_len(const char *name)
5839 size_t n = strlen(name);
5843 if (bpf_core_is_flavor_sep(name + i))
5915 char name[64];
5957 info.name = ptr_to_u64(name);
5958 info.name_len = sizeof(name);
5968 if (!info.kernel_btf || strcmp(name, "vmlinux") == 0) {
5977 name, id, err);
5991 mod_btf->name = strdup(name);
5992 if (!mod_btf->name) {
6054 obj->btf_modules[i].name,
6070 * checked for name match. Beyond that initial root-level name check, names
6151 const char *prog_name = prog->name;
6269 prog->name, i, err);
6279 prog->name, i, err);
6283 err = bpf_core_patch_insn(prog->name, insn, insn_idx, rec, i, &targ_res);
6286 prog->name, i, insn_idx, err);
6317 prog->name, relo_idx, insn_idx, map_idx, map->name);
6345 prog->name, relo_idx, insn_idx, ext->name);
6440 prog->name, i);
6453 prog->name, i, relo->type);
6555 prog->name, err);
6563 pr_warn("prog '%s': missing .BTF.ext function info.\n", prog->name);
6568 prog->name);
6583 prog->name, err);
6591 pr_warn("prog '%s': missing .BTF.ext line info.\n", prog->name);
6596 prog->name);
6661 pr_warn("prog '%s': failed to realloc prog code\n", main_prog->name);
6671 main_prog->name, subprog->insns_cnt, subprog->name);
6707 prog->name, insn_idx, relo->type);
6731 prog->name, insn_idx);
6747 prog->name);
6783 prog->name, insn_idx, insn->imm, subprog->name, subprog->sub_insn_off);
6993 prog->name, err);
7026 prog->name, err);
7048 const char *name, *mname, *type;
7074 name = elf_sym_str(obj, sym->st_name) ?: "<?>";
7076 pr_debug(".maps relo #%d: for %zd value %zd rel->r_offset %zu name %d ('%s')\n",
7078 (size_t)rel->r_offset, sym->st_name, name);
7092 i, name, (size_t)rel->r_offset);
7102 i, name);
7108 i, map->name, sizeof(int));
7111 targ_map = bpf_object__find_map_by_name(obj, name);
7114 i, name);
7118 targ_prog = bpf_object__find_program_by_name(obj, name);
7121 i, name);
7128 i, name);
7168 i, map->name, moff, type, name);
7302 prog->name);
7346 pr_warn("prog '%s': missing BPF prog type, check ELF section name '%s'\n",
7347 prog->name, prog->sec_name);
7355 prog_name = prog->name;
7382 prog->name, err);
7393 bpf_gen__prog_load(obj->gen_loader, prog->type, prog->name,
7436 prog->name, log_buf);
7451 prog->name, map->real_name, cp);
7482 pr_warn("prog '%s': BPF program load failed: %s\n", prog->name, cp);
7487 prog->name, log_buf);
7573 err = bpf_core_parse_spec(prog->name, prog->obj->btf, relo, &spec);
7596 * "345" in "2001000345" is a map index in obj->maps to fetch map name.
7614 insn_idx, map->name);
7629 * "345" in "2002000345" is an extern index in obj->externs to fetch kfunc name.
7647 insn_idx, ext->name);
7718 bpf_gen__record_extern(obj->gen_loader, ext->name,
7723 bpf_gen__record_extern(obj->gen_loader, ext->name,
7764 pr_debug("prog '%s': skipped loading\n", prog->name);
7775 pr_warn("prog '%s': failed to load: %d\n", prog->name, err);
7795 pr_debug("prog '%s': unrecognized ELF section name '%s'\n",
7796 prog->name, prog->sec_name);
7810 prog->name, err);
8080 id = find_ksym_btf_id(obj, ext->name, BTF_KIND_VAR, &btf, &mod_btf);
8085 ext->name);
8108 ext->name, local_type_id,
8118 ext->name, id, btf_kind_str(targ_var), targ_var_name);
8134 kfunc_id = find_ksym_btf_id(obj, ext->essent_name ?: ext->name, BTF_KIND_FUNC, &kern_btf,
8140 ext->name);
8154 ext->name, local_func_proto_id,
8155 mod_btf ? mod_btf->name : "vmlinux", kfunc_proto_id);
8164 ext->name, mod_btf->fd_array_idx);
8190 ext->name, mod_btf ? mod_btf->name : "vmlinux", kfunc_id);
8252 if (str_has_pfx(ext->name, "CONFIG_")) {
8258 if (strcmp(ext->name, "LINUX_KERNEL_VERSION") == 0) {
8261 pr_warn("extern (kcfg) '%s': failed to get kernel version\n", ext->name);
8264 } else if (strcmp(ext->name, "LINUX_HAS_BPF_COOKIE") == 0) {
8266 } else if (strcmp(ext->name, "LINUX_HAS_SYSCALL_WRAPPER") == 0) {
8268 } else if (!str_has_pfx(ext->name, "LINUX_") || !ext->is_weak) {
8276 pr_warn("extern (kcfg) '%s': unrecognized virtual extern\n", ext->name);
8284 ext->name, (long long)value);
8286 pr_warn("extern '%s': unrecognized extern kind\n", ext->name);
8322 pr_warn("extern '%s' (strong): not resolved\n", ext->name);
8326 ext->name);
8372 pr_warn("object '%s': load can't be attempted twice\n", obj->name);
8408 free(obj->btf_modules[i].name);
8496 pr_warn("prog '%s': can't pin program that wasn't loaded\n", prog->name);
8511 pr_warn("prog '%s': failed to pin at '%s': %s\n", prog->name, path, cp);
8515 pr_debug("prog '%s': pinned at '%s'\n", prog->name, path);
8524 pr_warn("prog '%s': can't unpin program that wasn't loaded\n", prog->name);
8536 pr_debug("prog '%s': unpinned from '%s'\n", prog->name, path);
8768 err = pathname_concat(buf, sizeof(buf), path, prog->name);
8781 if (pathname_concat(buf, sizeof(buf), path, prog->name))
8801 err = pathname_concat(buf, sizeof(buf), path, prog->name);
8870 zfree(&map->name);
8921 return obj ? obj->name : libbpf_err_ptr(-EINVAL);
9022 return prog->name;
9075 pr_warn("prog '%s': failed to realloc prog code\n", prog->name);
9502 int libbpf_prog_type_by_name(const char *name, enum bpf_prog_type *prog_type,
9508 if (!name)
9511 sec_def = find_sec_def(name);
9518 pr_debug("failed to guess program type from ELF section '%s'\n", name);
9591 const char *name;
9613 name = elf_sym_str(obj, sym->st_name) ?: "<?>";
9624 pr_debug("struct_ops reloc %s: for %lld value %lld shdr_idx %u rel->r_offset %zu map->sec_offset %zu name %d (\'%s\')\n",
9625 map->name,
9629 map->sec_offset, sym->st_name, name);
9633 map->name, (size_t)rel->r_offset, shdr_idx);
9638 map->name, (unsigned long long)sym->st_value);
9646 map->name, moff);
9650 name = btf__name_by_offset(btf, member->name_off);
9654 map->name, name);
9661 map->name, shdr_idx, name);
9668 map->name, prog->name);
9688 map->name, prog->name, prog->sec_name, prog->type,
9689 prog->attach_btf_id, prog->expected_attach_type, name);
9728 const char *name, __u32 kind)
9734 "%s%s", prefix, name);
9744 static inline int find_attach_btf_id(struct btf *btf, const char *name,
9751 return find_btf_by_prefix_kind(btf, prefix, name, kind);
9754 int libbpf_find_vmlinux_btf_id(const char *name,
9767 err = find_attach_btf_id(btf, name, attach_type);
9769 pr_warn("%s is not found in vmlinux BTF\n", name);
9775 static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd)
9801 err = btf__find_by_name_kind(btf, name, BTF_KIND_FUNC);
9804 pr_warn("%s is not found in prog's BTF\n", name);
9858 pr_warn("prog '%s': attach program FD is not set\n", prog->name);
9864 prog->name, attach_prog_fd, attach_name, err);
9882 prog->name, attach_name, err);
9888 int libbpf_attach_type_by_name(const char *name,
9894 if (!name)
9897 sec_def = find_sec_def(name);
9899 pr_debug("failed to guess attach type based on ELF section name '%s'\n", name);
9926 * their user-visible name differs from kernel-visible name. Users see
9927 * such map's corresponding ELF section name as a map name.
9929 * maps to know which name has to be returned to the user.
9946 return map->name;
10231 bpf_object__find_map_by_name(const struct bpf_object *obj, const char *name)
10236 /* if it's a special internal map name (which always starts
10237 * with dot) then check if that special name matches the
10238 * real map name (ELF section name)
10240 if (name[0] == '.') {
10241 if (pos->real_name && strcmp(pos->real_name, name) == 0)
10245 /* otherwise map name has to be an exact match */
10247 if (strcmp(pos->real_name, name) == 0)
10251 if (strcmp(pos->name, name) == 0)
10258 bpf_object__find_map_fd_by_name(const struct bpf_object *obj, const char *name)
10260 return bpf_map__fd(bpf_object__find_map_by_name(obj, name));
10271 map->name, key_sz, map->def.key_size);
10288 map->name, value_sz, num_cpu, elem_sz, num_cpu * elem_sz);
10296 map->name, value_sz, map->def.value_size);
10577 prog->name, pfd);
10583 prog->name);
10603 prog->name, pfd,
10610 pr_warn("prog '%s': user context value is not supported\n", prog->name);
10618 prog->name, pfd, libbpf_strerror_r(err, errmsg, sizeof(errmsg)));
10621 prog->name, pfd);
10629 prog->name, pfd, libbpf_strerror_r(err, errmsg, sizeof(errmsg)));
10707 static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
10743 attr.config1 = ptr_to_u64(name); /* kprobe_func or uprobe_path */
10827 /* sanitize binary_path in the probe name */
11027 prog->name, retprobe ? "kretprobe" : "kprobe",
11037 prog->name, retprobe ? "kretprobe" : "kprobe",
11180 char *name;
11199 name = strdup(sym_name);
11200 if (!name) {
11205 syms[cnt++] = name;
11351 prog->name, libbpf_strerror_r(err, errmsg, sizeof(errmsg)));
11386 pr_warn("kprobe name is invalid: %s\n", func_name);
11474 pr_warn("prog '%s': invalid format of section definition '%s'\n", prog->name,
11491 /* sanitize binary_path in the probe name */
11566 /* Find offset of function name in object specified by path. "name" matches
11567 * symbol name or name@@LIB for library functions.
11777 prog->name, path, err);
11819 prog->name, libbpf_strerror_r(err, errmsg, sizeof(errmsg)));
11871 prog->name, binary_path, err);
11935 prog->name, retprobe ? "uretprobe" : "uprobe",
11946 prog->name, retprobe ? "uretprobe" : "uprobe",
11996 prog->name, prog->sec_name);
12014 prog->name);
12022 pr_warn("prog '%s': invalid format of section definition '%s'\n", prog->name,
12060 prog->name);
12071 prog->name, binary_path, err);
12101 char *path = NULL, *provider = NULL, *name = NULL;
12112 n = sscanf(sec_name, "usdt/%m[^:]:%m[^:]:%m[^:]", &path, &provider, &name);
12114 pr_warn("invalid section '%s', expected SEC(\"usdt/<path>:<provider>:<name>\")\n",
12119 provider, name, NULL);
12124 free(name);
12198 prog->name, tp_category, tp_name,
12207 prog->name, tp_category, tp_name,
12235 /* extract "tp/<category>/<name>" or "tracepoint/<category>/<name>" */
12262 pr_warn("prog '%s': can't attach before loaded\n", prog->name);
12276 prog->name, tp_name, libbpf_strerror_r(pfd, errmsg, sizeof(errmsg)));
12315 pr_warn("prog '%s': invalid section name '%s'\n",
12316 prog->name, prog->sec_name);
12338 pr_warn("prog '%s': can't attach before loaded\n", prog->name);
12354 prog->name, libbpf_strerror_r(pfd, errmsg, sizeof(errmsg)));
12401 pr_warn("prog '%s': can't attach before loaded\n", prog->name);
12416 prog->name, target_name,
12459 prog->name);
12464 prog->name);
12494 prog->name);
12499 prog->name);
12519 prog->name);
12525 prog->name);
12566 pr_warn("prog '%s': can't attach before loaded\n", prog->name);
12581 prog->name, libbpf_strerror_r(link_fd, errmsg, sizeof(errmsg)));
12606 pr_warn("prog '%s': can't attach before loaded\n", prog->name);
12628 prog->name, libbpf_strerror_r(link_fd, errmsg, sizeof(errmsg)));
13036 map.name);
13474 const char *name = maps[i].name;
13477 *map = bpf_object__find_map_by_name(obj, name);
13479 pr_warn("failed to find skeleton map '%s'\n", name);
13498 const char *name = progs[i].name;
13500 *prog = bpf_object__find_program_by_name(obj, name);
13502 pr_warn("failed to find skeleton program '%s'\n", name);
13513 .object_name = s->name,
13519 * explicitly. Overwriting object name for skeletons is discouraged,
13520 * as it breaks global data maps, because they contain object name
13521 * prefix as their own map name prefix. When skeleton is generated,
13522 * bpftool is making an assumption that this name will stay the same.
13527 skel_opts.object_name = s->name;
13534 s->name, err);
13541 pr_warn("failed to populate skeleton maps for '%s': %d\n", s->name, err);
13547 pr_warn("failed to populate skeleton progs for '%s': %d\n", s->name, err);
13605 if (strcmp(var_name, var_skel->name) == 0) {
13630 pr_warn("failed to load BPF skeleton '%s': %d\n", s->name, err);
13706 * binary and function name, such BPF program can be