Re: [PATCH bpf-next 3/3] libbpf: deprecate bpf_object__open_xattr() API

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

 



On Thu, Dec 30, 2021 at 12:40 PM Christy Lee <christylee@xxxxxx> wrote:
>
> Deprecate bpf_object__open_xattr() in favor of
> bpf_object__open_mem() instead.
>
> Signed-off-by: Christy Lee <christylee@xxxxxx>
> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  tools/lib/bpf/libbpf.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 9cb99d1e2385..25b571a297f8 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -9443,7 +9443,7 @@ static int bpf_prog_load_xattr2(const struct bpf_prog_load_attr *attr,
>         open_attr.file = attr->file;
>         open_attr.prog_type = attr->prog_type;
>
> -       obj = bpf_object__open_xattr(&open_attr);
> +       obj = libbpf_ptr(__bpf_object__open_xattr(&open_attr, 0));

there is no need to use libbpf_ptr() here, it's used for proper
handling of error returning from public API functions. Here you don't
yet return an error (it will happen with libbpf_err() few lines
below).

>         err = libbpf_get_error(obj);
>         if (err)
>                 return libbpf_err(-ENOENT);
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index 063639a109aa..aa507a330b61 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -185,6 +185,7 @@ LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_object__open_mem() instead")
>  LIBBPF_API struct bpf_object *
>  bpf_object__open_buffer(const void *obj_buf, size_t obj_buf_sz,
>                         const char *name);
> +LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_object__open_mem() instead")
>  LIBBPF_API struct bpf_object *
>  bpf_object__open_xattr(struct bpf_object_open_attr *attr);
>
> --
> 2.30.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