bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andriin@fb.com>
To: <andrii.nakryiko@gmail.com>, <kernel-team@fb.com>, <ast@fb.com>,
	<daniel@iogearbox.net>, <netdev@vger.kernel.org>,
	<bpf@vger.kernel.org>
Cc: Andrii Nakryiko <andriin@fb.com>
Subject: [PATCH v5 bpf-next 2/4] selftests/bpf: add __uint and __type macro for BTF-defined maps
Date: Fri, 5 Jul 2019 08:50:10 -0700	[thread overview]
Message-ID: <20190705155012.3539722-3-andriin@fb.com> (raw)
In-Reply-To: <20190705155012.3539722-1-andriin@fb.com>

Add simple __uint and __type macro that hide details of how type and
integer values are captured in BTF-defined maps.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
---
 tools/testing/selftests/bpf/bpf_helpers.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
index 1a5b1accf091..5a3d92c8bec8 100644
--- a/tools/testing/selftests/bpf/bpf_helpers.h
+++ b/tools/testing/selftests/bpf/bpf_helpers.h
@@ -8,6 +8,9 @@
  */
 #define SEC(NAME) __attribute__((section(NAME), used))
 
+#define __uint(name, val) int (*name)[val]
+#define __type(name, val) val *name
+
 /* helper macro to print out debug messages */
 #define bpf_printk(fmt, ...)				\
 ({							\
-- 
2.17.1


  parent reply	other threads:[~2019-07-05 15:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05 15:50 [PATCH v5 bpf-next 0/4] capture integers in BTF type info for map defs Andrii Nakryiko
2019-07-05 15:50 ` [PATCH v5 bpf-next 1/4] libbpf: capture value in BTF type info for BTF-defined " Andrii Nakryiko
2019-07-05 15:50 ` Andrii Nakryiko [this message]
2019-07-05 15:50 ` [PATCH v5 bpf-next 3/4] selftests/bpf: convert selftests using BTF-defined maps to new syntax Andrii Nakryiko
2019-07-05 15:50 ` [PATCH v5 bpf-next 4/4] selftests/bpf: convert legacy BPF maps to BTF-defined ones Andrii Nakryiko
2019-07-05 21:15 ` [PATCH v5 bpf-next 0/4] capture integers in BTF type info for map defs Daniel Borkmann
2019-07-06  3:49   ` Andrii Nakryiko
2019-07-09 20:27   ` Edward Cree
2019-07-09 21:39     ` Andrii Nakryiko

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=20190705155012.3539722-3-andriin@fb.com \
    --to=andriin@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).