aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2017-08-16 01:32:22 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-16 14:27:53 -0400
commita6f6df69c48b86cd84f36c70593eb4968fceb34a (patch)
treee3398ed0f8b5fd29235dd09824df666c933d25e5
parentb005fd189cec9407b700599e1e80e0552446ee79 (diff)
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 <john.fastabend@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/bpf.h7
-rw-r--r--kernel/bpf/syscall.c3
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 39229c455cba..d6e1de8ce0fc 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -252,6 +252,7 @@ struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type);
252struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i); 252struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i);
253void bpf_prog_sub(struct bpf_prog *prog, int i); 253void bpf_prog_sub(struct bpf_prog *prog, int i);
254struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog); 254struct bpf_prog * __must_check bpf_prog_inc(struct bpf_prog *prog);
255struct bpf_prog * __must_check bpf_prog_inc_not_zero(struct bpf_prog *prog);
255void bpf_prog_put(struct bpf_prog *prog); 256void bpf_prog_put(struct bpf_prog *prog);
256int __bpf_prog_charge(struct user_struct *user, u32 pages); 257int __bpf_prog_charge(struct user_struct *user, u32 pages);
257void __bpf_prog_uncharge(struct user_struct *user, u32 pages); 258void __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)
344 return ERR_PTR(-EOPNOTSUPP); 345 return ERR_PTR(-EOPNOTSUPP);
345} 346}
346 347
348static inline struct bpf_prog *__must_check
349bpf_prog_inc_not_zero(struct bpf_prog *prog)
350{
351 return ERR_PTR(-EOPNOTSUPP);
352}
353
347static inline int __bpf_prog_charge(struct user_struct *user, u32 pages) 354static inline int __bpf_prog_charge(struct user_struct *user, u32 pages)
348{ 355{
349 return 0; 356 return 0;
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index fbe09a0cccf4..17e29f596de1 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -911,7 +911,7 @@ struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog)
911EXPORT_SYMBOL_GPL(bpf_prog_inc); 911EXPORT_SYMBOL_GPL(bpf_prog_inc);
912 912
913/* prog_idr_lock should have been held */ 913/* prog_idr_lock should have been held */
914static struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog) 914struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
915{ 915{
916 int refold; 916 int refold;
917 917
@@ -927,6 +927,7 @@ static struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
927 927
928 return prog; 928 return prog;
929} 929}
930EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
930 931
931static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *type) 932static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *type)
932{ 933{