> > ``` > > /* 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 relocation > > > /* raw spec length */ > > int raw_len; > > using string would eliminate the need for this > > > }; > > > > 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 minor > > > 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 relos > > isn'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. > > > > 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.