Re: [PATCH bpf-next 01/10] bpf: introduce __MAX_BPF_PROG_TYPE and __MAX_BPF_MAP_TYPE enum values

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

 



On Wed, Aug 28, 2019 at 02:03:04PM -0700, Julia Kartseva wrote:
> Similar to __MAX_BPF_ATTACH_TYPE identifying the number of elements in
> bpf_attach_type enum, add tailing enum values __MAX_BPF_PROG_TYPE
> and __MAX_BPF_MAP_TYPE to simplify e.g. iteration over enums values in
> the case when new values are added.
> 
> Signed-off-by: Julia Kartseva <hex@xxxxxx>
> ---
>  include/uapi/linux/bpf.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 5d2fb183ee2d..9b681bb82211 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -136,8 +136,11 @@ enum bpf_map_type {
>  	BPF_MAP_TYPE_STACK,
>  	BPF_MAP_TYPE_SK_STORAGE,
>  	BPF_MAP_TYPE_DEVMAP_HASH,
> +	__MAX_BPF_MAP_TYPE
>  };
>  
> +#define MAX_BPF_MAP_TYPE __MAX_BPF_MAP_TYPE
> +
>  /* Note that tracing related programs such as
>   * BPF_PROG_TYPE_{KPROBE,TRACEPOINT,PERF_EVENT,RAW_TRACEPOINT}
>   * are not subject to a stable API since kernel internal data
> @@ -173,8 +176,11 @@ enum bpf_prog_type {
>  	BPF_PROG_TYPE_CGROUP_SYSCTL,
>  	BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
>  	BPF_PROG_TYPE_CGROUP_SOCKOPT,
> +	__MAX_BPF_PROG_TYPE
>  };
>  
> +#define MAX_BPF_PROG_TYPE __MAX_BPF_PROG_TYPE
> +

This came up before and my position is still the same.
I'm against this type of band-aid in uapi.
'bpftool feature probe' can easily discover all supported
prog and map types already.




[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