BPF Archive on lore.kernel.org
 help / color / Atom feed
From: Matteo Croce <mcroce@redhat.com>
To: xdp-newbies@vger.kernel.org, bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Subject: [PATCH 3/5] samples/bpf: fix xdpsock_user build error
Date: Sat, 18 May 2019 02:46:37 +0200
Message-ID: <20190518004639.20648-3-mcroce@redhat.com> (raw)
In-Reply-To: <20190518004639.20648-1-mcroce@redhat.com>

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


  parent reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-18  0:46 [PATCH 1/5] samples/bpf: fix test_lru_dist build Matteo Croce
2019-05-18  0:46 ` [PATCH 2/5] libbpf: add missing typedef Matteo Croce
2019-05-20 16:53   ` Stanislav Fomichev
2019-05-20 17:43     ` Matteo Croce
2019-05-20 18:25       ` Stanislav Fomichev
2019-05-18  0:46 ` Matteo Croce [this message]
2019-05-18  0:46 ` [PATCH 4/5] samples/bpf: fix tracex5_user build error Matteo Croce
2019-05-21 15:22   ` Daniel Borkmann
2019-05-18  0:46 ` [PATCH 5/5] samples/bpf: fix hbm " Matteo Croce
2019-05-20 17:46 ` [PATCH 1/5] samples/bpf: fix test_lru_dist build Matteo Croce
2019-05-20 20:38   ` Jakub Kicinski
2019-05-21 15:20     ` Daniel Borkmann
2019-05-21 15:36       ` Matteo Croce
2019-05-21 17:06         ` Jakub Kicinski
2019-05-21 23:32           ` Matteo Croce

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190518004639.20648-3-mcroce@redhat.com \
    --to=mcroce@redhat.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org bpf@archiver.kernel.org
	public-inbox-index bpf


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/ public-inbox