[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d96d205-1483-95a4-dc36-798fef934f72@fb.com>
Date: Fri, 23 Apr 2021 11:53:42 -0700
From: Yonghong Song <yhs@...com>
To: Andrii Nakryiko <andrii@...nel.org>, <bpf@...r.kernel.org>,
<netdev@...r.kernel.org>, <ast@...com>, <daniel@...earbox.net>
CC: <kernel-team@...com>
Subject: Re: [PATCH v3 bpf-next 17/18] selftests/bpf: add map linking selftest
On 4/23/21 11:13 AM, Andrii Nakryiko wrote:
> Add selftest validating various aspects of statically linking BTF-defined map
> definitions. Legacy map definitions do not support extern resolution between
> object files. Some of the aspects validated:
> - correct resolution of extern maps against concrete map definitions;
> - extern maps can currently only specify map type and key/value size and/or
> type information;
> - weak concrete map definitions are resolved properly.
>
> Static map definitions are not yet supported by libbpf, so they are not
> explicitly tested, though manual testing showes that BPF linker handles them
> properly.
>
> Acked-by: Yonghong Song <yhs@...com>
> Signed-off-by: Andrii Nakryiko <andrii@...nel.org>
[...]
> +
> +SEC("raw_tp/sys_exit")
> +int BPF_PROG(handler_exit1)
> +{
> + /* lookup values with key = 2, set in another file */
> + int key = 2, *val;
> + struct my_key key_struct = { .x = 2 };
> + struct my_value *value_struct;
> +
> + value_struct = bpf_map_lookup_elem(&map1, &key_struct);
> + if (value_struct)
> + output_first1 = value_struct->x;
> +
> + val = bpf_map_lookup_elem(&map2, &key);
> + if (val)
> + output_second1 = *val;
> +
> + val = bpf_map_lookup_elem(&map_weak, &key);
> + if (val)
> + output_weak1 = *val;
> +
There is an extra tab in the above line. There is no need for new
revision just for this. If no new revision is needed, maybe
the maintainer can help fix it.
> + return 0;
> +}
Powered by blists - more mailing lists