LKML Archive on lore.kernel.org
help / color / mirror / 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 5/5] samples/bpf: fix hbm build error
Date: Sat, 18 May 2019 02:46:39 +0200	[thread overview]
Message-ID: <20190518004639.20648-5-mcroce@redhat.com> (raw)
In-Reply-To: <20190518004639.20648-1-mcroce@redhat.com>

Fix the following build error by declaring bpf_spin_lock in hbm.c.
Including the UAPI header generates tons of redefined symbol errors,
and including it in hbm.h breaks hbm_out_kern.c.

make -C samples/bpf/../../tools/lib/bpf/ RM='rm -rf' LDFLAGS= srctree=samples/bpf/../../ O=
  HOSTCC  samples/bpf/hbm.o
In file included from samples/bpf/hbm.c:49:
samples/bpf/hbm.h:12:23: error: field ‘lock’ has incomplete type
   12 |  struct bpf_spin_lock lock;
      |                       ^~~~
make[2]: *** [scripts/Makefile.host:109: samples/bpf/hbm.o] Error 1
make[1]: *** [Makefile:1763: samples/bpf/] Error 2

Signed-off-by: Matteo Croce <mcroce@redhat.com>
---
 samples/bpf/hbm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c
index a79828ab273f..ca8e567b63c3 100644
--- a/samples/bpf/hbm.c
+++ b/samples/bpf/hbm.c
@@ -40,17 +40,22 @@
 #include <fcntl.h>
 #include <linux/unistd.h>
 
-#include <linux/bpf.h>
 #include <bpf/bpf.h>
+#include <linux/bpf.h>
 
 #include "bpf_load.h"
 #include "bpf_rlimit.h"
 #include "cgroup_helpers.h"
-#include "hbm.h"
 #include "bpf_util.h"
 #include "bpf/bpf.h"
 #include "bpf/libbpf.h"
 
+struct bpf_spin_lock {
+	__u32	val;
+};
+
+#include "hbm.h"
+
 bool outFlag = true;
 int minRate = 1000;		/* cgroup rate limit in Mbps */
 int rate = 1000;		/* can grow if rate conserving is enabled */
-- 
2.21.0


  parent reply	other threads:[~2019-05-18  0:47 UTC|newest]

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 ` [PATCH 3/5] samples/bpf: fix xdpsock_user build error Matteo Croce
2019-05-18  0:46 ` [PATCH 4/5] samples/bpf: fix tracex5_user " Matteo Croce
2019-05-21 15:22   ` Daniel Borkmann
2019-05-18  0:46 ` Matteo Croce [this message]
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 publicly 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-5-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 \
    --subject='Re: [PATCH 5/5] samples/bpf: fix hbm build error' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).