Home
last modified time | relevance | path

Searched hist:"811 b4f0d" (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/samples/bpf/
H A Dfds_example.c811b4f0d Tue Dec 20 08:03:13 CST 2016 Arnaldo Carvalho de Melo <acme@redhat.com> samples/bpf: Be consistent with bpf_load_program bpf_insn parameter

Only one of the examples declare the bpf_insn bpf proggie as a const:

$ grep 'struct bpf_insn [a-z]' samples/bpf/*.c
samples/bpf/fds_example.c: static const struct bpf_insn insns[] = {
samples/bpf/sock_example.c: struct bpf_insn prog[] = {
samples/bpf/test_cgrp2_attach2.c: struct bpf_insn prog[] = {
samples/bpf/test_cgrp2_attach.c: struct bpf_insn prog[] = {
samples/bpf/test_cgrp2_sock.c: struct bpf_insn prog[] = {
$

Which causes this warning:

[root@f5065a7d6272 linux]# make -j4 O=/tmp/build/linux samples/bpf/
<SNIP>
HOSTCC samples/bpf/fds_example.o
/git/linux/samples/bpf/fds_example.c: In function 'bpf_prog_create':
/git/linux/samples/bpf/fds_example.c:63:6: warning: passing argument 2 of 'bpf_load_program' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
insns, insns_cnt, "GPL", 0,
^~~~~
In file included from /git/linux/samples/bpf/libbpf.h:5:0,
from /git/linux/samples/bpf/bpf_load.h:4,
from /git/linux/samples/bpf/fds_example.c:15:
/git/linux/tools/lib/bpf/bpf.h:31:5: note: expected 'struct bpf_insn *' but argument is of type 'const struct bpf_insn *'
int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
^~~~~~~~~~~~~~~~
HOSTCC samples/bpf/sockex1_user.o

So just ditch that 'const' to reduce build noise, leaving changing the
bpf_load_program() bpf_insn parameter to const to a later patch, if deemed
adequate.

Cc: Joe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-1z5xee8n3oa66jf62bpv16ed@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
811b4f0d Tue Dec 20 08:03:13 CST 2016 Arnaldo Carvalho de Melo <acme@redhat.com> samples/bpf: Be consistent with bpf_load_program bpf_insn parameter

Only one of the examples declare the bpf_insn bpf proggie as a const:

$ grep 'struct bpf_insn [a-z]' samples/bpf/*.c
samples/bpf/fds_example.c: static const struct bpf_insn insns[] = {
samples/bpf/sock_example.c: struct bpf_insn prog[] = {
samples/bpf/test_cgrp2_attach2.c: struct bpf_insn prog[] = {
samples/bpf/test_cgrp2_attach.c: struct bpf_insn prog[] = {
samples/bpf/test_cgrp2_sock.c: struct bpf_insn prog[] = {
$

Which causes this warning:

[root@f5065a7d6272 linux]# make -j4 O=/tmp/build/linux samples/bpf/
<SNIP>
HOSTCC samples/bpf/fds_example.o
/git/linux/samples/bpf/fds_example.c: In function 'bpf_prog_create':
/git/linux/samples/bpf/fds_example.c:63:6: warning: passing argument 2 of 'bpf_load_program' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
insns, insns_cnt, "GPL", 0,
^~~~~
In file included from /git/linux/samples/bpf/libbpf.h:5:0,
from /git/linux/samples/bpf/bpf_load.h:4,
from /git/linux/samples/bpf/fds_example.c:15:
/git/linux/tools/lib/bpf/bpf.h:31:5: note: expected 'struct bpf_insn *' but argument is of type 'const struct bpf_insn *'
int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
^~~~~~~~~~~~~~~~
HOSTCC samples/bpf/sockex1_user.o

So just ditch that 'const' to reduce build noise, leaving changing the
bpf_load_program() bpf_insn parameter to const to a later patch, if deemed
adequate.

Cc: Joe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-1z5xee8n3oa66jf62bpv16ed@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>