[PATCH bpf 09/11] bpf: Remove unused helpers for map-in-map

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

 



From: Hou Tao <houtao1@xxxxxxxxxx>

bpf_map_fd_put_ptr() and bpf_map_fd_sys_lookup_elem() are no longer used
for map-in-map, so just remove these two helpers. bpf_map_fd_get_ptr()
is only used internally, so make it be static.

Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx>
---
 kernel/bpf/map_in_map.c | 19 ++-----------------
 kernel/bpf/map_in_map.h |  3 ---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/kernel/bpf/map_in_map.c b/kernel/bpf/map_in_map.c
index 3cd08e7fb86e6..372e89edc2d57 100644
--- a/kernel/bpf/map_in_map.c
+++ b/kernel/bpf/map_in_map.c
@@ -106,9 +106,7 @@ bool bpf_map_meta_equal(const struct bpf_map *meta0,
 		btf_record_equal(meta0->record, meta1->record);
 }
 
-void *bpf_map_fd_get_ptr(struct bpf_map *map,
-			 struct file *map_file /* not used */,
-			 int ufd)
+static void *bpf_map_fd_get_ptr(struct bpf_map *map, int ufd)
 {
 	struct bpf_map *inner_map, *inner_map_meta;
 	struct fd f;
@@ -128,19 +126,6 @@ void *bpf_map_fd_get_ptr(struct bpf_map *map,
 	return inner_map;
 }
 
-void bpf_map_fd_put_ptr(void *ptr, bool deferred)
-{
-	/* ptr->ops->map_free() has to go through one
-	 * rcu grace period by itself.
-	 */
-	bpf_map_put(ptr);
-}
-
-u32 bpf_map_fd_sys_lookup_elem(void *ptr)
-{
-	return ((struct bpf_map *)ptr)->id;
-}
-
 void *bpf_map_of_map_fd_get_ptr(struct bpf_map *map, struct file *map_file,
 			       int ufd)
 {
@@ -151,7 +136,7 @@ void *bpf_map_of_map_fd_get_ptr(struct bpf_map *map, struct file *map_file,
 	if (!element)
 		return ERR_PTR(-ENOMEM);
 
-	inner_map = bpf_map_fd_get_ptr(map, map_file, ufd);
+	inner_map = bpf_map_fd_get_ptr(map, ufd);
 	if (IS_ERR(inner_map)) {
 		kfree(element);
 		return inner_map;
diff --git a/kernel/bpf/map_in_map.h b/kernel/bpf/map_in_map.h
index f8719bcd7c254..903eb33896723 100644
--- a/kernel/bpf/map_in_map.h
+++ b/kernel/bpf/map_in_map.h
@@ -19,9 +19,6 @@ struct bpf_inner_map_element {
 
 struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd);
 void bpf_map_meta_free(struct bpf_map *map_meta);
-void *bpf_map_fd_get_ptr(struct bpf_map *map, struct file *map_file, int ufd);
-void bpf_map_fd_put_ptr(void *ptr, bool need_defer);
-u32 bpf_map_fd_sys_lookup_elem(void *ptr);
 
 void *bpf_map_of_map_fd_get_ptr(struct bpf_map *map, struct file *map_file, int ufd);
 void bpf_map_of_map_fd_put_ptr(void *ptr, bool need_defer);
-- 
2.29.2





[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