lkml.org 
[lkml]   [2019]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/5] samples/bpf: fix xdpsock_user build error
Date
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@redhat.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
\
 
 \ /
  Last update: 2019-05-18 02:47    [W:0.087 / U:0.076 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site