Lines Matching refs:strs
1396 void *hdr, *types, *strs, *strs_end, *s; in btf_ensure_modifiable() local
1410 strs = malloc(btf->hdr->str_len); in btf_ensure_modifiable()
1411 if (!hdr || !types || !strs) in btf_ensure_modifiable()
1416 memcpy(strs, btf->strs_data, btf->hdr->str_len); in btf_ensure_modifiable()
1426 strs_end = strs + btf->hdr->str_len; in btf_ensure_modifiable()
1427 for (off = 0, s = strs; s < strs_end; off += strlen(s) + 1, s = strs + off) { in btf_ensure_modifiable()
1442 btf->strs_data = strs; in btf_ensure_modifiable()
1459 free(strs); in btf_ensure_modifiable()
3129 struct btf_str_ptrs *strs; in btf_str_mark_as_used() local
3135 strs = ctx; in btf_str_mark_as_used()
3136 s = bsearch(strs->data + *str_off_ptr, strs->ptrs, strs->cnt, in btf_str_mark_as_used()
3146 struct btf_str_ptrs *strs; in btf_str_remap_offset() local
3152 strs = ctx; in btf_str_remap_offset()
3153 s = bsearch(strs->data + *str_off_ptr, strs->ptrs, strs->cnt, in btf_str_remap_offset()
3177 struct btf_str_ptrs strs = { in btf_dedup_strings() local
3191 if (strs.cnt + 1 > strs.cap) { in btf_dedup_strings()
3194 strs.cap += max(strs.cnt / 2, 16U); in btf_dedup_strings()
3195 new_ptrs = libbpf_reallocarray(strs.ptrs, strs.cap, sizeof(strs.ptrs[0])); in btf_dedup_strings()
3200 strs.ptrs = new_ptrs; in btf_dedup_strings()
3203 strs.ptrs[strs.cnt].str = p; in btf_dedup_strings()
3204 strs.ptrs[strs.cnt].used = false; in btf_dedup_strings()
3207 strs.cnt++; in btf_dedup_strings()
3218 strs.ptrs[0].used = true; in btf_dedup_strings()
3219 err = btf_for_each_str_off(d, btf_str_mark_as_used, &strs); in btf_dedup_strings()
3224 qsort(strs.ptrs, strs.cnt, sizeof(strs.ptrs[0]), str_sort_by_content); in btf_dedup_strings()
3232 grp_used = strs.ptrs[0].used; in btf_dedup_strings()
3234 for (i = 1; i <= strs.cnt; i++) { in btf_dedup_strings()
3240 if (i < strs.cnt && in btf_dedup_strings()
3241 !strcmp(strs.ptrs[i].str, strs.ptrs[grp_idx].str)) { in btf_dedup_strings()
3242 grp_used = grp_used || strs.ptrs[i].used; in btf_dedup_strings()
3253 __u32 len = strlen(strs.ptrs[grp_idx].str); in btf_dedup_strings()
3255 memmove(p, strs.ptrs[grp_idx].str, len + 1); in btf_dedup_strings()
3257 strs.ptrs[j].new_off = new_off; in btf_dedup_strings()
3261 if (i < strs.cnt) { in btf_dedup_strings()
3263 grp_used = strs.ptrs[i].used; in btf_dedup_strings()
3273 qsort(strs.ptrs, strs.cnt, sizeof(strs.ptrs[0]), str_sort_by_offset); in btf_dedup_strings()
3276 err = btf_for_each_str_off(d, btf_str_remap_offset, &strs); in btf_dedup_strings()
3285 free(strs.ptrs); in btf_dedup_strings()