Lines Matching refs:scn
134 convert_data (Elf_Scn *scn, int version __attribute__ ((unused)), int eclass, in convert_data() argument
141 if (((((size_t) (char *) scn->rawdata_base)) & (align - 1)) == 0) in convert_data()
143 scn->data_base = scn->rawdata_base; in convert_data()
146 scn->data_base = (char *) malloc (size); in convert_data()
147 if (scn->data_base == NULL) in convert_data()
154 memcpy (scn->data_base, scn->rawdata_base, size); in convert_data()
161 scn->data_base = (char *) malloc (size); in convert_data()
162 if (scn->data_base == NULL) in convert_data()
175 fp (scn->data_base, scn->rawdata_base, size, 0); in convert_data()
178 scn->data_list.data.d.d_buf = scn->data_base; in convert_data()
179 scn->data_list.data.d.d_size = size; in convert_data()
180 scn->data_list.data.d.d_type = type; in convert_data()
181 scn->data_list.data.d.d_off = scn->rawdata.d.d_off; in convert_data()
182 scn->data_list.data.d.d_align = scn->rawdata.d.d_align; in convert_data()
183 scn->data_list.data.d.d_version = scn->rawdata.d.d_version; in convert_data()
185 scn->data_list.data.s = scn; in convert_data()
192 __libelf_set_rawdata_wrlock (Elf_Scn *scn) in __libelf_set_rawdata_wrlock() argument
198 Elf *elf = scn->elf; in __libelf_set_rawdata_wrlock()
203 = scn->shdr.e32 ?: __elf32_getshdr_wrlock (scn); in __libelf_set_rawdata_wrlock()
217 = scn->shdr.e64 ?: __elf64_getshdr_wrlock (scn); in __libelf_set_rawdata_wrlock()
275 scn->rawdata_base = scn->rawdata.d.d_buf in __libelf_set_rawdata_wrlock()
282 scn->rawdata_base = scn->rawdata.d.d_buf in __libelf_set_rawdata_wrlock()
284 if (scn->rawdata.d.d_buf == NULL) in __libelf_set_rawdata_wrlock()
290 ssize_t n = pread_retry (elf->fildes, scn->rawdata.d.d_buf, size, in __libelf_set_rawdata_wrlock()
295 free (scn->rawdata.d.d_buf); in __libelf_set_rawdata_wrlock()
296 scn->rawdata_base = scn->rawdata.d.d_buf = NULL; in __libelf_set_rawdata_wrlock()
310 scn->rawdata.d.d_size = size; in __libelf_set_rawdata_wrlock()
317 scn->rawdata.d.d_type in __libelf_set_rawdata_wrlock()
321 scn->rawdata.d.d_type = shtype_map[LIBELF_EV_IDX][TYPEIDX (type)]; in __libelf_set_rawdata_wrlock()
322 scn->rawdata.d.d_off = 0; in __libelf_set_rawdata_wrlock()
323 scn->rawdata.d.d_align = align; in __libelf_set_rawdata_wrlock()
327 scn->rawdata.d.d_version = in __libelf_set_rawdata_wrlock()
330 scn->rawdata.d.d_version = in __libelf_set_rawdata_wrlock()
333 scn->rawdata.s = scn; in __libelf_set_rawdata_wrlock()
335 scn->data_read = 1; in __libelf_set_rawdata_wrlock()
338 scn->flags |= ELF_F_FILEDATA; in __libelf_set_rawdata_wrlock()
345 __libelf_set_rawdata (Elf_Scn *scn) in __libelf_set_rawdata() argument
349 if (scn == NULL) in __libelf_set_rawdata()
352 rwlock_wrlock (scn->elf->lock); in __libelf_set_rawdata()
353 result = __libelf_set_rawdata_wrlock (scn); in __libelf_set_rawdata()
354 rwlock_unlock (scn->elf->lock); in __libelf_set_rawdata()
361 __elf_getdata_rdlock (scn, data) in __elf_getdata_rdlock() argument
362 Elf_Scn *scn; in __elf_getdata_rdlock()
369 if (scn == NULL)
372 if (unlikely (scn->elf->kind != ELF_K_ELF))
379 elf = scn->elf;
393 if (scn->data_list_rear == NULL
396 || unlikely (((Elf_Data_Scn *) data)->s != scn))
403 runp = &scn->data_list;
427 if (scn->data_read == 0)
440 if (scn->data_read == 0 && __libelf_set_rawdata_wrlock (scn) != 0)
448 if (scn->data_list_rear == NULL)
450 if (scn->rawdata.d.d_buf != NULL && scn->rawdata.d.d_size > 0)
456 if (scn->data_list_rear != NULL)
461 convert_data (scn, __libelf_version, elf->class,
467 scn->rawdata.d.d_size, scn->rawdata.d.d_type);
472 scn->data_list.data.d = scn->rawdata.d;
474 scn->data_list_rear = &scn->data_list;
478 if (scn->data_list_rear != NULL)
481 result = &scn->data_list.data.d;
488 elf_getdata (scn, data) in elf_getdata() argument
489 Elf_Scn *scn; in elf_getdata()
494 if (scn == NULL)
497 rwlock_rdlock (scn->elf->lock);
498 result = __elf_getdata_rdlock (scn, data);
499 rwlock_unlock (scn->elf->lock);