aboutsummaryrefslogtreecommitdiff
path: root/bfd/libbfd.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-04-21 17:05:12 +0000
committerAndrew Cagney <cagney@redhat.com>2004-04-21 17:05:12 +0000
commit40838a725a2186ffdc9621694e72f340928a0b13 (patch)
tree188ce229fccc9465d5149968ddf2af50a1a6ebdc /bfd/libbfd.h
parent7f919c8471b407c6a8c698ee3b29cdf0e9c4eb3d (diff)
downloadgdb-40838a725a2186ffdc9621694e72f340928a0b13.zip
gdb-40838a725a2186ffdc9621694e72f340928a0b13.tar.gz
gdb-40838a725a2186ffdc9621694e72f340928a0b13.tar.bz2
2004-04-21 Andrew Cagney <cagney@redhat.com>
* opncls.c (_bfd_new_bfd_contained_in): Copy "iovec". (struct opncls, opncls_btell, opncls_bseek, opncls_bread) (opncls_bwrite, opncls_bclose, opncls_bflush) (opncls_bstat, opncls_iovec, bfd_openr_iovec): Implement a bfd iovec that uses function callbacks. (bfd_close): Use the iovec's bclose. * cache.c (cache_btell, cache_bseek, cache_bread, cache_bwrite) (cache_bclose, cache_bflush, cache_bstat) (cache_iovec): New functions and global variable, implement a cache "iovec", where applicable set bfd_error. (bfd_cache_init, bfd_cache_close): Set/test the bfd's iovec. * bfdio.c (struct bfd_iovec): Define. (real_read): Delete function. (bfd_bread, bfd_bread, bfd_bwrite, bfd_tell, bfd_flush, bfd_stat) (bfd_seek, bfd_get_mtime, bfd_get_size): Use the bfd's "iovec", assume that bread and bwrite set bfd_error. * bfd.c (struct bfd): Add "iovec", update comments. * bfd-in2.h, libbfd.h: Re-generate.
Diffstat (limited to 'bfd/libbfd.h')
-rw-r--r--bfd/libbfd.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 6afe58d..b4bc9f8 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -657,6 +657,27 @@ bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
unsigned int bfd_log2 (bfd_vma x);
/* Extracted from bfdio.c. */
+struct bfd_iovec
+{
+ /* To avoid problems with macros, a "b" rather than "f"
+ prefix is prepended to each method name. */
+ /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching
+ bytes starting at PTR. Return the number of bytes actually
+ transfered (a read past end-of-file returns less than NBYTES),
+ or -1 (setting <<bfd_error>>) if an error occurs. */
+ file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
+ file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
+ file_ptr nbytes);
+ /* Return the current IOSTREAM file offset, or -1 (setting <<bfd_error>>
+ if an error occurs. */
+ file_ptr (*btell) (struct bfd *abfd);
+ /* For the following, on successful completion a value of 0 is returned.
+ Otherwise, a value of -1 is returned (and <<bfd_error>> is set). */
+ int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
+ int (*bclose) (struct bfd *abfd);
+ int (*bflush) (struct bfd *abfd);
+ int (*bstat) (struct bfd *abfd, struct stat *sb);
+};
/* Extracted from bfdwin.c. */
struct _bfd_window_internal {
struct _bfd_window_internal *next;