Lines Matching refs:abfd

81 insert (bfd *abfd)  in insert()  argument
85 abfd->lru_next = abfd; in insert()
86 abfd->lru_prev = abfd; in insert()
90 abfd->lru_next = bfd_last_cache; in insert()
91 abfd->lru_prev = bfd_last_cache->lru_prev; in insert()
92 abfd->lru_prev->lru_next = abfd; in insert()
93 abfd->lru_next->lru_prev = abfd; in insert()
95 bfd_last_cache = abfd; in insert()
101 snip (bfd *abfd) in snip() argument
103 abfd->lru_prev->lru_next = abfd->lru_next; in snip()
104 abfd->lru_next->lru_prev = abfd->lru_prev; in snip()
105 if (abfd == bfd_last_cache) in snip()
107 bfd_last_cache = abfd->lru_next; in snip()
108 if (abfd == bfd_last_cache) in snip()
116 bfd_cache_delete (bfd *abfd) in bfd_cache_delete() argument
120 if (fclose ((FILE *) abfd->iostream) == 0) in bfd_cache_delete()
128 snip (abfd); in bfd_cache_delete()
130 abfd->iostream = NULL; in bfd_cache_delete()
205 bfd_cache_lookup_worker (bfd *abfd, enum cache_flag flag) in bfd_cache_lookup_worker() argument
207 bfd *orig_bfd = abfd; in bfd_cache_lookup_worker()
208 if ((abfd->flags & BFD_IN_MEMORY) != 0) in bfd_cache_lookup_worker()
211 if (abfd->my_archive) in bfd_cache_lookup_worker()
212 abfd = abfd->my_archive; in bfd_cache_lookup_worker()
214 if (abfd->iostream != NULL) in bfd_cache_lookup_worker()
217 if (abfd != bfd_last_cache) in bfd_cache_lookup_worker()
219 snip (abfd); in bfd_cache_lookup_worker()
220 insert (abfd); in bfd_cache_lookup_worker()
222 return (FILE *) abfd->iostream; in bfd_cache_lookup_worker()
228 if (bfd_open_file (abfd) == NULL) in bfd_cache_lookup_worker()
231 && real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0 in bfd_cache_lookup_worker()
235 return (FILE *) abfd->iostream; in bfd_cache_lookup_worker()
243 cache_btell (struct bfd *abfd) in cache_btell() argument
245 FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN); in cache_btell()
247 return abfd->where; in cache_btell()
252 cache_bseek (struct bfd *abfd, file_ptr offset, int whence) in cache_bseek() argument
254 FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0); in cache_bseek()
268 cache_bread (struct bfd *abfd, void *buf, file_ptr nbytes) in cache_bread() argument
284 f = bfd_cache_lookup (abfd, 0); in cache_bread()
315 cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes) in cache_bwrite() argument
318 FILE *f = bfd_cache_lookup (abfd, 0); in cache_bwrite()
331 cache_bclose (struct bfd *abfd) in cache_bclose() argument
333 return bfd_cache_close (abfd); in cache_bclose()
337 cache_bflush (struct bfd *abfd) in cache_bflush() argument
340 FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN); in cache_bflush()
350 cache_bstat (struct bfd *abfd, struct stat *sb) in cache_bstat() argument
353 FILE *f = bfd_cache_lookup (abfd, CACHE_NO_SEEK_ERROR); in cache_bstat()
379 bfd_cache_init (bfd *abfd) in bfd_cache_init() argument
381 BFD_ASSERT (abfd->iostream != NULL); in bfd_cache_init()
387 abfd->iovec = &cache_iovec; in bfd_cache_init()
388 insert (abfd); in bfd_cache_init()
410 bfd_cache_close (bfd *abfd) in bfd_cache_close() argument
412 if (abfd->iovec != &cache_iovec) in bfd_cache_close()
415 if (abfd->iostream == NULL) in bfd_cache_close()
419 return bfd_cache_delete (abfd); in bfd_cache_close()
465 bfd_open_file (bfd *abfd) in bfd_open_file() argument
467 abfd->cacheable = TRUE; /* Allow it to be closed later. */ in bfd_open_file()
475 switch (abfd->direction) in bfd_open_file()
479 abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB); in bfd_open_file()
483 if (abfd->opened_once) in bfd_open_file()
485 abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB); in bfd_open_file()
486 if (abfd->iostream == NULL) in bfd_open_file()
487 abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB); in bfd_open_file()
514 if (stat (abfd->filename, &s) == 0 && s.st_size != 0) in bfd_open_file()
515 unlink_if_ordinary (abfd->filename); in bfd_open_file()
517 abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB); in bfd_open_file()
518 abfd->opened_once = TRUE; in bfd_open_file()
523 if (abfd->iostream == NULL) in bfd_open_file()
527 if (! bfd_cache_init (abfd)) in bfd_open_file()
531 return (FILE *) abfd->iostream; in bfd_open_file()