16
16
DEFINE_BPF_STORAGE_CACHE (sk_cache );
17
17
18
18
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 )
20
20
{
21
21
struct bpf_local_storage * sk_storage ;
22
22
struct bpf_local_storage_map * smap ;
@@ -29,11 +29,11 @@ sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit)
29
29
return bpf_local_storage_lookup (sk_storage , smap , cacheit_lockit );
30
30
}
31
31
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 )
33
33
{
34
34
struct bpf_local_storage_data * sdata ;
35
35
36
- sdata = sk_storage_lookup (sk , map , false);
36
+ sdata = bpf_sk_storage_lookup (sk , map , false);
37
37
if (!sdata )
38
38
return - ENOENT ;
39
39
@@ -82,7 +82,7 @@ void bpf_sk_storage_free(struct sock *sk)
82
82
kfree_rcu (sk_storage , rcu );
83
83
}
84
84
85
- static void sk_storage_map_free (struct bpf_map * map )
85
+ static void bpf_sk_storage_map_free (struct bpf_map * map )
86
86
{
87
87
struct bpf_local_storage_map * smap ;
88
88
@@ -91,7 +91,7 @@ static void sk_storage_map_free(struct bpf_map *map)
91
91
bpf_local_storage_map_free (smap );
92
92
}
93
93
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 )
95
95
{
96
96
struct bpf_local_storage_map * smap ;
97
97
@@ -118,7 +118,7 @@ static void *bpf_fd_sk_storage_lookup_elem(struct bpf_map *map, void *key)
118
118
fd = * (int * )key ;
119
119
sock = sockfd_lookup (fd , & err );
120
120
if (sock ) {
121
- sdata = sk_storage_lookup (sock -> sk , map , true);
121
+ sdata = bpf_sk_storage_lookup (sock -> sk , map , true);
122
122
sockfd_put (sock );
123
123
return sdata ? sdata -> data : NULL ;
124
124
}
@@ -154,7 +154,7 @@ static int bpf_fd_sk_storage_delete_elem(struct bpf_map *map, void *key)
154
154
fd = * (int * )key ;
155
155
sock = sockfd_lookup (fd , & err );
156
156
if (sock ) {
157
- err = sk_storage_delete (sock -> sk , map );
157
+ err = bpf_sk_storage_del (sock -> sk , map );
158
158
sockfd_put (sock );
159
159
return err ;
160
160
}
@@ -260,7 +260,7 @@ BPF_CALL_4(bpf_sk_storage_get, struct bpf_map *, map, struct sock *, sk,
260
260
if (!sk || !sk_fullsock (sk ) || flags > BPF_SK_STORAGE_GET_F_CREATE )
261
261
return (unsigned long )NULL ;
262
262
263
- sdata = sk_storage_lookup (sk , map , true);
263
+ sdata = bpf_sk_storage_lookup (sk , map , true);
264
264
if (sdata )
265
265
return (unsigned long )sdata -> data ;
266
266
@@ -293,16 +293,16 @@ BPF_CALL_2(bpf_sk_storage_delete, struct bpf_map *, map, struct sock *, sk)
293
293
if (refcount_inc_not_zero (& sk -> sk_refcnt )) {
294
294
int err ;
295
295
296
- err = sk_storage_delete (sk , map );
296
+ err = bpf_sk_storage_del (sk , map );
297
297
sock_put (sk );
298
298
return err ;
299
299
}
300
300
301
301
return - ENOENT ;
302
302
}
303
303
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 )
306
306
{
307
307
struct sock * sk = (struct sock * )owner ;
308
308
@@ -316,16 +316,16 @@ static int sk_storage_charge(struct bpf_local_storage_map *smap,
316
316
return - ENOMEM ;
317
317
}
318
318
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 )
321
321
{
322
322
struct sock * sk = owner ;
323
323
324
324
atomic_sub (size , & sk -> sk_omem_alloc );
325
325
}
326
326
327
327
static struct bpf_local_storage __rcu * *
328
- sk_storage_ptr (void * owner )
328
+ bpf_sk_storage_ptr (void * owner )
329
329
{
330
330
struct sock * sk = owner ;
331
331
@@ -336,18 +336,18 @@ static int sk_storage_map_btf_id;
336
336
const struct bpf_map_ops sk_storage_map_ops = {
337
337
.map_meta_equal = bpf_map_meta_equal ,
338
338
.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 ,
341
341
.map_get_next_key = notsupp_get_next_key ,
342
342
.map_lookup_elem = bpf_fd_sk_storage_lookup_elem ,
343
343
.map_update_elem = bpf_fd_sk_storage_update_elem ,
344
344
.map_delete_elem = bpf_fd_sk_storage_delete_elem ,
345
345
.map_check_btf = bpf_local_storage_map_check_btf ,
346
346
.map_btf_name = "bpf_local_storage_map" ,
347
347
.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 ,
351
351
};
352
352
353
353
const struct bpf_func_proto bpf_sk_storage_get_proto = {
0 commit comments