Skip to content

Commit 6c2a685

Browse files
committed
bpf: Prepare to reuse get_ctx_arg_idx
JIRA: https://issues.redhat.com/browse/RHEL-78203 commit a1b669e Author: Amery Hung <ameryhung@gmail.com> Date: Wed Apr 9 14:45:57 2025 -0700 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 <ameryhung@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://patch.msgid.link/20250409214606.2000194-2-ameryhung@gmail.com Signed-off-by: Viktor Malik <vmalik@redhat.com>
1 parent c54504b commit 6c2a685

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)