mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: "Mickaël Salaün" <mic@digikod.net>, linux-kernel@vger.kernel.org
Cc: Alexei Starovoitov <ast@fb.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"David S . Miller" <davem@davemloft.net>,
	<netdev@vger.kernel.org>, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH net-next v5 10/11] bpf: Remove bpf_sys.h from selftests
Date: Fri, 10 Feb 2017 10:30:13 +0800	[thread overview]
Message-ID: <828ab1ff-4dcf-53ff-c97b-074adb895006@huawei.com> (raw)
In-Reply-To: <20170209232145.19085-11-mic@digikod.net>



On 2017/2/10 7:21, Mickaël Salaün wrote:
> Add require dependency headers.
>
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Shuah Khan <shuah@kernel.org>
> ---
>   tools/lib/bpf/bpf.c                         |  6 ++++++
>   tools/testing/selftests/bpf/bpf_sys.h       | 27 ---------------------------
>   tools/testing/selftests/bpf/test_lpm_map.c  |  1 -
>   tools/testing/selftests/bpf/test_lru_map.c  |  1 -
>   tools/testing/selftests/bpf/test_maps.c     |  1 -
>   tools/testing/selftests/bpf/test_tag.c      |  3 +--
>   tools/testing/selftests/bpf/test_verifier.c |  4 ++--
>   7 files changed, 9 insertions(+), 34 deletions(-)
>   delete mode 100644 tools/testing/selftests/bpf/bpf_sys.h
>
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index f8a2b7fa7741..50e04cc5dddd 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -50,7 +50,13 @@ static __u64 ptr_to_u64(const void *ptr)
>   static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
>   		   unsigned int size)
>   {
> +#ifdef __NR_bpf
>   	return syscall(__NR_bpf, cmd, attr, size);
> +#else
> +	fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
> +	errno = ENOSYS;
> +	return -1;
> +#endif
>   }
>   

We don't need check __NR_bpf again. It has already
been checked at the header of this file:

#ifndef __NR_bpf
# if defined(__i386__)
#  define __NR_bpf 357
# elif defined(__x86_64__)
#  define __NR_bpf 321
# elif defined(__aarch64__)
#  define __NR_bpf 280
# else
#  error __NR_bpf not defined. libbpf does not support your arch.
# endif
#endif

Thank you.

  reply	other threads:[~2017-02-10  2:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 23:21 [PATCH net-next v5 00/11] Improve BPF selftests and use the library (net-next tree) Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 01/11] tools: Sync {,tools/}include/uapi/linux/bpf.h Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 02/11] bpf: Change the include directory for selftest Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 03/11] bpf: Always test unprivileged programs Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 04/11] bpf: Use bpf_load_program() from the library Mickaël Salaün
2017-02-10  2:25   ` Wangnan (F)
2017-02-10  2:39     ` Wangnan (F)
2017-02-09 23:21 ` [PATCH net-next v5 05/11] bpf: Use bpf_map_update_elem() " Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 06/11] bpf: Use bpf_map_lookup_elem() " Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 07/11] bpf: Use bpf_map_delete_elem() " Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 08/11] bpf: Use bpf_map_get_next_key() " Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 09/11] bpf: Use bpf_create_map() " Mickaël Salaün
2017-02-09 23:21 ` [PATCH net-next v5 10/11] bpf: Remove bpf_sys.h from selftests Mickaël Salaün
2017-02-10  2:30   ` Wangnan (F) [this message]
2017-02-09 23:21 ` [PATCH net-next v5 11/11] bpf: Add test_tag to .gitignore Mickaël Salaün
2017-02-10 20:56 ` [PATCH net-next v5 00/11] Improve BPF selftests and use the library (net-next tree) David Miller

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=828ab1ff-4dcf-53ff-c97b-074adb895006@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@redhat.com \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@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

all inboxes | Powered by JetHome®