Commit a1b669ea authored by Amery Hung's avatar Amery Hung Committed by Martin KaFai Lau
Browse files

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: default avatarAmery Hung <ameryhung@gmail.com>
Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Link: https://patch.msgid.link/20250409214606.2000194-2-ameryhung@gmail.com
parent ab734b43
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -522,6 +522,7 @@ bool btf_param_match_suffix(const struct btf *btf,
			    const char *suffix);
int btf_ctx_arg_offset(const struct btf *btf, const struct btf_type *func_proto,
		       u32 arg_no);
u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto, int off);

struct bpf_verifier_log;

+3 −3
Original line number Diff line number Diff line
@@ -6391,7 +6391,7 @@ static bool is_int_ptr(struct btf *btf, const struct btf_type *t)
	return btf_type_is_int(t);
}

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