[RFC][PATCH v3 13/15] bpftool: Complete switch to bpf_*_get_fd_by_id_opts()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Complete the switch to the new functions bpf_*_get_fd_by_id_opts(),
accepting the additional opts parameter.

The value passed to these functions is always NULL, so that there is no
variation in the behavior.

Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxxx>
---
 tools/bpf/bpftool/btf.c        | 8 ++++----
 tools/bpf/bpftool/btf_dumper.c | 2 +-
 tools/bpf/bpftool/cgroup.c     | 4 ++--
 tools/bpf/bpftool/link.c       | 4 ++--
 tools/bpf/bpftool/map.c        | 2 +-
 tools/bpf/bpftool/prog.c       | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
index c3059cb3196c..2cbc777f1520 100644
--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
@@ -536,7 +536,7 @@ static bool btf_is_kernel_module(__u32 btf_id)
 	__u32 len;
 	int err;
 
-	btf_fd = bpf_btf_get_fd_by_id(btf_id);
+	btf_fd = bpf_btf_get_fd_by_id_opts(btf_id, NULL);
 	if (btf_fd < 0) {
 		p_err("can't get BTF object by id (%u): %s", btf_id, strerror(errno));
 		return false;
@@ -779,10 +779,10 @@ build_btf_type_table(struct hashmap *tab, enum bpf_obj_type type,
 
 		switch (type) {
 		case BPF_OBJ_PROG:
-			fd = bpf_prog_get_fd_by_id(id);
+			fd = bpf_prog_get_fd_by_id_opts(id, NULL);
 			break;
 		case BPF_OBJ_MAP:
-			fd = bpf_map_get_fd_by_id(id);
+			fd = bpf_map_get_fd_by_id_opts(id, NULL);
 			break;
 		default:
 			err = -1;
@@ -1037,7 +1037,7 @@ static int do_show(int argc, char **argv)
 			break;
 		}
 
-		fd = bpf_btf_get_fd_by_id(id);
+		fd = bpf_btf_get_fd_by_id_opts(id, NULL);
 		if (fd < 0) {
 			if (errno == ENOENT)
 				continue;
diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c
index 125798b0bc5d..8acc100c3093 100644
--- a/tools/bpf/bpftool/btf_dumper.c
+++ b/tools/bpf/bpftool/btf_dumper.c
@@ -53,7 +53,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d,
 		goto print;
 
 	/* Get the bpf_prog's name.  Obtain from func_info. */
-	prog_fd = bpf_prog_get_fd_by_id(prog_id);
+	prog_fd = bpf_prog_get_fd_by_id_opts(prog_id, NULL);
 	if (prog_fd < 0)
 		goto print;
 
diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
index cc007ddc945b..ce8cf97c190f 100644
--- a/tools/bpf/bpftool/cgroup.c
+++ b/tools/bpf/bpftool/cgroup.c
@@ -78,7 +78,7 @@ static void guess_vmlinux_btf_id(__u32 attach_btf_obj_id)
 	btf_info.name = ptr_to_u64(name);
 	btf_info.name_len = sizeof(name);
 
-	fd = bpf_btf_get_fd_by_id(attach_btf_obj_id);
+	fd = bpf_btf_get_fd_by_id_opts(attach_btf_obj_id, NULL);
 	if (fd < 0)
 		return;
 
@@ -104,7 +104,7 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type,
 	__u32 info_len = sizeof(info);
 	int prog_fd;
 
-	prog_fd = bpf_prog_get_fd_by_id(id);
+	prog_fd = bpf_prog_get_fd_by_id_opts(id, NULL);
 	if (prog_fd < 0)
 		return -1;
 
diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
index b319f9769d90..9851c89f5798 100644
--- a/tools/bpf/bpftool/link.c
+++ b/tools/bpf/bpftool/link.c
@@ -99,7 +99,7 @@ static int get_prog_info(int prog_id, struct bpf_prog_info *info)
 	__u32 len = sizeof(*info);
 	int err, prog_fd;
 
-	prog_fd = bpf_prog_get_fd_by_id(prog_id);
+	prog_fd = bpf_prog_get_fd_by_id_opts(prog_id, NULL);
 	if (prog_fd < 0)
 		return prog_fd;
 
@@ -343,7 +343,7 @@ static int do_show(int argc, char **argv)
 			break;
 		}
 
-		fd = bpf_link_get_fd_by_id(id);
+		fd = bpf_link_get_fd_by_id_opts(id, NULL);
 		if (fd < 0) {
 			if (errno == ENOENT)
 				continue;
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index bb94eb0dd9bf..103bd44cd851 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -702,7 +702,7 @@ static int do_show(int argc, char **argv)
 			break;
 		}
 
-		fd = bpf_map_get_fd_by_id(id);
+		fd = bpf_map_get_fd_by_id_opts(id, NULL);
 		if (fd < 0) {
 			if (errno == ENOENT)
 				continue;
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index e37af694152e..648546342988 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -251,7 +251,7 @@ static void *find_metadata(int prog_fd, struct bpf_map_info *map_info)
 		goto free_map_ids;
 
 	for (i = 0; i < prog_info.nr_map_ids; i++) {
-		map_fd = bpf_map_get_fd_by_id(map_ids[i]);
+		map_fd = bpf_map_get_fd_by_id_opts(map_ids[i], NULL);
 		if (map_fd < 0)
 			goto free_map_ids;
 
@@ -666,7 +666,7 @@ static int do_show(int argc, char **argv)
 			break;
 		}
 
-		fd = bpf_prog_get_fd_by_id(id);
+		fd = bpf_prog_get_fd_by_id_opts(id, NULL);
 		if (fd < 0) {
 			if (errno == ENOENT)
 				continue;
-- 
2.25.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux