Lines Matching refs:path

474 	char path[];
1030 static struct bpf_object *bpf_object__new(const char *path,
1038 obj = calloc(1, sizeof(struct bpf_object) + strlen(path) + 1);
1040 pr_warn("alloc memory failed for %s\n", path);
1044 strcpy(obj->path, path);
1050 strncpy(obj->name, basename((void *)path),
1128 obj->efile.fd = open(obj->path, O_RDONLY);
1134 pr_warn("elf: failed to open %s: %s\n", obj->path, cp);
1142 pr_warn("elf: failed to open %s as ELF file: %s\n", obj->path, elf_errmsg(-1));
1148 pr_warn("elf: failed to get ELF header from %s: %s\n", obj->path, elf_errmsg(-1));
1156 obj->path, elf_errmsg(-1));
1164 obj->path, elf_errmsg(-1));
1172 pr_warn("elf: %s is not a valid eBPF object file\n", obj->path);
1194 pr_warn("elf: endianness mismatch in %s.\n", obj->path);
1202 pr_debug("license of %s is %s\n", obj->path, obj->license);
1212 pr_warn("invalid kver section in %s\n", obj->path);
1217 pr_debug("kernel version of %s is %x\n", obj->path, obj->kern_version);
1765 obj->path);
1788 nr_maps, data->d_size, obj->path);
1792 obj->path);
1816 i, obj->path);
1827 obj->path, map_name);
1859 obj->path, map_name);
1961 static int build_map_pin_path(struct bpf_map *map, const char *path)
1966 if (!path)
1967 path = "/sys/fs/bpf";
1969 len = snprintf(buf, PATH_MAX, "%s/%s", path, bpf_map__name(map));
2191 pr_warn("map '%s': couldn't build pin path.\n",
2299 MAPS_ELF_SEC, obj->path);
2624 off, obj->path, elf_errmsg(-1));
2638 off, obj->path, elf_errmsg(-1));
2652 idx, obj->path, elf_errmsg(-1));
2684 elf_ndxscn(scn), obj->path, elf_errmsg(-1));
2705 elf_ndxscn(scn), obj->path, elf_errmsg(-1));
2723 obj->path, elf_errmsg(-1));
2823 pr_warn("elf: multiple symbol tables in %s\n", obj->path);
2933 pr_warn("elf: symbol strings section missing or invalid in %s\n", obj->path);
6942 __bpf_object__open(const char *path, const void *obj_buf, size_t obj_buf_sz,
6953 path ? : "(mem buf)");
6968 path = obj_name;
6972 obj = bpf_object__new(path, obj_buf, obj_buf_sz, obj_name);
7039 struct bpf_object *bpf_object__open(const char *path)
7042 .file = path,
7050 bpf_object__open_file(const char *path, const struct bpf_object_open_opts *opts)
7052 if (!path)
7055 pr_debug("loading %s\n", path);
7057 return __bpf_object__open(path, NULL, 0, opts);
7362 pr_warn("failed to load object '%s'\n", obj->path);
7375 static int make_parent_dir(const char *path)
7381 dname = strdup(path);
7392 pr_warn("failed to mkdir %s: %s\n", path, cp);
7397 static int check_path(const char *path)
7404 if (path == NULL)
7407 dname = strdup(path);
7420 pr_warn("specified path %s is not on BPF FS\n", path);
7427 int bpf_program__pin_instance(struct bpf_program *prog, const char *path,
7433 err = make_parent_dir(path);
7437 err = check_path(path);
7452 if (bpf_obj_pin(prog->instances.fds[instance], path)) {
7458 pr_debug("pinned program '%s'\n", path);
7463 int bpf_program__unpin_instance(struct bpf_program *prog, const char *path,
7468 err = check_path(path);
7483 err = unlink(path);
7486 pr_debug("unpinned program '%s'\n", path);
7491 int bpf_program__pin(struct bpf_program *prog, const char *path)
7495 err = make_parent_dir(path);
7499 err = check_path(path);
7515 return bpf_program__pin_instance(prog, path, 0);
7522 len = snprintf(buf, PATH_MAX, "%s/%d", path, i);
7543 len = snprintf(buf, PATH_MAX, "%s/%d", path, i);
7552 rmdir(path);
7557 int bpf_program__unpin(struct bpf_program *prog, const char *path)
7561 err = check_path(path);
7577 return bpf_program__unpin_instance(prog, path, 0);
7584 len = snprintf(buf, PATH_MAX, "%s/%d", path, i);
7595 err = rmdir(path);
7602 int bpf_map__pin(struct bpf_map *map, const char *path)
7613 if (path && strcmp(path, map->pin_path)) {
7614 pr_warn("map '%s' already has pin path '%s' different from '%s'\n",
7615 bpf_map__name(map), map->pin_path, path);
7623 if (!path) {
7624 pr_warn("missing a path to pin map '%s' at\n",
7632 map->pin_path = strdup(path);
7663 int bpf_map__unpin(struct bpf_map *map, const char *path)
7673 if (path && strcmp(path, map->pin_path)) {
7674 pr_warn("map '%s' already has pin path '%s' different from '%s'\n",
7675 bpf_map__name(map), map->pin_path, path);
7678 path = map->pin_path;
7679 } else if (!path) {
7680 pr_warn("no path to unpin map '%s' from\n",
7685 err = check_path(path);
7689 err = unlink(path);
7694 pr_debug("unpinned map '%s' from '%s'\n", bpf_map__name(map), path);
7699 int bpf_map__set_pin_path(struct bpf_map *map, const char *path)
7703 if (path) {
7704 new = strdup(path);
7726 /* bpffs disallows periods in path names */
7734 int bpf_object__pin_maps(struct bpf_object *obj, const char *path)
7751 if (path) {
7754 len = snprintf(buf, PATH_MAX, "%s/%s", path,
7787 int bpf_object__unpin_maps(struct bpf_object *obj, const char *path)
7799 if (path) {
7802 len = snprintf(buf, PATH_MAX, "%s/%s", path,
7822 int bpf_object__pin_programs(struct bpf_object *obj, const char *path)
7839 len = snprintf(buf, PATH_MAX, "%s/%s", path,
7861 len = snprintf(buf, PATH_MAX, "%s/%s", path,
7874 int bpf_object__unpin_programs(struct bpf_object *obj, const char *path)
7886 len = snprintf(buf, PATH_MAX, "%s/%s", path,
7901 int bpf_object__pin(struct bpf_object *obj, const char *path)
7905 err = bpf_object__pin_maps(obj, path);
7909 err = bpf_object__pin_programs(obj, path);
7911 bpf_object__unpin_maps(obj, path);
9201 struct bpf_link *bpf_link__open(const char *path)
9206 fd = bpf_obj_get(path);
9209 pr_warn("failed to open link at %s: %d\n", path, fd);
9221 link->pin_path = strdup(path);
9235 int bpf_link__pin(struct bpf_link *link, const char *path)
9241 err = make_parent_dir(path);
9244 err = check_path(path);
9248 link->pin_path = strdup(path);
9523 pr_debug("tracepoint %s/%s path is too long\n",