Re: [PATCH bpf-next 0/2] libbpf: Implement BTF Generator API
From: Mauricio Vásquez Bernal <hidden>
Date: 2021-11-04 14:58:22
Also in:
bpf
quoted
/* reduced version of struct bpf_core_spec */ struct bpf_core_spec_pub { const struct btf *btf; __u32 root_type_id; enum bpf_core_relo_kind kind; /* raw, low-level spec: 1-to-1 with accessor spec string */ --> we can also use access_str_off and let the user parse it int raw_spec[BPF_CORE_SPEC_MAX_LEN];string might be a more "extensible" way, but we'll need to construct that string for each relocationquoted
/* raw spec length */ int raw_len;using string would eliminate the need for thisquoted
}; struct bpf_core_relo_pub { const char *prog_name; --> if we expose it by program then it's not needed.yep, not sure about per-program yet, but that's minorquoted
int insn_idx; bool poison; --> allows the user to understand if the relocation succeeded or not. /* new field offset for field based core relos */ __u32 new_offset; // TODO: fields for type and enum-based relosisn't it always just u64 new_value for all types of relos? We can also expose old_value just for completeness
Oh right. We can expose new_val, orig_val and let the user interpret their meaning based on the relo_kind.
quoted
struct bpf_core_spec_pub local_spec, targ_spec; --> BTFGen only needs targ_spec, I suppose local spec would be useful for other use cases.targ_spec doesn't seem necessary given we have root_type_id, relo kind, access_string (or raw_spec). What am I missing?
Not sure I follow. root_type, relo kind and access_string are all part of bpf_core_spec_pub, there are two instances of this structure, targ_spec and local_spec.