Lines Matching refs:dist

5185 static int btf_add_distilled_type_ids(struct btf_distill *dist, __u32 i)  in btf_add_distilled_type_ids()  argument
5187 struct btf_type *split_t = btf_type_by_id(dist->pipe.src, i); in btf_add_distilled_type_ids()
5201 if (*id >= dist->split_start_id) in btf_add_distilled_type_ids()
5204 if (dist->id_map[*id] > 0) in btf_add_distilled_type_ids()
5210 base_t = btf_type_by_id(dist->pipe.src, *id); in btf_add_distilled_type_ids()
5227 dist->id_map[*id] = *id; in btf_add_distilled_type_ids()
5243 err = btf_add_distilled_type_ids(dist, *id); in btf_add_distilled_type_ids()
5250 static int btf_add_distilled_types(struct btf_distill *dist) in btf_add_distilled_types() argument
5252 bool adding_to_base = dist->pipe.dst->start_id == 1; in btf_add_distilled_types()
5253 int id = btf__type_cnt(dist->pipe.dst); in btf_add_distilled_types()
5261 for (i = 1; i < dist->split_start_id; i++) { in btf_add_distilled_types()
5265 if (!dist->id_map[i]) in btf_add_distilled_types()
5267 t = btf_type_by_id(dist->pipe.src, i); in btf_add_distilled_types()
5269 name = btf__name_by_offset(dist->pipe.src, t->name_off); in btf_add_distilled_types()
5278 err = btf_add_type(&dist->pipe, t); in btf_add_distilled_types()
5289 err = btf_add_composite(dist->pipe.dst, kind, name, t->size); in btf_add_distilled_types()
5293 err = btf_add_type(&dist->pipe, t); in btf_add_distilled_types()
5307 err = btf__add_enum(dist->pipe.dst, name, t->size); in btf_add_distilled_types()
5311 err = btf_add_type(&dist->pipe, t); in btf_add_distilled_types()
5325 err = btf_add_type(&dist->pipe, t); in btf_add_distilled_types()
5335 dist->id_map[i] = id++; in btf_add_distilled_types()
5345 static int btf_update_distilled_type_ids(struct btf_distill *dist, __u32 i) in btf_update_distilled_type_ids() argument
5347 struct btf_type *t = btf_type_by_id(dist->pipe.dst, i); in btf_update_distilled_type_ids()
5356 if (dist->id_map[*id]) in btf_update_distilled_type_ids()
5357 *id = dist->id_map[*id]; in btf_update_distilled_type_ids()
5358 else if (*id >= dist->split_start_id) in btf_update_distilled_type_ids()
5359 *id -= dist->diff_id; in btf_update_distilled_type_ids()
5386 struct btf_distill dist = {}; in btf__distill_base() local
5401 dist.id_map = calloc(n, sizeof(*dist.id_map)); in btf__distill_base()
5402 if (!dist.id_map) { in btf__distill_base()
5406 dist.pipe.src = src_btf; in btf__distill_base()
5407 dist.pipe.dst = new_base; in btf__distill_base()
5408 dist.pipe.str_off_map = hashmap__new(btf_dedup_identity_hash_fn, btf_dedup_equal_fn, NULL); in btf__distill_base()
5409 if (IS_ERR(dist.pipe.str_off_map)) { in btf__distill_base()
5413 dist.split_start_id = btf__type_cnt(old_base); in btf__distill_base()
5414 dist.split_start_str = old_base->hdr->str_len; in btf__distill_base()
5421 err = btf_add_distilled_type_ids(&dist, i); in btf__distill_base()
5428 err = btf_add_distilled_types(&dist); in btf__distill_base()
5442 dist.pipe.dst = new_split; in btf__distill_base()
5446 err = btf_add_type(&dist.pipe, t); in btf__distill_base()
5451 err = btf_add_distilled_types(&dist); in btf__distill_base()
5458 dist.diff_id = dist.split_start_id - btf__type_cnt(new_base); in btf__distill_base()
5463 err = btf_update_distilled_type_ids(&dist, i); in btf__distill_base()
5468 free(dist.id_map); in btf__distill_base()
5469 hashmap__free(dist.pipe.str_off_map); in btf__distill_base()