]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - tools/bpf/bpftool/prog.c
Merge tag 'wireless-drivers-for-davem-2017-11-22' of git://git.kernel.org/pub/scm...
[mirror_ubuntu-bionic-kernel.git] / tools / bpf / bpftool / prog.c
index 250f80fd46aa90081700d5c66afd10282f091594..ad619b96c27664300df9a78bc28958c4d8662a4b 100644 (file)
@@ -256,6 +256,18 @@ static void print_prog_json(struct bpf_prog_info *info, int fd)
        if (info->nr_map_ids)
                show_prog_maps(fd, info->nr_map_ids);
 
+       if (!hash_empty(prog_table.table)) {
+               struct pinned_obj *obj;
+
+               jsonw_name(json_wtr, "pinned");
+               jsonw_start_array(json_wtr);
+               hash_for_each_possible(prog_table.table, obj, hash, info->id) {
+                       if (obj->id == info->id)
+                               jsonw_string(json_wtr, obj->path);
+               }
+               jsonw_end_array(json_wtr);
+       }
+
        jsonw_end_object(json_wtr);
 }
 
@@ -300,6 +312,16 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
        if (info->nr_map_ids)
                show_prog_maps(fd, info->nr_map_ids);
 
+       if (!hash_empty(prog_table.table)) {
+               struct pinned_obj *obj;
+
+               printf("\n");
+               hash_for_each_possible(prog_table.table, obj, hash, info->id) {
+                       if (obj->id == info->id)
+                               printf("\tpinned %s\n", obj->path);
+               }
+       }
+
        printf("\n");
 }
 
@@ -329,6 +351,9 @@ static int do_show(int argc, char **argv)
        int err;
        int fd;
 
+       if (show_pinned)
+               build_pinned_obj_table(&prog_table, BPF_OBJ_PROG);
+
        if (argc == 2) {
                fd = prog_parse_fd(&argc, &argv);
                if (fd < 0)