From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, KP Singh <kpsingh@kernel.org>,
Spencer Baugh <sbaugh@catern.com>,
Andy Lutomirski <luto@kernel.org>,
Pavel Emelyanov <ovzxemul@gmail.com>,
Alexander Mihalicyn <alexander@mihalicyn.com>,
Andrei Vagin <avagin@gmail.com>,
linux-security-module@vger.kernel.org
Subject: [PATCH bpf-next RFC v1 2/5] tools: sync bpf.h header
Date: Sun, 22 Aug 2021 00:18:21 +0530 [thread overview]
Message-ID: <20210821184824.2052643-3-memxor@gmail.com> (raw)
In-Reply-To: <20210821184824.2052643-1-memxor@gmail.com>
Update the bpf.h UAPI header with changes made from file local storage
additions.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
tools/include/uapi/linux/bpf.h | 39 ++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index c4f7892edb2b..d4bf4e4d56b5 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -906,6 +906,7 @@ enum bpf_map_type {
BPF_MAP_TYPE_RINGBUF,
BPF_MAP_TYPE_INODE_STORAGE,
BPF_MAP_TYPE_TASK_STORAGE,
+ BPF_MAP_TYPE_FILE_STORAGE,
};
/* Note that tracing related programs such as
@@ -4871,6 +4872,42 @@ union bpf_attr {
* Return
* Value specified by user at BPF link creation/attachment time
* or 0, if it was not specified.
+ *
+ * void *bpf_file_storage_get(struct bpf_map *map, void *file, void *value, u64 flags)
+ * Description
+ * Get a bpf_local_storage from a *file*.
+ *
+ * Logically, it could be thought of as getting the value from
+ * a *map* with *file* as the **key**. From this
+ * perspective, the usage is not much different from
+ * **bpf_map_lookup_elem**\ (*map*, **&**\ *file*) except this
+ * helper enforces the key must be an file and the map must also
+ * be a **BPF_MAP_TYPE_FILE_STORAGE**.
+ *
+ * Underneath, the value is stored locally at *file* instead of
+ * the *map*. The *map* is used as the bpf-local-storage
+ * "type". The bpf-local-storage "type" (i.e. the *map*) is
+ * searched against all bpf_local_storage residing at *file*.
+ *
+ * An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be
+ * used such that a new bpf_local_storage will be
+ * created if one does not exist. *value* can be used
+ * together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify
+ * the initial value of a bpf_local_storage. If *value* is
+ * **NULL**, the new bpf_local_storage will be zero initialized.
+ * Return
+ * A bpf_local_storage pointer is returned on success.
+ *
+ * **NULL** if not found or there was an error in adding
+ * a new bpf_local_storage.
+ *
+ * int bpf_file_storage_delete(struct bpf_map *map, void *file)
+ * Description
+ * Delete a bpf_local_storage from a *file*.
+ * Return
+ * 0 on success.
+ *
+ * **-ENOENT** if the bpf_local_storage cannot be found.
*/
#define __BPF_FUNC_MAPPER(FN) \
FN(unspec), \
@@ -5048,6 +5085,8 @@ union bpf_attr {
FN(timer_cancel), \
FN(get_func_ip), \
FN(get_attach_cookie), \
+ FN(file_storage_get), \
+ FN(file_storage_delete), \
/* */
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
--
2.33.0
next prev parent reply other threads:[~2021-08-21 18:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-21 18:48 [PATCH bpf-next RFC v1 0/5] Implement file local storage Kumar Kartikeya Dwivedi
2021-08-21 18:48 ` [PATCH bpf-next RFC v1 1/5] bpf: " Kumar Kartikeya Dwivedi
2021-08-21 18:48 ` Kumar Kartikeya Dwivedi [this message]
2021-08-21 18:48 ` [PATCH bpf-next RFC v1 3/5] libbpf: Add bpf_probe_map_type support for " Kumar Kartikeya Dwivedi
2021-08-21 18:48 ` [PATCH bpf-next RFC v1 4/5] tools: bpf: update bpftool for file_storage map Kumar Kartikeya Dwivedi
2021-08-21 18:48 ` [PATCH bpf-next RFC v1 5/5] tools: testing: Add selftest for file local storage map Kumar Kartikeya Dwivedi
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=20210821184824.2052643-3-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=alexander@mihalicyn.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=avagin@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@kernel.org \
--cc=ovzxemul@gmail.com \
--cc=sbaugh@catern.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).