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

Add simple __int 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>
---
 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..aa5ddf58c088 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 __int(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-06-28 15:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 15:25 [PATCH v2 bpf-next 0/4] capture integers in BTF type info for map defs Andrii Nakryiko
2019-06-28 15:25 ` [PATCH v2 bpf-next 1/4] libbpf: capture value in BTF type info for BTF-defined " Andrii Nakryiko
2019-06-28 18:17   ` Song Liu
2019-07-02 19:18   ` Y Song
2019-07-02 19:29     ` Andrii Nakryiko
2019-06-28 15:25 ` Andrii Nakryiko [this message]
2019-06-28 18:17   ` [PATCH v2 bpf-next 2/4] selftests/bpf: add __int and __type macro for BTF-defined maps Song Liu
2019-06-28 15:25 ` [PATCH v2 bpf-next 3/4] selftests/bpf: convert selftests using BTF-defined maps to new syntax Andrii Nakryiko
2019-06-28 18:25   ` Song Liu
2019-06-28 15:25 ` [PATCH v2 bpf-next 4/4] selftests/bpf: convert legacy BPF maps to BTF-defined ones Andrii Nakryiko
2019-06-28 18:26   ` Song Liu
2019-07-05  7:42   ` [selftests/bpf] 6135bdd95f: kernel_selftests.bpf.test_offload.py.fail kernel test robot
2019-07-05 15:38     ` 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=20190628152539.3014719-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=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    /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).