bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading
@ 2021-01-08  2:08 彭浩(Richard)
  2021-01-08 17:18 ` Yonghong Song
  2021-01-08 20:25 ` Andrii Nakryiko
  0 siblings, 2 replies; 3+ messages in thread
From: 彭浩(Richard) @ 2021-01-08  2:08 UTC (permalink / raw)
  To: ast, andrii; +Cc: bpf, linux-kernel

struct bpf_object *obj is not used in bpf_object__probe_loading, so we
can remove it.

Signed-off-by: Peng Hao <richard.peng@oppo.com>
---
 tools/lib/bpf/libbpf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 313034117070..17d90779f09a 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3685,7 +3685,7 @@ int bpf_map__resize(struct bpf_map *map, __u32 max_entries)
 }

 static int
-bpf_object__probe_loading(struct bpf_object *obj)
+bpf_object__probe_loading(void)
 {
        struct bpf_load_program_attr attr;
        char *cp, errmsg[STRERR_BUFSIZE];
@@ -7258,7 +7258,7 @@ int bpf_object__load_xattr(struct bpf_object_load_attr *attr)
                return -EINVAL;
        }

-       err = bpf_object__probe_loading(obj);
+       err = bpf_object__probe_loading();
        err = err ? : bpf_object__load_vmlinux_btf(obj);
        err = err ? : bpf_object__resolve_externs(obj, obj->kconfig);
        err = err ? : bpf_object__sanitize_and_load_btf(obj);
--
2.18.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading
  2021-01-08  2:08 [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading 彭浩(Richard)
@ 2021-01-08 17:18 ` Yonghong Song
  2021-01-08 20:25 ` Andrii Nakryiko
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2021-01-08 17:18 UTC (permalink / raw)
  To: 彭浩(Richard), ast, andrii; +Cc: bpf, linux-kernel



On 1/7/21 6:08 PM, 彭浩(Richard) wrote:
> struct bpf_object *obj is not used in bpf_object__probe_loading, so we
> can remove it.
> 
> Signed-off-by: Peng Hao <richard.peng@oppo.com>

Acked-by: Yonghong Song <yhs@fb.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading
  2021-01-08  2:08 [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading 彭浩(Richard)
  2021-01-08 17:18 ` Yonghong Song
@ 2021-01-08 20:25 ` Andrii Nakryiko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2021-01-08 20:25 UTC (permalink / raw)
  To: 彭浩(Richard); +Cc: ast, andrii, bpf, linux-kernel

On Thu, Jan 7, 2021 at 6:08 PM 彭浩(Richard) <richard.peng@oppo.com> wrote:
>
> struct bpf_object *obj is not used in bpf_object__probe_loading, so we
> can remove it.
>
> Signed-off-by: Peng Hao <richard.peng@oppo.com>
> ---

It causes no harm, no performance cost, and no maintenance issues. I
consider eventually allowing to have a per-bpf_object log callback (as
opposed to current global one), so at that time I'd need to re-add
struct bpf_object back to this. Which means just unnecessary code
churn.

So thanks for the patch, there is nothing wrong with it, but I'll
leave this code as is for now. Thanks!


>  tools/lib/bpf/libbpf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 313034117070..17d90779f09a 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -3685,7 +3685,7 @@ int bpf_map__resize(struct bpf_map *map, __u32 max_entries)
>  }
>
>  static int
> -bpf_object__probe_loading(struct bpf_object *obj)
> +bpf_object__probe_loading(void)
>  {
>         struct bpf_load_program_attr attr;
>         char *cp, errmsg[STRERR_BUFSIZE];
> @@ -7258,7 +7258,7 @@ int bpf_object__load_xattr(struct bpf_object_load_attr *attr)
>                 return -EINVAL;
>         }
>
> -       err = bpf_object__probe_loading(obj);
> +       err = bpf_object__probe_loading();
>         err = err ? : bpf_object__load_vmlinux_btf(obj);
>         err = err ? : bpf_object__resolve_externs(obj, obj->kconfig);
>         err = err ? : bpf_object__sanitize_and_load_btf(obj);
> --
> 2.18.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-08 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08  2:08 [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading 彭浩(Richard)
2021-01-08 17:18 ` Yonghong Song
2021-01-08 20:25 ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).