Skip to content

Commit a1b669e

Browse files
ameryhungMartin KaFai Lau
authored andcommitted
bpf: Prepare to reuse get_ctx_arg_idx
Rename get_ctx_arg_idx to bpf_ctx_arg_idx, and allow others to call it. No functional change. Signed-off-by: Amery Hung <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent ab734b4 commit a1b669e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/linux/btf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ bool btf_param_match_suffix(const struct btf *btf,
522522
const char *suffix);
523523
int btf_ctx_arg_offset(const struct btf *btf, const struct btf_type *func_proto,
524524
u32 arg_no);
525+
u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto, int off);
525526

526527
struct bpf_verifier_log;
527528

kernel/bpf/btf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6391,8 +6391,8 @@ static bool is_int_ptr(struct btf *btf, const struct btf_type *t)
63916391
return btf_type_is_int(t);
63926392
}
63936393

6394-
static u32 get_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto,
6395-
int off)
6394+
u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto,
6395+
int off)
63966396
{
63976397
const struct btf_param *args;
63986398
const struct btf_type *t;
@@ -6671,7 +6671,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
66716671
tname, off);
66726672
return false;
66736673
}
6674-
arg = get_ctx_arg_idx(btf, t, off);
6674+
arg = btf_ctx_arg_idx(btf, t, off);
66756675
args = (const struct btf_param *)(t + 1);
66766676
/* if (t == NULL) Fall back to default BPF prog with
66776677
* MAX_BPF_FUNC_REG_ARGS u64 arguments.

0 commit comments

Comments
 (0)