netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xu Kuohai <xukuohai@huaweicloud.com>
To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, John Fastabend <john.fastabend@gmail.com>,
	Jakub Sitnicki <jakub@cloudflare.com>
Subject: [PATCH bpf-next] bpf, sockmap: Rename sock_map_get_from_fd to sock_map_prog_attach
Date: Thu, 31 Aug 2023 09:43:46 +0800	[thread overview]
Message-ID: <20230831014346.2931397-1-xukuohai@huaweicloud.com> (raw)

From: Xu Kuohai <xukuohai@huawei.com>

What function sock_map_get_from_fd does is to attach a bpf prog to
a sock map, so rename it to sock_map_prog_attach to make it more
readable.

Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
---
 include/linux/bpf.h  | 2 +-
 kernel/bpf/syscall.c | 2 +-
 net/core/sock_map.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 12596af59c00..7a0c801f2795 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2799,7 +2799,7 @@ int bpf_prog_test_run_syscall(struct bpf_prog *prog,
 			      const union bpf_attr *kattr,
 			      union bpf_attr __user *uattr);
 
-int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog);
+int sock_map_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog);
 int sock_map_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype);
 int sock_map_update_elem_sys(struct bpf_map *map, void *key, void *value, u64 flags);
 int sock_map_bpf_prog_query(const union bpf_attr *attr,
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index ebeb0695305a..087a097d74d4 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3822,7 +3822,7 @@ static int bpf_prog_attach(const union bpf_attr *attr)
 	switch (ptype) {
 	case BPF_PROG_TYPE_SK_SKB:
 	case BPF_PROG_TYPE_SK_MSG:
-		ret = sock_map_get_from_fd(attr, prog);
+		ret = sock_map_prog_attach(attr, prog);
 		break;
 	case BPF_PROG_TYPE_LIRC_MODE2:
 		ret = lirc_prog_attach(attr, prog);
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 8f07fea39d9e..26706b667f44 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -57,7 +57,7 @@ static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
 	return &stab->map;
 }
 
-int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog)
+int sock_map_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog)
 {
 	u32 ufd = attr->target_fd;
 	struct bpf_map *map;
-- 
2.30.2


             reply	other threads:[~2023-08-31  1:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  1:43 Xu Kuohai [this message]
2023-08-31  2:09 ` [PATCH bpf-next] bpf, sockmap: Rename sock_map_get_from_fd to sock_map_prog_attach John Fastabend
2023-08-31  2:21   ` Xu Kuohai
2023-08-31 11:10 ` kernel test robot

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=20230831014346.2931397-1-xukuohai@huaweicloud.com \
    --to=xukuohai@huaweicloud.com \
    --cc=bpf@vger.kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.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;
as well as URLs for NNTP newsgroup(s).