[PATCH openEuler-22.09 v3 003/391] libbpf: Factor out common operations in BTF writing APIs