All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] libbpf: forward-declare bpf_stats_type for systems with outdated UAPI headers
@ 2020-06-21  3:11 Andrii Nakryiko
  2020-06-21  3:36 ` Song Liu
  2020-06-22 21:27 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2020-06-21  3:11 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

Systems that doesn't yet have the very latest linux/bpf.h header, enum
bpf_stats_type will be undefined, causing compilation warnings. Prevents this
by forward-declaring enum.

Fixes: 0bee106716cf ("libbpf: Add support for command BPF_ENABLE_STATS")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/bpf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 1b6015b21ba8..dbef24ebcfcb 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -233,6 +233,8 @@ LIBBPF_API int bpf_load_btf(void *btf, __u32 btf_size, char *log_buf,
 LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf,
 				 __u32 *buf_len, __u32 *prog_id, __u32 *fd_type,
 				 __u64 *probe_offset, __u64 *probe_addr);
+
+enum bpf_stats_type; /* defined in up-to-date linux/bpf.h */
 LIBBPF_API int bpf_enable_stats(enum bpf_stats_type type);
 
 #ifdef __cplusplus
-- 
2.24.1


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

* Re: [PATCH bpf] libbpf: forward-declare bpf_stats_type for systems with outdated UAPI headers
  2020-06-21  3:11 [PATCH bpf] libbpf: forward-declare bpf_stats_type for systems with outdated UAPI headers Andrii Nakryiko
@ 2020-06-21  3:36 ` Song Liu
  2020-06-22 21:27 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2020-06-21  3:36 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, Networking, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Kernel Team

On Sat, Jun 20, 2020 at 8:12 PM Andrii Nakryiko <andriin@fb.com> wrote:
>
> Systems that doesn't yet have the very latest linux/bpf.h header, enum
> bpf_stats_type will be undefined, causing compilation warnings. Prevents this
> by forward-declaring enum.
>
> Fixes: 0bee106716cf ("libbpf: Add support for command BPF_ENABLE_STATS")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Acked-by: Song Liu <songliubraving@fb.com>

Thanks for the fix!

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

* Re: [PATCH bpf] libbpf: forward-declare bpf_stats_type for systems with outdated UAPI headers
  2020-06-21  3:11 [PATCH bpf] libbpf: forward-declare bpf_stats_type for systems with outdated UAPI headers Andrii Nakryiko
  2020-06-21  3:36 ` Song Liu
@ 2020-06-22 21:27 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2020-06-22 21:27 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, netdev, ast; +Cc: andrii.nakryiko, kernel-team

On 6/21/20 5:11 AM, Andrii Nakryiko wrote:
> Systems that doesn't yet have the very latest linux/bpf.h header, enum
> bpf_stats_type will be undefined, causing compilation warnings. Prevents this
> by forward-declaring enum.
> 
> Fixes: 0bee106716cf ("libbpf: Add support for command BPF_ENABLE_STATS")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Applied, thanks!

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

end of thread, other threads:[~2020-06-22 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-21  3:11 [PATCH bpf] libbpf: forward-declare bpf_stats_type for systems with outdated UAPI headers Andrii Nakryiko
2020-06-21  3:36 ` Song Liu
2020-06-22 21:27 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.