Skip to content

Commit a6f6df6

Browse files
jrfastabdavem330
authored andcommitted
bpf: export bpf_prog_inc_not_zero
bpf_prog_inc_not_zero will be used by upcoming sockmap patches this patch simply exports it so we can pull it in. Signed-off-by: John Fastabend <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b005fd1 commit a6f6df6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/linux/bpf.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type);
252252
struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i);
253253
void bpf_prog_sub(struct bpf_prog *prog, int i);
254254
struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog);
255+
struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog);
255256
void bpf_prog_put(struct bpf_prog *prog);
256257
int __bpf_prog_charge(struct user_struct *user, u32 pages);
257258
void __bpf_prog_uncharge(struct user_struct *user, u32 pages);
@@ -344,6 +345,12 @@ static inline struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog)
344345
return ERR_PTR(-EOPNOTSUPP);
345346
}
346347

348+
static inline struct bpf_prog *__must_check
349+
bpf_prog_inc_not_zero(struct bpf_prog *prog)
350+
{
351+
return ERR_PTR(-EOPNOTSUPP);
352+
}
353+
347354
static inline int __bpf_prog_charge(struct user_struct *user, u32 pages)
348355
{
349356
return 0;

kernel/bpf/syscall.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog)
911911
EXPORT_SYMBOL_GPL(bpf_prog_inc);
912912

913913
/* prog_idr_lock should have been held */
914-
static struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
914+
struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
915915
{
916916
int refold;
917917

@@ -927,6 +927,7 @@ static struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
927927

928928
return prog;
929929
}
930+
EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
930931

931932
static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *type)
932933
{

0 commit comments

Comments
 (0)