Skip to content

Commit e794bfd

Browse files
iamkafaiAlexei Starovoitov
authored andcommitted
bpf: Rename some functions in bpf_sk_storage
Rename some of the functions currently prefixed with sk_storage to bpf_sk_storage. That will make the next patch have fewer prefix check and also bring the bpf_sk_storage.c to a more consistent function naming. Signed-off-by: Martin KaFai Lau <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: KP Singh <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 9e838b0 commit e794bfd

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

net/core/bpf_sk_storage.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
DEFINE_BPF_STORAGE_CACHE(sk_cache);
1717

1818
static struct bpf_local_storage_data *
19-
sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit)
19+
bpf_sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit)
2020
{
2121
struct bpf_local_storage *sk_storage;
2222
struct bpf_local_storage_map *smap;
@@ -29,11 +29,11 @@ sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit)
2929
return bpf_local_storage_lookup(sk_storage, smap, cacheit_lockit);
3030
}
3131

32-
static int sk_storage_delete(struct sock *sk, struct bpf_map *map)
32+
static int bpf_sk_storage_del(struct sock *sk, struct bpf_map *map)
3333
{
3434
struct bpf_local_storage_data *sdata;
3535

36-
sdata = sk_storage_lookup(sk, map, false);
36+
sdata = bpf_sk_storage_lookup(sk, map, false);
3737
if (!sdata)
3838
return -ENOENT;
3939

@@ -82,7 +82,7 @@ void bpf_sk_storage_free(struct sock *sk)
8282
kfree_rcu(sk_storage, rcu);
8383
}
8484

85-
static void sk_storage_map_free(struct bpf_map *map)
85+
static void bpf_sk_storage_map_free(struct bpf_map *map)
8686
{
8787
struct bpf_local_storage_map *smap;
8888

@@ -91,7 +91,7 @@ static void sk_storage_map_free(struct bpf_map *map)
9191
bpf_local_storage_map_free(smap);
9292
}
9393

94-
static struct bpf_map *sk_storage_map_alloc(union bpf_attr *attr)
94+
static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr)
9595
{
9696
struct bpf_local_storage_map *smap;
9797

@@ -118,7 +118,7 @@ static void *bpf_fd_sk_storage_lookup_elem(struct bpf_map *map, void *key)
118118
fd = *(int *)key;
119119
sock = sockfd_lookup(fd, &err);
120120
if (sock) {
121-
sdata = sk_storage_lookup(sock->sk, map, true);
121+
sdata = bpf_sk_storage_lookup(sock->sk, map, true);
122122
sockfd_put(sock);
123123
return sdata ? sdata->data : NULL;
124124
}
@@ -154,7 +154,7 @@ static int bpf_fd_sk_storage_delete_elem(struct bpf_map *map, void *key)
154154
fd = *(int *)key;
155155
sock = sockfd_lookup(fd, &err);
156156
if (sock) {
157-
err = sk_storage_delete(sock->sk, map);
157+
err = bpf_sk_storage_del(sock->sk, map);
158158
sockfd_put(sock);
159159
return err;
160160
}
@@ -260,7 +260,7 @@ BPF_CALL_4(bpf_sk_storage_get, struct bpf_map *, map, struct sock *, sk,
260260
if (!sk || !sk_fullsock(sk) || flags > BPF_SK_STORAGE_GET_F_CREATE)
261261
return (unsigned long)NULL;
262262

263-
sdata = sk_storage_lookup(sk, map, true);
263+
sdata = bpf_sk_storage_lookup(sk, map, true);
264264
if (sdata)
265265
return (unsigned long)sdata->data;
266266

@@ -293,16 +293,16 @@ BPF_CALL_2(bpf_sk_storage_delete, struct bpf_map *, map, struct sock *, sk)
293293
if (refcount_inc_not_zero(&sk->sk_refcnt)) {
294294
int err;
295295

296-
err = sk_storage_delete(sk, map);
296+
err = bpf_sk_storage_del(sk, map);
297297
sock_put(sk);
298298
return err;
299299
}
300300

301301
return -ENOENT;
302302
}
303303

304-
static int sk_storage_charge(struct bpf_local_storage_map *smap,
305-
void *owner, u32 size)
304+
static int bpf_sk_storage_charge(struct bpf_local_storage_map *smap,
305+
void *owner, u32 size)
306306
{
307307
struct sock *sk = (struct sock *)owner;
308308

@@ -316,16 +316,16 @@ static int sk_storage_charge(struct bpf_local_storage_map *smap,
316316
return -ENOMEM;
317317
}
318318

319-
static void sk_storage_uncharge(struct bpf_local_storage_map *smap,
320-
void *owner, u32 size)
319+
static void bpf_sk_storage_uncharge(struct bpf_local_storage_map *smap,
320+
void *owner, u32 size)
321321
{
322322
struct sock *sk = owner;
323323

324324
atomic_sub(size, &sk->sk_omem_alloc);
325325
}
326326

327327
static struct bpf_local_storage __rcu **
328-
sk_storage_ptr(void *owner)
328+
bpf_sk_storage_ptr(void *owner)
329329
{
330330
struct sock *sk = owner;
331331

@@ -336,18 +336,18 @@ static int sk_storage_map_btf_id;
336336
const struct bpf_map_ops sk_storage_map_ops = {
337337
.map_meta_equal = bpf_map_meta_equal,
338338
.map_alloc_check = bpf_local_storage_map_alloc_check,
339-
.map_alloc = sk_storage_map_alloc,
340-
.map_free = sk_storage_map_free,
339+
.map_alloc = bpf_sk_storage_map_alloc,
340+
.map_free = bpf_sk_storage_map_free,
341341
.map_get_next_key = notsupp_get_next_key,
342342
.map_lookup_elem = bpf_fd_sk_storage_lookup_elem,
343343
.map_update_elem = bpf_fd_sk_storage_update_elem,
344344
.map_delete_elem = bpf_fd_sk_storage_delete_elem,
345345
.map_check_btf = bpf_local_storage_map_check_btf,
346346
.map_btf_name = "bpf_local_storage_map",
347347
.map_btf_id = &sk_storage_map_btf_id,
348-
.map_local_storage_charge = sk_storage_charge,
349-
.map_local_storage_uncharge = sk_storage_uncharge,
350-
.map_owner_storage_ptr = sk_storage_ptr,
348+
.map_local_storage_charge = bpf_sk_storage_charge,
349+
.map_local_storage_uncharge = bpf_sk_storage_uncharge,
350+
.map_owner_storage_ptr = bpf_sk_storage_ptr,
351351
};
352352

353353
const struct bpf_func_proto bpf_sk_storage_get_proto = {

0 commit comments

Comments
 (0)