[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190518004639.20648-3-mcroce@redhat.com>
Date: Sat, 18 May 2019 02:46:37 +0200
From: Matteo Croce <mcroce@...hat.com>
To: xdp-newbies@...r.kernel.org, bpf@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Subject: [PATCH 3/5] samples/bpf: fix xdpsock_user build error
Remove duplicate typedef, and use PRIu64 to be both 32 and 64 bit aware.
Fix the following error:
samples/bpf/xdpsock_user.c:52:15: error: conflicting types for ‘u64’
52 | typedef __u64 u64;
| ^~~
In file included from ./tools/include/linux/compiler.h:87,
from ./tools/include/asm/barrier.h:2,
from samples/bpf/xdpsock_user.c:4:
./tools/include/linux/types.h:30:18: note: previous declaration of ‘u64’ was here
30 | typedef uint64_t u64;
| ^~~
make[2]: *** [scripts/Makefile.host:109: samples/bpf/xdpsock_user.o] Error 1
make[1]: *** [Makefile:1763: samples/bpf/] Error 2
Signed-off-by: Matteo Croce <mcroce@...hat.com>
---
samples/bpf/xdpsock_user.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index d08ee1ab7bb4..a4cd42c2f0b0 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -24,6 +24,7 @@
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/types.h>
+#include <inttypes.h>
#include <time.h>
#include <unistd.h>
@@ -49,9 +50,6 @@
#define DEBUG_HEXDUMP 0
#define MAX_SOCKS 8
-typedef __u64 u64;
-typedef __u32 u32;
-
static unsigned long prev_time;
enum benchmark_type {
@@ -243,7 +241,7 @@ static void hex_dump(void *pkt, size_t length, u64 addr)
if (!DEBUG_HEXDUMP)
return;
- sprintf(buf, "addr=%llu", addr);
+ sprintf(buf, "addr=%" PRIu64, addr);
printf("length = %zu\n", length);
printf("%s | ", buf);
while (length-- > 0) {
--
2.21.0
Powered by blists - more mailing lists