BPF List
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<martin.lau@kernel.org>
Cc: <andrii@kernel.org>, <kernel-team@meta.com>
Subject: [PATCH bpf-next 2/8] libbpf: use explicit map reuse flag to skip map creation steps
Date: Wed, 20 Dec 2023 15:31:21 -0800	[thread overview]
Message-ID: <20231220233127.1990417-3-andrii@kernel.org> (raw)
In-Reply-To: <20231220233127.1990417-1-andrii@kernel.org>

Instead of inferring whether map already point to previously
created/pinned BPF map (which user can specify through
bpf_map__reuse_fd() or bpf_object__reuse_map() APIs), use explicit
map->reused flag that is set in such case.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e4fe79d5693f..2ead8fc1e344 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5463,7 +5463,7 @@ bpf_object__create_maps(struct bpf_object *obj)
 			}
 		}
 
-		if (map->fd >= 0) {
+		if (map->reused) {
 			pr_debug("map '%s': skipping creation (preset fd=%d)\n",
 				 map->name, map->fd);
 		} else {
-- 
2.34.1


  parent reply	other threads:[~2023-12-20 23:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 23:31 [PATCH bpf-next 0/8] Libbpf-side __arg_ctx fallback support Andrii Nakryiko
2023-12-20 23:31 ` [PATCH bpf-next 1/8] libbpf: make uniform use of btf__fd() accessor inside libbpf Andrii Nakryiko
2023-12-20 23:31 ` Andrii Nakryiko [this message]
2023-12-20 23:31 ` [PATCH bpf-next 3/8] libbpf: don't rely on map->fd as an indicator of map being created Andrii Nakryiko
2023-12-20 23:31 ` [PATCH bpf-next 4/8] libbpf: use stable map placeholder FDs Andrii Nakryiko
2023-12-20 23:31 ` [PATCH bpf-next 5/8] libbpf: move exception callbacks assignment logic into relocation step Andrii Nakryiko
2023-12-20 23:31 ` [PATCH bpf-next 6/8] libbpf: move BTF loading step after " Andrii Nakryiko
2023-12-22  1:13   ` Alexei Starovoitov
2024-01-02 16:49     ` Andrii Nakryiko
2023-12-20 23:31 ` [PATCH bpf-next 7/8] libbpf: implement __arg_ctx fallback logic Andrii Nakryiko
2023-12-22  1:26   ` Alexei Starovoitov
2024-01-02 17:06     ` Andrii Nakryiko
2024-01-03  0:30       ` Andrii Nakryiko
2023-12-22 13:15   ` Jiri Olsa
2024-01-02 17:11     ` Andrii Nakryiko
2023-12-20 23:31 ` [PATCH bpf-next 8/8] selftests/bpf: add arg:ctx cases to test_global_funcs tests 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=20231220233127.1990417-3-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@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