public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Rename bfd_bread and bfd_bwrite
@ 2023-08-08 23:25 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-08-08 23:25 UTC (permalink / raw)
  To: bfd-cvs, gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=226f9f4fadb087875ef98a0a55d614236c6241b3

commit 226f9f4fadb087875ef98a0a55d614236c6241b3
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Aug 7 14:40:35 2023 +0930

    Rename bfd_bread and bfd_bwrite
    
    These were renamed from bfd_read and bfd_write back in 2001 when they
    lost an unnecessary parameter.  Rename them back, and get rid of a few
    casts that are only needed without prototyped functions (K&R C).

Diff:
---
 bfd/aix5ppc-core.c     |  10 ++--
 bfd/aout-target.h      |   2 +-
 bfd/aoutx.h            |  24 ++++-----
 bfd/archive.c          |  72 ++++++++++++-------------
 bfd/archive64.c        |  18 +++----
 bfd/bfd-in2.h          |   4 +-
 bfd/bfdio.c            |  12 ++---
 bfd/bfdwin.c           |   2 +-
 bfd/binary.c           |   2 +-
 bfd/cisco-core.c       |   8 +--
 bfd/coff-alpha.c       |  18 +++----
 bfd/coff-ia64.c        |   7 ++-
 bfd/coff-rs6000.c      | 100 ++++++++++++++++------------------
 bfd/coff-stgo32.c      |   6 +--
 bfd/coff64-rs6000.c    |  19 ++++---
 bfd/coffcode.h         |  42 +++++++--------
 bfd/coffgen.c          |  22 ++++----
 bfd/cofflink.c         |  27 +++++-----
 bfd/doc/bfdint.texi    |   4 +-
 bfd/ecoff.c            |  45 ++++++++--------
 bfd/ecofflink.c        |  57 +++++++++-----------
 bfd/elf-nacl.c         |   2 +-
 bfd/elf-strtab.c       |   4 +-
 bfd/elf.c              |  16 +++---
 bfd/elf32-ppc.c        |   2 +-
 bfd/elf64-hppa.c       |   2 +-
 bfd/elf64-ia64-vms.c   |   4 +-
 bfd/elfcode.h          |  22 ++++----
 bfd/elfcore.h          |  20 +++----
 bfd/elflink.c          |   6 +--
 bfd/elfxx-mips.c       |   6 +--
 bfd/format.c           |   6 +--
 bfd/hash.c             |  10 ++--
 bfd/hppabsd-core.c     |   2 +-
 bfd/hpux-core.c        |  13 ++---
 bfd/i386lynx.c         |  84 ++++++++++++++---------------
 bfd/i386msdos.c        |  12 ++---
 bfd/ihex.c             |  26 ++++-----
 bfd/irix-core.c        |   6 +--
 bfd/libaout.h          |  80 ++++++++++++++--------------
 bfd/libbfd-in.h        |   4 +-
 bfd/libbfd.c           |   8 +--
 bfd/libbfd.h           |   4 +-
 bfd/lynx-core.c        |   4 +-
 bfd/mach-o.c           | 142 ++++++++++++++++++++++++-------------------------
 bfd/merge.c            |   6 +--
 bfd/mmo.c              |  86 +++++++++++++++---------------
 bfd/netbsd-core.c      |   4 +-
 bfd/opncls.c           |   2 +-
 bfd/osf-core.c         |   4 +-
 bfd/pdb.c              |  60 ++++++++++-----------
 bfd/pdp11.c            |  37 ++++++-------
 bfd/peXXigen.c         |   4 +-
 bfd/pef.c              |   6 +--
 bfd/peicode.h          |  14 +++--
 bfd/ppcboot.c          |   7 ++-
 bfd/ptrace-core.c      |   2 +-
 bfd/rs6000-core.c      |  12 ++---
 bfd/som.c              | 110 +++++++++++++++++++-------------------
 bfd/srec.c             |  40 +++++++-------
 bfd/tekhex.c           |  20 +++----
 bfd/trad-core.c        |   4 +-
 bfd/verilog.c          |   4 +-
 bfd/vms-alpha.c        |  54 +++++++++----------
 bfd/vms-lib.c          |  36 ++++++-------
 bfd/vms-misc.c         |   4 +-
 bfd/wasm-module.c      |  28 +++++-----
 bfd/xcofflink.c        |  22 ++++----
 bfd/xsym.c             |  34 ++++++------
 binutils/ar.c          |  12 ++---
 binutils/objcopy.c     |   6 +--
 binutils/od-macho.c    |  16 +++---
 binutils/od-pe.c       |  27 +++++-----
 binutils/od-xcoff.c    |  24 ++++-----
 gas/config/obj-aout.c  |   2 +-
 gas/config/tc-tic54x.c |   2 +-
 gdb/coff-pe-read.c     |  12 ++---
 gdb/coffread.c         |  14 ++---
 gdb/dbxread.c          |  16 +++---
 gdb/dwarf2/section.c   |   2 +-
 gdb/gdb_bfd.c          |   2 +-
 gdb/minidebug.c        |   6 +--
 gdb/solib-svr4.c       |   2 +-
 gdb/xcoffread.c        |   8 +--
 ld/emultempl/pe.em     |   4 +-
 ld/emultempl/pep.em    |   4 +-
 ld/ldelf.c             |   4 +-
 ld/pdb.c               | 108 ++++++++++++++++++-------------------
 ld/pe-dll.c            |  20 +++----
 sim/bfin/interp.c      |   8 +--
 sim/cris/sim-if.c      |   4 +-
 sim/rl78/load.c        |   2 +-
 sim/rx/load.c          |   2 +-
 93 files changed, 928 insertions(+), 965 deletions(-)

diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c
index fae8bb6cb1a..a441b3b420c 100644
--- a/bfd/aix5ppc-core.c
+++ b/bfd/aix5ppc-core.c
@@ -67,7 +67,7 @@ xcoff64_core_p (bfd *abfd)
     goto xcoff64_core_p_error;
 
   if (sizeof (struct core_dumpxx)
-      != bfd_bread (&core, sizeof (struct core_dumpxx), abfd))
+      != bfd_read (&core, sizeof (struct core_dumpxx), abfd))
     goto xcoff64_core_p_error;
 
   if (bfd_stat (abfd, &statbuf) < 0)
@@ -199,7 +199,7 @@ xcoff64_core_p (bfd *abfd)
 	return NULL;
 
       if (sizeof (struct __ld_info64) !=
-	  bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
+	  bfd_read (&ldinfo, sizeof (struct __ld_info64), abfd))
 	return NULL;
 
       if (ldinfo.ldinfo_core)
@@ -227,7 +227,7 @@ xcoff64_core_p (bfd *abfd)
 
       for (i = 0; i < core.c_vmregions; i++)
 	if (sizeof (struct vm_infox) !=
-	    bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
+	    bfd_read (&vminfo, sizeof (struct vm_infox), abfd))
 	  return NULL;
 
       if (vminfo.vminfo_offset)
@@ -273,7 +273,7 @@ xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
     return return_value;
 
   if (sizeof (struct core_dumpxx) !=
-      bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd))
+      bfd_read (&core, sizeof (struct core_dumpxx), core_bfd))
     return return_value;
 
   if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0)
@@ -288,7 +288,7 @@ xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
 
   while (1)
     {
-      if (bfd_bread (s, 1, core_bfd) != 1)
+      if (bfd_read (s, 1, core_bfd) != 1)
 	goto xcoff64_core_file_matches_executable_p_end_1;
 
       if (*s == '\0')
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 7765f5c80d8..f427ffcb5c8 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -136,7 +136,7 @@ MY (object_p) (bfd *abfd)
   bfd_cleanup cleanup;
   size_t amt = EXEC_BYTES_SIZE;
 
-  if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
+  if (bfd_read (&exec_bytes, amt, abfd) != amt)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 1a8fd85cf14..0c0e3977b65 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1272,7 +1272,7 @@ NAME (aout, set_section_contents) (bfd *abfd,
   if (count != 0)
     {
       if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
-	  || bfd_bwrite (location, count, abfd) != count)
+	  || bfd_write (location, count, abfd) != count)
 	return false;
     }
 
@@ -1324,7 +1324,7 @@ aout_get_external_symbols (bfd *abfd)
 
       /* Get the size of the strings.  */
       if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
-	  || bfd_bread ((void *) string_chars, amt, abfd) != amt)
+	  || bfd_read (string_chars, amt, abfd) != amt)
 	return false;
       stringsize = GET_WORD (abfd, string_chars);
       if (stringsize == 0)
@@ -1354,7 +1354,7 @@ aout_get_external_symbols (bfd *abfd)
 	  if (stringsize >= BYTES_IN_WORD)
 	    {
 	      amt = stringsize - BYTES_IN_WORD;
-	      if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt)
+	      if (bfd_read (strings + BYTES_IN_WORD, amt, abfd) != amt)
 		{
 		  free (strings);
 		  return false;
@@ -1850,7 +1850,7 @@ emit_stringtab (bfd *abfd, struct bfd_strtab_hash *tab)
 
   /* The string table starts with the size.  */
   PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
-  if (bfd_bwrite ((void *) buffer, amt, abfd) != amt)
+  if (bfd_write (buffer, amt, abfd) != amt)
     return false;
 
   return _bfd_stringtab_emit (abfd, tab);
@@ -1896,7 +1896,7 @@ NAME (aout, write_syms) (bfd *abfd)
 	goto error_return;
 
       amt = EXTERNAL_NLIST_SIZE;
-      if (bfd_bwrite ((void *) &nsp, amt, abfd) != amt)
+      if (bfd_write (&nsp, amt, abfd) != amt)
 	goto error_return;
 
       /* NB: `KEEPIT' currently overlays `udata.p', so set this only
@@ -2431,7 +2431,7 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section)
 	}
     }
 
-  if (bfd_bwrite ((void *) native, natsize, abfd) != natsize)
+  if (bfd_write (native, natsize, abfd) != natsize)
     {
       bfd_release (abfd, native);
       return false;
@@ -3729,7 +3729,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
 
   amt = EXTERNAL_NLIST_SIZE;
   if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0
-      || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt)
+      || bfd_write (&outsym, amt, output_bfd) != amt)
     /* FIXME: No way to handle errors.  */
     abort ();
 
@@ -3942,7 +3942,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
 
   amt = obj_reloc_entry_size (flaginfo->output_bfd);
   if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
-      || bfd_bwrite (rel_ptr, amt, flaginfo->output_bfd) != amt)
+      || bfd_write (rel_ptr, amt, flaginfo->output_bfd) != amt)
     return false;
 
   *reloff_ptr += obj_reloc_entry_size (flaginfo->output_bfd);
@@ -4766,7 +4766,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo,
       if (rel_size > 0)
 	{
 	  if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
-	      || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
+	      || bfd_read (relocs, rel_size, input_bfd) != rel_size)
 	    return false;
 	}
     }
@@ -4801,7 +4801,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo,
     {
       if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
 	return false;
-      if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size)
+      if (bfd_write (relocs, rel_size, flaginfo->output_bfd) != rel_size)
 	return false;
       *reloff_ptr += rel_size;
 
@@ -5293,7 +5293,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd)
 	return false;
       outsym_size = outsym - flaginfo->output_syms;
       outsym_size *= EXTERNAL_NLIST_SIZE;
-      if (bfd_bwrite ((void *) flaginfo->output_syms, outsym_size, output_bfd)
+      if (bfd_write (flaginfo->output_syms, outsym_size, output_bfd)
 	  != outsym_size)
 	return false;
       flaginfo->symoff += outsym_size;
@@ -5663,7 +5663,7 @@ NAME (aout, final_link) (bfd *abfd,
       bfd_byte b[BYTES_IN_WORD];
 
       memset (b, 0, BYTES_IN_WORD);
-      if (bfd_bwrite (b, (bfd_size_type) BYTES_IN_WORD, abfd) != BYTES_IN_WORD)
+      if (bfd_write (b, BYTES_IN_WORD, abfd) != BYTES_IN_WORD)
 	goto error_return;
     }
 
diff --git a/bfd/archive.c b/bfd/archive.c
index f6cae7a5b1b..47b37bb6e37 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -517,7 +517,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
   char fmag_save;
   int scan;
 
-  if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
+  if (bfd_read (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_no_more_archived_files);
@@ -577,7 +577,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
       filename = (allocptr
 		  + sizeof (struct areltdata)
 		  + sizeof (struct ar_hdr));
-      if (bfd_bread (filename, namelen, abfd) != namelen)
+      if (bfd_read (filename, namelen, abfd) != namelen)
 	{
 	  free (allocptr);
 	  if (bfd_get_error () != bfd_error_system_call)
@@ -898,7 +898,7 @@ bfd_generic_archive_p (bfd *abfd)
   char armag[SARMAG + 1];
   size_t amt;
 
-  if (bfd_bread (armag, SARMAG, abfd) != SARMAG)
+  if (bfd_read (armag, SARMAG, abfd) != SARMAG)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
@@ -1098,7 +1098,7 @@ do_slurp_coff_armap (bfd *abfd)
   parsed_size = mapdata->parsed_size;
   free (mapdata);
 
-  if (bfd_bread (int_buf, 4, abfd) != 4)
+  if (bfd_read (int_buf, 4, abfd) != 4)
     return false;
 
   /* It seems that all numeric information in a coff archive is always
@@ -1145,7 +1145,7 @@ do_slurp_coff_armap (bfd *abfd)
   carsyms = ardata->symdefs;
   stringbase = ((char *) ardata->symdefs) + carsym_size;
 
-  if (bfd_bread (stringbase, stringsize, abfd) != stringsize)
+  if (bfd_read (stringbase, stringsize, abfd) != stringsize)
     goto release_symdefs;
 
   /* OK, build the carsyms.  */
@@ -1199,14 +1199,14 @@ bool
 bfd_slurp_armap (bfd *abfd)
 {
   char nextname[17];
-  int i = bfd_bread (nextname, 16, abfd);
+  int i = bfd_read (nextname, 16, abfd);
 
   if (i == 0)
     return true;
   if (i != 16)
     return false;
 
-  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+  if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
     return false;
 
   if (startswith (nextname, "__.SYMDEF       ")
@@ -1232,10 +1232,10 @@ bfd_slurp_armap (bfd *abfd)
       struct ar_hdr hdr;
       char extname[21];
 
-      if (bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
+      if (bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
 	return false;
       /* Read the extended name.  We know its length.  */
-      if (bfd_bread (extname, 20, abfd) != 20)
+      if (bfd_read (extname, 20, abfd) != 20)
 	return false;
       if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0)
 	return false;
@@ -1271,13 +1271,13 @@ _bfd_slurp_extended_name_table (bfd *abfd)
   if (bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET) != 0)
     return false;
 
-  if (bfd_bread (nextname, 16, abfd) == 16)
+  if (bfd_read (nextname, 16, abfd) == 16)
     {
       struct areltdata *namedata;
       bfd_size_type amt;
       ufile_ptr filesize;
 
-      if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+      if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
 	return false;
 
       if (! startswith (nextname, "ARFILENAMES/    ")
@@ -1311,7 +1311,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
 	  return false;
 	}
 
-      if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
+      if (bfd_read (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
 	{
 	  if (bfd_get_error () != bfd_error_system_call)
 	    bfd_set_error (bfd_error_malformed_archive);
@@ -1804,7 +1804,7 @@ _bfd_generic_write_ar_hdr (bfd *archive, bfd *abfd)
 {
   struct ar_hdr *hdr = arch_hdr (abfd);
 
-  if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+  if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
     return false;
   return true;
 }
@@ -1829,10 +1829,10 @@ _bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd)
 			    arch_eltdata (abfd)->parsed_size + padded_len))
 	return false;
 
-      if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+      if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
 	return false;
 
-      if (bfd_bwrite (fullname, len, archive) != len)
+      if (bfd_write (fullname, len, archive) != len)
 	return false;
 
       if (len & 3)
@@ -1840,13 +1840,13 @@ _bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd)
 	  static const char pad[3] = { 0, 0, 0 };
 
 	  len = 4 - (len & 3);
-	  if (bfd_bwrite (pad, len, archive) != len)
+	  if (bfd_write (pad, len, archive) != len)
 	    return false;
 	}
     }
   else
     {
-      if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+      if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
 	return false;
     }
   return true;
@@ -2186,12 +2186,12 @@ _bfd_write_archive_contents (bfd *arch)
 		 (arch, &etable, &elength, &ename)))
     return false;
 
-  if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
+  if (bfd_seek (arch, 0, SEEK_SET) != 0)
     return false;
   armag = ARMAG;
   if (bfd_is_thin_archive (arch))
     armag = ARMAGT;
-  wrote = bfd_bwrite (armag, SARMAG, arch);
+  wrote = bfd_write (armag, SARMAG, arch);
   if (wrote != SARMAG)
     return false;
 
@@ -2212,13 +2212,13 @@ _bfd_write_archive_contents (bfd *arch)
 			    (elength + 1) & ~(bfd_size_type) 1))
 	return false;
       memcpy (hdr.ar_fmag, ARFMAG, 2);
-      if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+      if ((bfd_write (&hdr, sizeof (struct ar_hdr), arch)
 	   != sizeof (struct ar_hdr))
-	  || bfd_bwrite (etable, elength, arch) != elength)
+	  || bfd_write (etable, elength, arch) != elength)
 	return false;
       if ((elength % 2) == 1)
 	{
-	  if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1)
+	  if (bfd_write (&ARFMAG[1], 1, arch) != 1)
 	    return false;
 	}
     }
@@ -2242,7 +2242,7 @@ _bfd_write_archive_contents (bfd *arch)
 	goto input_err;
       if (bfd_is_thin_archive (arch))
 	continue;
-      if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
+      if (bfd_seek (current, 0, SEEK_SET) != 0)
 	goto input_err;
 
       while (remaining)
@@ -2252,16 +2252,16 @@ _bfd_write_archive_contents (bfd *arch)
 	  if (amt > remaining)
 	    amt = remaining;
 	  errno = 0;
-	  if (bfd_bread (buffer, amt, current) != amt)
+	  if (bfd_read (buffer, amt, current) != amt)
 	    goto input_err;
-	  if (bfd_bwrite (buffer, amt, arch) != amt)
+	  if (bfd_write (buffer, amt, arch) != amt)
 	    goto input_err;
 	  remaining -= amt;
 	}
 
       if ((arelt_size (current) % 2) == 1)
 	{
-	  if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1)
+	  if (bfd_write (&ARFMAG[1], 1, arch) != 1)
 	    goto input_err;
 	}
     }
@@ -2546,11 +2546,11 @@ _bfd_bsd_write_armap (bfd *arch,
   if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize))
     return false;
   memcpy (hdr.ar_fmag, ARFMAG, 2);
-  if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+  if (bfd_write (&hdr, sizeof (struct ar_hdr), arch)
       != sizeof (struct ar_hdr))
     return false;
   H_PUT_32 (arch, ranlibsize, temp);
-  if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
+  if (bfd_write (temp, sizeof (temp), arch) != sizeof (temp))
     return false;
 
   firstreal = first;
@@ -2588,20 +2588,20 @@ _bfd_bsd_write_armap (bfd *arch,
       last_elt = current;
       H_PUT_32 (arch, map[count].namidx, buf);
       H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
-      if (bfd_bwrite (buf, BSD_SYMDEF_SIZE, arch)
+      if (bfd_write (buf, BSD_SYMDEF_SIZE, arch)
 	  != BSD_SYMDEF_SIZE)
 	return false;
     }
 
   /* Now write the strings themselves.  */
   H_PUT_32 (arch, stringsize, temp);
-  if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
+  if (bfd_write (temp, sizeof (temp), arch) != sizeof (temp))
     return false;
   for (count = 0; count < orl_count; count++)
     {
       size_t len = strlen (*map[count].name) + 1;
 
-      if (bfd_bwrite (*map[count].name, len, arch) != len)
+      if (bfd_write (*map[count].name, len, arch) != len)
 	return false;
     }
 
@@ -2609,7 +2609,7 @@ _bfd_bsd_write_armap (bfd *arch,
      bug-compatible for sun's ar we use a null.  */
   if (padit)
     {
-      if (bfd_bwrite ("", 1, arch) != 1)
+      if (bfd_write ("", 1, arch) != 1)
 	return false;
     }
 
@@ -2658,7 +2658,7 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch)
   bfd_ardata (arch)->armap_datepos = (SARMAG
 				      + offsetof (struct ar_hdr, ar_date[0]));
   if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
-      || (bfd_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch)
+      || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), arch)
 	  != sizeof (hdr.ar_date)))
     {
       bfd_perror (_("Writing updated armap timestamp"));
@@ -2758,7 +2758,7 @@ _bfd_coff_write_armap (bfd *arch,
   memcpy (hdr.ar_fmag, ARFMAG, 2);
 
   /* Write the ar header for this item and the number of symbols.  */
-  if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+  if (bfd_write (&hdr, sizeof (struct ar_hdr), arch)
       != sizeof (struct ar_hdr))
     return false;
 
@@ -2809,7 +2809,7 @@ _bfd_coff_write_armap (bfd *arch,
     {
       size_t len = strlen (*map[count].name) + 1;
 
-      if (bfd_bwrite (*map[count].name, len, arch) != len)
+      if (bfd_write (*map[count].name, len, arch) != len)
 	return false;
     }
 
@@ -2817,7 +2817,7 @@ _bfd_coff_write_armap (bfd *arch,
      bug-compatible for arc960 we use a null.  */
   if (padit)
     {
-      if (bfd_bwrite ("", 1, arch) != 1)
+      if (bfd_write ("", 1, arch) != 1)
 	return false;
     }
 
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 7eb8331a3ed..63d2393ccfd 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -52,13 +52,13 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
   ardata->symdefs = NULL;
 
   /* Get the name of the first element.  */
-  i = bfd_bread (nextname, 16, abfd);
+  i = bfd_read (nextname, 16, abfd);
   if (i == 0)
     return true;
   if (i != 16)
     return false;
 
-  if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
+  if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
     return false;
 
   /* Archives with traditional armaps are still permitted.  */
@@ -84,7 +84,7 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
       return false;
     }
 
-  if (bfd_bread (int_buf, 8, abfd) != 8)
+  if (bfd_read (int_buf, 8, abfd) != 8)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_malformed_archive);
@@ -118,7 +118,7 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
 
   raw_armap = (bfd_byte *) _bfd_alloc_and_read (abfd, ptrsize, ptrsize);
   if (raw_armap == NULL
-      || bfd_bread (stringbase, stringsize, abfd) != stringsize)
+      || bfd_read (stringbase, stringsize, abfd) != stringsize)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_malformed_archive);
@@ -196,12 +196,12 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
 
   /* Write the ar header for this item and the number of symbols */
 
-  if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+  if (bfd_write (&hdr, sizeof (struct ar_hdr), arch)
       != sizeof (struct ar_hdr))
     return false;
 
   bfd_putb64 ((bfd_vma) symbol_count, buf);
-  if (bfd_bwrite (buf, 8, arch) != 8)
+  if (bfd_write (buf, 8, arch) != 8)
     return false;
 
   /* Two passes, first write the file offsets for each symbol -
@@ -222,7 +222,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
 	   count++)
 	{
 	  bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
-	  if (bfd_bwrite (buf, 8, arch) != 8)
+	  if (bfd_write (buf, 8, arch) != 8)
 	    return false;
 	}
 
@@ -239,7 +239,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
     {
       size_t len = strlen (*map[count].name) + 1;
 
-      if (bfd_bwrite (*map[count].name, len, arch) != len)
+      if (bfd_write (*map[count].name, len, arch) != len)
 	return false;
     }
 
@@ -247,7 +247,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
      However, the Irix 6.2 tools do not appear to do this.  */
   while (padding != 0)
     {
-      if (bfd_bwrite ("", 1, arch) != 1)
+      if (bfd_write ("", 1, arch) != 1)
 	return false;
       --padding;
     }
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index cc62ab19617..c405592618e 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2722,9 +2722,9 @@ bfd_vma bfd_emul_get_commonpagesize (const char *);
 char *bfd_demangle (bfd *, const char *, int);
 
 /* Extracted from bfdio.c.  */
-bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+bfd_size_type bfd_read (void *, bfd_size_type, bfd *);
 
-bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+bfd_size_type bfd_write (const void *, bfd_size_type, bfd *);
 
 file_ptr bfd_tell (bfd *);
 
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index e0d47b3ee1c..59ac1263007 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -231,10 +231,10 @@ DESCRIPTION
 
 /*
 FUNCTION
-	bfd_bread
+	bfd_read
 
 SYNOPSIS
-	bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+	bfd_size_type bfd_read (void *, bfd_size_type, bfd *);
 
 DESCRIPTION
 	Attempt to read SIZE bytes from ABFD's iostream to PTR.
@@ -242,7 +242,7 @@ DESCRIPTION
 */
 
 bfd_size_type
-bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
+bfd_read (void *ptr, bfd_size_type size, bfd *abfd)
 {
   file_ptr nread;
   bfd *element_bfd = abfd;
@@ -296,10 +296,10 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
 
 /*
 FUNCTION
-	bfd_bwrite
+	bfd_write
 
 SYNOPSIS
-	bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+	bfd_size_type bfd_write (const void *, bfd_size_type, bfd *);
 
 DESCRIPTION
 	Attempt to write SIZE bytes to ABFD's iostream from PTR.
@@ -307,7 +307,7 @@ DESCRIPTION
 */
 
 bfd_size_type
-bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
+bfd_write (const void *ptr, bfd_size_type size, bfd *abfd)
 {
   file_ptr nwrote;
 
diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c
index 5ecf2f94ee4..6b4ea5c4da9 100644
--- a/bfd/bfdwin.c
+++ b/bfd/bfdwin.c
@@ -292,7 +292,7 @@ bfd_get_file_window (bfd *abfd,
   i->refcount = 1;
   if (bfd_seek (abfd, offset, SEEK_SET) != 0)
     goto free_and_fail;
-  i->size = bfd_bread (i->data, size, abfd);
+  i->size = bfd_read (i->data, size, abfd);
   if (i->size != size)
     goto free_and_fail;
   i->mapped = 0;
diff --git a/bfd/binary.c b/bfd/binary.c
index 65fe26f1f91..c31ef3c2eca 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -103,7 +103,7 @@ binary_get_section_contents (bfd *abfd,
 			     bfd_size_type count)
 {
   if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
-      || bfd_bread (location, count, abfd) != count)
+      || bfd_read (location, count, abfd) != count)
     return false;
   return true;
 }
diff --git a/bfd/cisco-core.c b/bfd/cisco-core.c
index 8fc8a354a0f..345f06bf571 100644
--- a/bfd/cisco-core.c
+++ b/bfd/cisco-core.c
@@ -95,10 +95,10 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
   size_t amt;
   flagword flags;
 
-  if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
+  if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0)
     return NULL;
 
-  nread = bfd_bread (buf, (bfd_size_type) 4, abfd);
+  nread = bfd_read (buf, 4, abfd);
   if (nread != 4)
     {
       if (bfd_get_error () != bfd_error_system_call)
@@ -107,14 +107,14 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
     }
   crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf));
 
-  if (bfd_seek (abfd, (file_ptr) crashinfo_offset, SEEK_SET) != 0)
+  if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0)
     {
       /* Most likely we failed because of a bogus (huge) offset */
       bfd_set_error (bfd_error_wrong_format);
       return NULL;
     }
 
-  nread = bfd_bread (&crashinfo, (bfd_size_type) sizeof (crashinfo), abfd);
+  nread = bfd_read (&crashinfo, sizeof (crashinfo), abfd);
   if (nread != sizeof (crashinfo))
     {
       if (bfd_get_error () != bfd_error_system_call)
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 45b3f760f55..1b34a8957c2 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2030,9 +2030,9 @@ alpha_ecoff_read_ar_hdr (bfd *abfd)
 
       /* This is a compressed file.  We must set the size correctly.
 	 The size is the eight bytes after the dummy file header.  */
-      if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0
-	  || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8
-	  || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0)
+      if (bfd_seek (abfd, FILHSZ, SEEK_CUR) != 0
+	  || bfd_read (ab, 8, abfd) != 8
+	  || bfd_seek (abfd, -(FILHSZ + 8), SEEK_CUR) != 0)
 	{
 	  free (ret);
 	  return NULL;
@@ -2077,18 +2077,18 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos,
     return nbfd;
 
   /* We must uncompress this element.  We do this by copying it into a
-     memory buffer, and making bfd_bread and bfd_seek use that buffer.
+     memory buffer, and making bfd_read and bfd_seek use that buffer.
      This can use a lot of memory, but it's simpler than getting a
      temporary file, making that work with the file descriptor caching
      code, and making sure that it is deleted at all appropriate
      times.  It can be changed if it ever becomes important.  */
 
   /* The compressed file starts with a dummy ECOFF file header.  */
-  if (bfd_seek (nbfd, (file_ptr) FILHSZ, SEEK_SET) != 0)
+  if (bfd_seek (nbfd, FILHSZ, SEEK_SET) != 0)
     goto error_return;
 
   /* The next eight bytes are the real file size.  */
-  if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
+  if (bfd_read (ab, 8, nbfd) != 8)
     goto error_return;
   size = H_GET_64 (nbfd, ab);
 
@@ -2115,7 +2115,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos,
       left = size;
 
       /* I don't know what the next eight bytes are for.  */
-      if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
+      if (bfd_read (ab, 8, nbfd) != 8)
 	goto error_return;
 
       /* This is the uncompression algorithm.  It's a simple
@@ -2126,7 +2126,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos,
 	 next eight bytes in the output stream.  */
       memset (dict, 0, sizeof dict);
       h = 0;
-      while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1)
+      while (bfd_read (&b, 1, nbfd) == 1)
 	{
 	  unsigned int i;
 
@@ -2138,7 +2138,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos,
 		n = dict[h];
 	      else
 		{
-		  if (bfd_bread (&n, 1, nbfd) != 1)
+		  if (bfd_read (&n, 1, nbfd) != 1)
 		    goto error_return;
 		  dict[h] = n;
 		}
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c
index 141c4fa67f1..4baf1412d7f 100644
--- a/bfd/coff-ia64.c
+++ b/bfd/coff-ia64.c
@@ -76,9 +76,8 @@ ia64coff_object_p (bfd *abfd)
     struct external_PEI_IMAGE_hdr image_hdr;
     file_ptr offset;
 
-    if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
-	|| (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
-	    != sizeof (dos_hdr)))
+    if (bfd_seek (abfd, 0, SEEK_SET) != 0
+	|| (bfd_read (&dos_hdr, sizeof (dos_hdr), abfd) != sizeof (dos_hdr)))
       {
 	if (bfd_get_error () != bfd_error_system_call)
 	  bfd_set_error (bfd_error_wrong_format);
@@ -103,7 +102,7 @@ ia64coff_object_p (bfd *abfd)
 
     offset = H_GET_32 (abfd, dos_hdr.e_lfanew);
     if (bfd_seek (abfd, offset, SEEK_SET) != 0
-	|| (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd)
+	|| (bfd_read (&image_hdr, sizeof (image_hdr), abfd)
 	    != sizeof (image_hdr)))
       {
 	if (bfd_get_error () != bfd_error_system_call)
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index a692c1ae474..06d0fd854a6 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -1368,8 +1368,7 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
 	return false;
 
       /* The symbol table starts with a normal archive header.  */
-      if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
-	  != SIZEOF_AR_HDR)
+      if (bfd_read (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
 	return false;
 
       /* Skip the name (normally empty).  */
@@ -1430,8 +1429,7 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
 	return false;
 
       /* The symbol table starts with a normal archive header.  */
-      if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
-	  != SIZEOF_AR_HDR_BIG)
+      if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
 	return false;
 
       /* Skip the name (normally empty).  */
@@ -1506,7 +1504,7 @@ _bfd_xcoff_archive_p (bfd *abfd)
   char magic[SXCOFFARMAG];
   size_t amt = SXCOFFARMAG;
 
-  if (bfd_bread (magic, amt, abfd) != amt)
+  if (bfd_read (magic, amt, abfd) != amt)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
@@ -1538,7 +1536,7 @@ _bfd_xcoff_archive_p (bfd *abfd)
 
       /* Now read the rest of the file header.  */
       amt = SIZEOF_AR_FILE_HDR - SXCOFFARMAG;
-      if (bfd_bread (&hdr.memoff, amt, abfd) != amt)
+      if (bfd_read (&hdr.memoff, amt, abfd) != amt)
 	{
 	  if (bfd_get_error () != bfd_error_system_call)
 	    bfd_set_error (bfd_error_wrong_format);
@@ -1565,7 +1563,7 @@ _bfd_xcoff_archive_p (bfd *abfd)
 
       /* Now read the rest of the file header.  */
       amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
-      if (bfd_bread (&hdr.memoff, amt, abfd) != amt)
+      if (bfd_read (&hdr.memoff, amt, abfd) != amt)
 	{
 	  if (bfd_get_error () != bfd_error_system_call)
 	    bfd_set_error (bfd_error_wrong_format);
@@ -1702,7 +1700,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
       struct xcoff_ar_hdr hdr;
       struct xcoff_ar_hdr *hdrp;
 
-      if (bfd_bread (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
+      if (bfd_read (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
 	return NULL;
 
       GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
@@ -1715,7 +1713,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
 
       hdrp = (struct xcoff_ar_hdr *) (ret + 1);
       memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
-      if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
+      if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
 	{
 	  free (ret);
 	  return NULL;
@@ -1731,7 +1729,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
       struct xcoff_ar_hdr_big hdr;
       struct xcoff_ar_hdr_big *hdrp;
 
-      if (bfd_bread (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
+      if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
 	return NULL;
 
       GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
@@ -1744,7 +1742,7 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
 
       hdrp = (struct xcoff_ar_hdr_big *) (ret + 1);
       memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
-      if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
+      if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
 	{
 	  free (ret);
 	  return NULL;
@@ -1933,14 +1931,12 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED,
     if (*p == '\0')
       *p = ' ';
 
-  if (bfd_bwrite (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
-      != SIZEOF_AR_HDR
-      || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
-	  != SXCOFFARFMAG))
+  if (bfd_write (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
+      || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
     return false;
 
   H_PUT_32 (abfd, orl_count, buf);
-  if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
+  if (bfd_write (buf, 4, abfd) != 4)
     return false;
 
   i = 0;
@@ -1949,7 +1945,7 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED,
     while (map[i].u.abfd == iterator.current.member)
       {
 	H_PUT_32 (abfd, iterator.current.offset, buf);
-	if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
+	if (bfd_write (buf, 4, abfd) != 4)
 	  return false;
 	++i;
       }
@@ -1961,7 +1957,7 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED,
 
       name = *map[i].name;
       namlen = strlen (name);
-      if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1)
+      if (bfd_write (name, namlen + 1, abfd) != namlen + 1)
 	return false;
     }
 
@@ -1970,7 +1966,7 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED,
       char b;
 
       b = '\0';
-      if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+      if (bfd_write (&b, 1, abfd) != 1)
 	return false;
     }
 
@@ -2013,7 +2009,7 @@ do_pad (bfd *abfd, unsigned int number)
     return false;
 
   while (number--)
-    if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+    if (bfd_write (&b, 1, abfd) != 1)
       return false;
 
   return true;
@@ -2025,15 +2021,15 @@ do_copy (bfd *out_bfd, bfd *in_bfd)
   bfd_size_type remaining;
   bfd_byte buffer[DEFAULT_BUFFERSIZE];
 
-  if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0)
+  if (bfd_seek (in_bfd, 0, SEEK_SET) != 0)
     return false;
 
   remaining = arelt_size (in_bfd);
 
   while (remaining >= DEFAULT_BUFFERSIZE)
     {
-      if (bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
-	  || bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
+      if (bfd_read (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
+	  || bfd_write (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
 	return false;
 
       remaining -= DEFAULT_BUFFERSIZE;
@@ -2041,8 +2037,8 @@ do_copy (bfd *out_bfd, bfd *in_bfd)
 
   if (remaining)
     {
-      if (bfd_bread (buffer, remaining, in_bfd) != remaining
-	  || bfd_bwrite (buffer, remaining, out_bfd) != remaining)
+      if (bfd_read (buffer, remaining, in_bfd) != remaining
+	  || bfd_write (buffer, remaining, out_bfd) != remaining)
 	return false;
     }
 
@@ -2197,7 +2193,7 @@ xcoff_write_armap_big (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED,
 	    }
 	}
 
-      bfd_bwrite (symbol_table, symbol_table_size, abfd);
+      bfd_write (symbol_table, symbol_table_size, abfd);
 
       free (symbol_table);
 
@@ -2277,7 +2273,7 @@ xcoff_write_armap_big (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED,
 	    }
 	}
 
-      bfd_bwrite (symbol_table, symbol_table_size, abfd);
+      bfd_write (symbol_table, symbol_table_size, abfd);
 
       free (symbol_table);
 
@@ -2386,7 +2382,7 @@ xcoff_write_archive_contents_old (bfd *abfd)
   if (offsets == NULL)
     return false;
 
-  if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
+  if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
     return false;
 
   makemap = bfd_has_map (abfd);
@@ -2420,9 +2416,9 @@ xcoff_write_archive_contents_old (bfd *abfd)
 
       BFD_ASSERT (iterator.current.offset == bfd_tell (abfd));
       namlen = iterator.current.padded_namlen;
-      if (bfd_bwrite (ahdrp, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
-	  || bfd_bwrite (iterator.current.name, namlen, abfd) != namlen
-	  || bfd_bwrite (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
+      if (bfd_write (ahdrp, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
+	  || bfd_write (iterator.current.name, namlen, abfd) != namlen
+	  || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
 	  || bfd_seek (iterator.current.member, 0, SEEK_SET) != 0
 	  || !do_copy (abfd, iterator.current.member)
 	  || !do_pad (abfd, iterator.current.trailing_padding))
@@ -2470,21 +2466,19 @@ xcoff_write_archive_contents_old (bfd *abfd)
     if (*p == '\0')
       *p = ' ';
 
-  if ((bfd_bwrite (&ahdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
-       != SIZEOF_AR_HDR)
-      || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
-	  != SXCOFFARFMAG))
+  if ((bfd_write (&ahdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
+      || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
     return false;
 
   sprintf (decbuf, "%-12ld", (long) count);
-  if (bfd_bwrite (decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, abfd)
+  if (bfd_write (decbuf, XCOFFARMAG_ELEMENT_SIZE, abfd)
       != XCOFFARMAG_ELEMENT_SIZE)
     return false;
   for (i = 0; i < (size_t) count; i++)
     {
       sprintf (decbuf, "%-12ld", (long) offsets[i]);
-      if (bfd_bwrite (decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE,
-		      abfd) != XCOFFARMAG_ELEMENT_SIZE)
+      if (bfd_write (decbuf, XCOFFARMAG_ELEMENT_SIZE, abfd)
+	  != XCOFFARMAG_ELEMENT_SIZE)
 	return false;
     }
   for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next)
@@ -2494,7 +2488,7 @@ xcoff_write_archive_contents_old (bfd *abfd)
 
       name = normalize_filename (sub);
       namlen = strlen (name);
-      if (bfd_bwrite (name, namlen + 1, abfd) != namlen + 1)
+      if (bfd_write (name, namlen + 1, abfd) != namlen + 1)
 	return false;
     }
 
@@ -2523,7 +2517,7 @@ xcoff_write_archive_contents_old (bfd *abfd)
       *p = ' ';
 
   if (bfd_seek (abfd, 0, SEEK_SET) != 0
-      || (bfd_bwrite (fhdr, SIZEOF_AR_FILE_HDR, abfd) != SIZEOF_AR_FILE_HDR))
+      || (bfd_write (fhdr, SIZEOF_AR_FILE_HDR, abfd) != SIZEOF_AR_FILE_HDR))
     return false;
 
   return true;
@@ -2551,7 +2545,7 @@ xcoff_write_archive_contents_big (bfd *abfd)
   memset (&xtdata, 0, sizeof (xtdata));
   memcpy (fhdr->magic, XCOFFARMAGBIG, SXCOFFARMAG);
 
-  if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
+  if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
     return false;
 
   /* Calculate count and total_namlen.  */
@@ -2650,9 +2644,9 @@ xcoff_write_archive_contents_big (bfd *abfd)
 
       BFD_ASSERT (iterator.current.offset == bfd_tell (abfd));
       namlen = iterator.current.padded_namlen;
-      if (bfd_bwrite (ahdrp, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG
-	  || bfd_bwrite (iterator.current.name, namlen, abfd) != namlen
-	  || bfd_bwrite (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
+      if (bfd_write (ahdrp, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG
+	  || bfd_write (iterator.current.name, namlen, abfd) != namlen
+	  || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
 	  || bfd_seek (iterator.current.member, 0, SEEK_SET) != 0
 	  || !do_copy (abfd, iterator.current.member)
 	  || !do_pad (abfd, iterator.current.trailing_padding))
@@ -2755,7 +2749,7 @@ xcoff_write_archive_contents_big (bfd *abfd)
       mt += namlen + 1;
     }
 
-  if (bfd_bwrite (member_table, member_table_size, abfd) != member_table_size)
+  if (bfd_write (member_table, member_table_size, abfd) != member_table_size)
     return false;
 
   free (member_table);
@@ -2786,8 +2780,8 @@ xcoff_write_archive_contents_big (bfd *abfd)
   /* Write out the archive file header.  */
 
   if (bfd_seek (abfd, 0, SEEK_SET) != 0
-      || bfd_bwrite (fhdr,
-		     SIZEOF_AR_FILE_HDR_BIG, abfd) != SIZEOF_AR_FILE_HDR_BIG)
+      || (bfd_write (fhdr, SIZEOF_AR_FILE_HDR_BIG, abfd)
+	  != SIZEOF_AR_FILE_HDR_BIG))
     return false;
 
   return true;
@@ -4360,13 +4354,13 @@ xcoff_generate_rtinit  (bfd *abfd, const char *init, const char *fini,
   filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ;
 
   bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
-  bfd_bwrite (filehdr_ext, FILHSZ, abfd);
+  bfd_write (filehdr_ext, FILHSZ, abfd);
   bfd_coff_swap_scnhdr_out (abfd, &scnhdr, scnhdr_ext);
-  bfd_bwrite (scnhdr_ext, SCNHSZ, abfd);
-  bfd_bwrite (data_buffer, data_buffer_size, abfd);
-  bfd_bwrite (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd);
-  bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
-  bfd_bwrite (string_table, string_table_size, abfd);
+  bfd_write (scnhdr_ext, SCNHSZ, abfd);
+  bfd_write (data_buffer, data_buffer_size, abfd);
+  bfd_write (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd);
+  bfd_write (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
+  bfd_write (string_table, string_table_size, abfd);
 
   free (data_buffer);
   data_buffer = NULL;
diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c
index 707b80963da..84037702889 100644
--- a/bfd/coff-stgo32.c
+++ b/bfd/coff-stgo32.c
@@ -278,7 +278,7 @@ go32exe_check_format (bfd *abfd)
   bfd_set_error (bfd_error_system_call);
 
   /* Read in the stub file header, which is a DOS MZ executable.  */
-  if (bfd_bread (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE)
+  if (bfd_read (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE)
     goto fail;
 
   /* Make sure that this is an MZ executable.  */
@@ -303,7 +303,7 @@ go32exe_check_format (bfd *abfd)
   go32exe_temp_stub = bfd_malloc (stubsize);
   if (go32exe_temp_stub == NULL)
     goto fail;
-  if (bfd_bread (go32exe_temp_stub, stubsize, abfd) != stubsize)
+  if (bfd_read (go32exe_temp_stub, stubsize, abfd) != stubsize)
     goto fail;
   go32exe_temp_stub_size = stubsize;
 
@@ -351,7 +351,7 @@ go32exe_write_object_contents (bfd *abfd)
   abfd->origin = 0;
   if (bfd_seek (abfd, 0, SEEK_SET) != 0)
     return false;
-  if (bfd_bwrite (coff_data (abfd)->stub, stubsize, abfd) != stubsize)
+  if (bfd_write (coff_data (abfd)->stub, stubsize, abfd) != stubsize)
     return false;
 
   /* Seek back to where we were.  */
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index d76c99a3eca..8a7647afc98 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -1829,8 +1829,7 @@ xcoff64_slurp_armap (bfd *abfd)
     return false;
 
   /* The symbol table starts with a normal archive header.  */
-  if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
-      != SIZEOF_AR_HDR_BIG)
+  if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
     return false;
 
   /* Skip the name (normally empty).  */
@@ -1907,7 +1906,7 @@ xcoff64_archive_p (bfd *abfd)
   struct xcoff_ar_file_hdr_big hdr;
   size_t amt = SXCOFFARMAG;
 
-  if (bfd_bread (magic, amt, abfd) != amt)
+  if (bfd_read (magic, amt, abfd) != amt)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
@@ -1925,7 +1924,7 @@ xcoff64_archive_p (bfd *abfd)
 
   /* Now read the rest of the file header.  */
   amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
-  if (bfd_bread (&hdr.memoff, amt, abfd) != amt)
+  if (bfd_read (&hdr.memoff, amt, abfd) != amt)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
@@ -2384,15 +2383,15 @@ xcoff64_generate_rtinit (bfd *abfd, const char *init, const char *fini,
   filehdr.f_symptr = data_scnhdr.s_relptr + data_scnhdr.s_nreloc * RELSZ;
 
   bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
-  bfd_bwrite (filehdr_ext, FILHSZ, abfd);
+  bfd_write (filehdr_ext, FILHSZ, abfd);
   bfd_coff_swap_scnhdr_out (abfd, &text_scnhdr, &scnhdr_ext[SCNHSZ * 0]);
   bfd_coff_swap_scnhdr_out (abfd, &data_scnhdr, &scnhdr_ext[SCNHSZ * 1]);
   bfd_coff_swap_scnhdr_out (abfd, &bss_scnhdr, &scnhdr_ext[SCNHSZ * 2]);
-  bfd_bwrite (scnhdr_ext, 3 * SCNHSZ, abfd);
-  bfd_bwrite (data_buffer, data_buffer_size, abfd);
-  bfd_bwrite (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd);
-  bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
-  bfd_bwrite (string_table, string_table_size, abfd);
+  bfd_write (scnhdr_ext, 3 * SCNHSZ, abfd);
+  bfd_write (data_buffer, data_buffer_size, abfd);
+  bfd_write (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd);
+  bfd_write (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
+  bfd_write (string_table, string_table_size, abfd);
 
   free (data_buffer);
   data_buffer = NULL;
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 6c8080c841e..99d9a5602d7 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1888,9 +1888,9 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
       file_ptr oldpos = bfd_tell (abfd);
       bfd_size_type relsz = bfd_coff_relsz (abfd);
 
-      if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0)
+      if (bfd_seek (abfd, hdr->s_relptr, 0) != 0)
 	return;
-      if (bfd_bread (& dst, relsz, abfd) != relsz)
+      if (bfd_read (& dst, relsz, abfd) != relsz)
 	return;
 
       bfd_coff_swap_reloc_in (abfd, &dst, &n);
@@ -1959,9 +1959,9 @@ coff_set_alignment_hook (bfd * abfd, asection * section, void * scnhdr)
       const file_ptr oldpos = bfd_tell (abfd);
       const bfd_size_type relsz = bfd_coff_relsz (abfd);
 
-      if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0)
+      if (bfd_seek (abfd, hdr->s_relptr, 0) != 0)
 	return;
-      if (bfd_bread (& dst, relsz, abfd) != relsz)
+      if (bfd_read (& dst, relsz, abfd) != relsz)
 	return;
 
       bfd_coff_swap_reloc_in (abfd, &dst, &n);
@@ -2557,8 +2557,8 @@ coff_write_relocs (bfd * abfd, int first_undef)
 	  /* Add one to count *this* reloc (grr).  */
 	  n.r_vaddr = s->reloc_count + 1;
 	  coff_swap_reloc_out (abfd, &n, &dst);
-	  if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
-			  abfd) != bfd_coff_relsz (abfd))
+	  if (bfd_write (&dst, bfd_coff_relsz (abfd), abfd)
+	      != bfd_coff_relsz (abfd))
 	    return false;
 	}
 #endif
@@ -2650,8 +2650,8 @@ coff_write_relocs (bfd * abfd, int first_undef)
 #endif
 	  coff_swap_reloc_out (abfd, &n, &dst);
 
-	  if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
-			 abfd) != bfd_coff_relsz (abfd))
+	  if (bfd_write (&dst, bfd_coff_relsz (abfd), abfd)
+	      != bfd_coff_relsz (abfd))
 	    return false;
 	}
 
@@ -3271,7 +3271,7 @@ coff_compute_section_file_positions (bfd * abfd)
 
       b = 0;
       if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0
-	  || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+	  || bfd_write (&b, 1, abfd) != 1)
 	return false;
     }
 
@@ -3295,7 +3295,7 @@ coff_read_word (bfd *abfd, unsigned int *value, unsigned int *pelength)
   unsigned char b[2];
   int status;
 
-  status = bfd_bread (b, (bfd_size_type) 2, abfd);
+  status = bfd_read (b, 2, abfd);
   if (status < 1)
     {
       *value = 0;
@@ -3371,7 +3371,7 @@ coff_compute_checksum (bfd *abfd, unsigned int *pelength)
       if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
 	return 0;
 
-      buf_size = bfd_bread (buf, COFF_CHECKSUM_BUFFER_SIZE, abfd);
+      buf_size = bfd_read (buf, COFF_CHECKSUM_BUFFER_SIZE, abfd);
       cur_buf_size = buf_size;
       cur_buf = buf;
 
@@ -3411,7 +3411,7 @@ coff_apply_checksum (bfd *abfd)
     return false;
 
   checksum = 0;
-  bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
+  bfd_write (&checksum, 4, abfd);
 
   if (bfd_seek (abfd, peheader, SEEK_SET) != 0)
     return false;
@@ -3423,7 +3423,7 @@ coff_apply_checksum (bfd *abfd)
   if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
     return false;
 
-  bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
+  bfd_write (&checksum, 4, abfd);
 
   return true;
 }
@@ -3750,7 +3750,7 @@ coff_write_object_contents (bfd * abfd)
 	  bfd_size_type amt = bfd_coff_scnhsz (abfd);
 
 	  if (bfd_coff_swap_scnhdr_out (abfd, &section, &buff) == 0
-	      || bfd_bwrite (& buff, amt, abfd) != amt)
+	      || bfd_write (& buff, amt, abfd) != amt)
 	    return false;
 	}
 
@@ -3876,7 +3876,7 @@ coff_write_object_contents (bfd * abfd)
 	  scnhdr.s_flags = STYP_OVRFLO;
 	  amt = bfd_coff_scnhsz (abfd);
 	  if (bfd_coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
-	      || bfd_bwrite (& buff, amt, abfd) != amt)
+	      || bfd_write (& buff, amt, abfd) != amt)
 	    return false;
 	}
     }
@@ -3893,7 +3893,7 @@ coff_write_object_contents (bfd * abfd)
       bfd_byte *b = bfd_zmalloc (fill_size);
       if (b)
 	{
-	  bfd_bwrite (b, fill_size, abfd);
+	  bfd_write (b, fill_size, abfd);
 	  free (b);
 	}
     }
@@ -4232,7 +4232,7 @@ coff_write_object_contents (bfd * abfd)
 #endif
 
   /* Now write header.  */
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
     return false;
 
   {
@@ -4244,7 +4244,7 @@ coff_write_object_contents (bfd * abfd)
       return false;
 
     bfd_coff_swap_filehdr_out (abfd, & internal_f, buff);
-    amount = bfd_bwrite (buff, amount, abfd);
+    amount = bfd_write (buff, amount, abfd);
 
     free (buff);
 
@@ -4264,7 +4264,7 @@ coff_write_object_contents (bfd * abfd)
 	return false;
 
       coff_swap_aouthdr_out (abfd, & internal_a, buff);
-      amount = bfd_bwrite (buff, amount, abfd);
+      amount = bfd_write (buff, amount, abfd);
 
       free (buff);
 
@@ -4289,7 +4289,7 @@ coff_write_object_contents (bfd * abfd)
 	size = bfd_coff_aoutsz (abfd);
       else
 	size = SMALL_AOUTSZ;
-      if (bfd_bwrite (& buff, (bfd_size_type) size, abfd) != size)
+      if (bfd_write (&buff, size, abfd) != size)
 	return false;
     }
 #endif
@@ -4362,7 +4362,7 @@ coff_set_section_contents (bfd * abfd,
   if (count == 0)
     return true;
 
-  return bfd_bwrite (location, count, abfd) == count;
+  return bfd_write (location, count, abfd) == count;
 }
 
 static void *
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 9d45253178e..1ec9a5185c7 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -414,7 +414,7 @@ coff_object_p (bfd *abfd)
      aoutsz) in executables.  The bfd_coff_swap_aouthdr_in function
      expects this header to be aoutsz bytes in length, so we use that
      value in the call to bfd_alloc below.  But we must be careful to
-     only read in f_opthdr bytes in the call to bfd_bread.  We should
+     only read in f_opthdr bytes in the call to bfd_read.  We should
      also attempt to catch corrupt or non-COFF binaries with a strange
      value for f_opthdr.  */
   if (! bfd_coff_bad_format_hook (abfd, &internal_f)
@@ -638,7 +638,7 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
     }
 
   if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
-      || bfd_bread (external_relocs, amt, abfd) != amt)
+      || bfd_read (external_relocs, amt, abfd) != amt)
     goto error_return;
 
   if (internal_relocs == NULL)
@@ -1152,7 +1152,7 @@ coff_write_symbol (bfd *abfd,
   if (!buf)
     return false;
   bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
-  if (bfd_bwrite (buf, symesz, abfd) != symesz)
+  if (bfd_write (buf, symesz, abfd) != symesz)
     return false;
   bfd_release (abfd, buf);
 
@@ -1182,7 +1182,7 @@ coff_write_symbol (bfd *abfd,
 				 type, n_sclass, (int) j,
 				 native->u.syment.n_numaux,
 				 buf);
-	  if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
+	  if (bfd_write (buf, auxesz, abfd) != auxesz)
 	    return false;
 	}
       bfd_release (abfd, buf);
@@ -1475,8 +1475,7 @@ coff_write_symbols (bfd *abfd)
 #else
  #error Change H_PUT_32
 #endif
-    if (bfd_bwrite ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd)
-	!= sizeof (buffer))
+    if (bfd_write (buffer, sizeof (buffer), abfd) != sizeof (buffer))
       return false;
 
     if (! _bfd_stringtab_emit (abfd, strtab))
@@ -1535,8 +1534,7 @@ coff_write_linenumbers (bfd *abfd)
 		      out.l_lnno = 0;
 		      out.l_addr.l_symndx = l->u.offset;
 		      bfd_coff_swap_lineno_out (abfd, &out, buff);
-		      if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
-			  != linesz)
+		      if (bfd_write (buff, linesz, abfd) != linesz)
 			return false;
 		      l++;
 		      while (l->line_number)
@@ -1544,8 +1542,7 @@ coff_write_linenumbers (bfd *abfd)
 			  out.l_lnno = l->line_number;
 			  out.l_addr.l_symndx = l->u.offset;
 			  bfd_coff_swap_lineno_out (abfd, &out, buff);
-			  if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
-			      != linesz)
+			  if (bfd_write (buff, linesz, abfd) != linesz)
 			    return false;
 			  l++;
 			}
@@ -1759,8 +1756,7 @@ _bfd_coff_read_string_table (bfd *abfd)
   if (bfd_seek (abfd, pos + size, SEEK_SET) != 0)
     return NULL;
 
-  if (bfd_bread (extstrsize, (bfd_size_type) sizeof extstrsize, abfd)
-      != sizeof extstrsize)
+  if (bfd_read (extstrsize, sizeof extstrsize, abfd) != sizeof extstrsize)
     {
       if (bfd_get_error () != bfd_error_file_truncated)
 	return NULL;
@@ -1798,7 +1794,7 @@ _bfd_coff_read_string_table (bfd *abfd)
      they are zero.  */
   memset (strings, 0, STRING_SIZE_SIZE);
 
-  if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd)
+  if (bfd_read (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd)
       != strsize - STRING_SIZE_SIZE)
     {
       free (strings);
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 24c4a2b0ad7..aea5c4c38a5 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -978,7 +978,7 @@ _bfd_coff_final_link (bfd *abfd,
 
 	      if (rewrite
 		  && (bfd_seek (abfd, pos, SEEK_SET) != 0
-		      || bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz))
+		      || bfd_write (flaginfo.outsyms, symesz, abfd) != symesz))
 		goto error_return;
 
 	      obj_raw_syment_count (abfd) += written;
@@ -1023,7 +1023,7 @@ _bfd_coff_final_link (bfd *abfd,
 
       pos = obj_sym_filepos (abfd) + flaginfo.last_file_index * symesz;
       if (bfd_seek (abfd, pos, SEEK_SET) != 0
-	  || bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz)
+	  || bfd_write (flaginfo.outsyms, symesz, abfd) != symesz)
 	return false;
     }
 
@@ -1096,13 +1096,13 @@ _bfd_coff_final_link (bfd *abfd,
 	      memset (&incount, 0, sizeof (incount));
 	      incount.r_vaddr = o->reloc_count + 1;
 	      bfd_coff_swap_reloc_out (abfd, &incount, excount);
-	      if (bfd_bwrite (excount, relsz, abfd) != relsz)
+	      if (bfd_write (excount, relsz, abfd) != relsz)
 		/* We'll leak, but it's an error anyway. */
 		goto error_return;
 	      free (excount);
 	    }
-	  if (bfd_bwrite (external_relocs,
-			  (bfd_size_type) relsz * o->reloc_count, abfd)
+	  if (bfd_write (external_relocs,
+			 (bfd_size_type) relsz * o->reloc_count, abfd)
 	      != (bfd_size_type) relsz * o->reloc_count)
 	    goto error_return;
 	}
@@ -1149,8 +1149,7 @@ _bfd_coff_final_link (bfd *abfd,
  #error Change H_PUT_32 above
 #endif
 
-      if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
-	  != STRING_SIZE_SIZE)
+      if (bfd_write (strbuf, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
 	return false;
 
       if (! _bfd_stringtab_emit (abfd, flaginfo.strtab))
@@ -1877,7 +1876,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 		      pos = obj_sym_filepos (output_bfd);
 		      pos += flaginfo->last_file_index * osymesz;
 		      if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
-			  || bfd_bwrite (outsym, osymesz, output_bfd) != osymesz)
+			  || bfd_write (outsym, osymesz, output_bfd) != osymesz)
 			return false;
 		    }
 		}
@@ -2119,7 +2118,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 			      pos = obj_sym_filepos (output_bfd);
 			      pos += flaginfo->last_bf_index * osymesz;
 			      if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
-				  || (bfd_bwrite (outsym, osymesz, output_bfd)
+				  || (bfd_write (outsym, osymesz, output_bfd)
 				      != osymesz))
 				return false;
 			    }
@@ -2185,7 +2184,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 	    continue;
 
 	  if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0
-	      || bfd_bread (flaginfo->linenos, linesz * o->lineno_count,
+	      || bfd_read (flaginfo->linenos, linesz * o->lineno_count,
 			   input_bfd) != linesz * o->lineno_count)
 	    return false;
 
@@ -2275,7 +2274,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
 	  pos += o->output_section->lineno_count * linesz;
 	  amt = oeline - flaginfo->linenos;
 	  if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
-	      || bfd_bwrite (flaginfo->linenos, amt, output_bfd) != amt)
+	      || bfd_write (flaginfo->linenos, amt, output_bfd) != amt)
 	    return false;
 
 	  o->output_section->lineno_count += amt / linesz;
@@ -2305,7 +2304,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
       pos = obj_sym_filepos (output_bfd) + syment_base * osymesz;
       amt = outsym - flaginfo->outsyms;
       if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
-	  || bfd_bwrite (flaginfo->outsyms, amt, output_bfd) != amt)
+	  || bfd_write (flaginfo->outsyms, amt, output_bfd) != amt)
 	return false;
 
       BFD_ASSERT ((obj_raw_syment_count (output_bfd)
@@ -2670,7 +2669,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
   pos = obj_sym_filepos (output_bfd);
   pos += obj_raw_syment_count (output_bfd) * symesz;
   if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
-      || bfd_bwrite (flaginfo->outsyms, symesz, output_bfd) != symesz)
+      || bfd_write (flaginfo->outsyms, symesz, output_bfd) != symesz)
     {
       flaginfo->failed = true;
       return false;
@@ -2735,7 +2734,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
       bfd_coff_swap_aux_out (output_bfd, auxp, isym.n_type,
 			     isym.n_sclass, (int) i, isym.n_numaux,
 			     flaginfo->outsyms);
-      if (bfd_bwrite (flaginfo->outsyms, symesz, output_bfd) != symesz)
+      if (bfd_write (flaginfo->outsyms, symesz, output_bfd) != symesz)
 	{
 	  flaginfo->failed = true;
 	  return false;
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index 8cf08576c1b..50913efe337 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -523,7 +523,7 @@ corresponds to an actual section in an actual BFD.
 Get the contents of a section.  This is called from
 @samp{bfd_get_section_contents}.  Most targets set this to
 @samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek}
-based on the section's @samp{filepos} field and a @samp{bfd_bread}.  The
+based on the section's @samp{filepos} field and a @samp{bfd_read}.  The
 corresponding field in the target vector is named
 @samp{_bfd_get_section_contents}.
 
@@ -656,7 +656,7 @@ always uses extended name tables anyhow.  The corresponding field in the
 target vector is named @samp{_bfd_truncate_arname}.
 
 @item _write_armap
-Write out the archive symbol table using calls to @samp{bfd_bwrite}.
+Write out the archive symbol table using calls to @samp{bfd_write}.
 This is normally called from the archive @samp{write_contents} routine.
 The corresponding field in the target vector is named @samp{write_armap}
 (no leading underscore).
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 522a4425e61..844f1a5247d 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -2267,7 +2267,7 @@ _bfd_ecoff_set_section_contents (bfd *abfd,
 
   pos = section->filepos + offset;
   if (bfd_seek (abfd, pos, SEEK_SET) != 0
-      || bfd_bwrite (location, count, abfd) != count)
+      || bfd_write (location, count, abfd) != count)
     return false;
 
   return true;
@@ -2472,7 +2472,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
   }
 
   internal_f.f_nscns = 0;
-  if (bfd_seek (abfd, (file_ptr) (filhsz + aoutsz), SEEK_SET) != 0)
+  if (bfd_seek (abfd, filhsz + aoutsz, SEEK_SET) != 0)
     goto error_return;
 
   for (current = abfd->sections;
@@ -2527,7 +2527,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
 						 current->flags);
 
       if (bfd_coff_swap_scnhdr_out (abfd, (void *) &section, buff) == 0
-	  || bfd_bwrite (buff, scnhsz, abfd) != scnhsz)
+	  || bfd_write (buff, scnhsz, abfd) != scnhsz)
 	goto error_return;
 
       if ((section.s_flags & STYP_TEXT) != 0
@@ -2672,15 +2672,15 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
     }
 
   /* Write out the file header and the optional header.  */
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
     goto error_return;
 
   bfd_coff_swap_filehdr_out (abfd, (void *) &internal_f, buff);
-  if (bfd_bwrite (buff, filhsz, abfd) != filhsz)
+  if (bfd_write (buff, filhsz, abfd) != filhsz)
     goto error_return;
 
   bfd_coff_swap_aouthdr_out (abfd, (void *) &internal_a, buff);
-  if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz)
+  if (bfd_write (buff, aoutsz, abfd) != aoutsz)
     goto error_return;
 
   /* Build the external symbol information.  This must be done before
@@ -2796,7 +2796,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
 	  if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0)
 	    goto error_return;
 	  amt = current->reloc_count * external_reloc_size;
-	  if (bfd_bwrite (reloc_buff, amt, abfd) != amt)
+	  if (bfd_write (reloc_buff, amt, abfd) != amt)
 	    goto error_return;
 	  bfd_release (abfd, reloc_buff);
 	  reloc_buff = NULL;
@@ -2822,15 +2822,13 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
     {
       char c;
 
-      if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
-		    SEEK_SET) != 0)
+      if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0)
 	goto error_return;
-      if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0)
+      if (bfd_read (&c, 1, abfd) == 0)
 	c = 0;
-      if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
-		    SEEK_SET) != 0)
+      if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0)
 	goto error_return;
-      if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1)
+      if (bfd_write (&c, 1, abfd) != 1)
 	goto error_return;
     }
 
@@ -2930,13 +2928,13 @@ _bfd_ecoff_slurp_armap (bfd *abfd)
   bfd_size_type amt;
 
   /* Get the name of the first element.  */
-  i = bfd_bread ((void *) nextname, (bfd_size_type) 16, abfd);
+  i = bfd_read (nextname, 16, abfd);
   if (i == 0)
     return true;
   if (i != 16)
     return false;
 
-  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+  if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
     return false;
 
   /* Irix 4.0.5F apparently can use either an ECOFF armap or a
@@ -3166,12 +3164,11 @@ _bfd_ecoff_write_armap (bfd *abfd,
    if (((char *) (&hdr))[i] == '\0')
      (((char *) (&hdr))[i]) = ' ';
 
-  if (bfd_bwrite ((void *) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
-      != sizeof (struct ar_hdr))
+  if (bfd_write (&hdr, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
     return false;
 
   H_PUT_32 (abfd, hashsize, temp);
-  if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4)
+  if (bfd_write (temp, 4, abfd) != 4)
     return false;
 
   hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
@@ -3220,21 +3217,21 @@ _bfd_ecoff_write_armap (bfd *abfd,
       H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4));
     }
 
-  if (bfd_bwrite ((void *) hashtable, symdefsize, abfd) != symdefsize)
+  if (bfd_write (hashtable, symdefsize, abfd) != symdefsize)
     return false;
 
   bfd_release (abfd, hashtable);
 
   /* Now write the strings.  */
   H_PUT_32 (abfd, stringsize, temp);
-  if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4)
+  if (bfd_write (temp, 4, abfd) != 4)
     return false;
   for (i = 0; i < orl_count; i++)
     {
       bfd_size_type len;
 
       len = strlen (*map[i].name) + 1;
-      if (bfd_bwrite ((void *) (*map[i].name), len, abfd) != len)
+      if (bfd_write (*map[i].name, len, abfd) != len)
 	return false;
     }
 
@@ -3242,7 +3239,7 @@ _bfd_ecoff_write_armap (bfd *abfd,
      bug-compatible for DECstation ar we use a null.  */
   if (padit)
     {
-      if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
+      if (bfd_write ("", 1, abfd) != 1)
 	return false;
     }
 
@@ -3908,7 +3905,7 @@ ecoff_indirect_link_order (bfd *output_bfd,
       file_ptr pos = (output_section->rel_filepos
 		      + output_section->reloc_count * external_reloc_size);
       if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
-	  || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd)
+	  || (bfd_write (external_relocs, external_relocs_size, output_bfd)
 	      != external_relocs_size))
 	goto error_return;
       output_section->reloc_count += input_section->reloc_count;
@@ -4115,7 +4112,7 @@ ecoff_reloc_link_order (bfd *output_bfd,
   pos = (output_section->rel_filepos
 	 + output_section->reloc_count * external_reloc_size);
   ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0
-	&& (bfd_bwrite ((void *) rbuf, external_reloc_size, output_bfd)
+	&& (bfd_write (rbuf, external_reloc_size, output_bfd)
 	    == external_reloc_size));
 
   if (ok)
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 5b7acd57a1a..a5803f4b6d3 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1460,7 +1460,7 @@ ecoff_write_symhdr (bfd *abfd,
     goto error_return;
 
   (*swap->swap_hdr_out) (abfd, symhdr, buff);
-  if (bfd_bwrite (buff, swap->external_hdr_size, abfd)
+  if (bfd_write (buff, swap->external_hdr_size, abfd)
       != swap->external_hdr_size)
     goto error_return;
 
@@ -1492,9 +1492,8 @@ bfd_ecoff_write_debug (bfd *abfd,
   BFD_ASSERT (symhdr->offset == 0				\
 	      || (bfd_vma) bfd_tell (abfd) == symhdr->offset);	\
   if (symhdr->count != 0					\
-      && bfd_bwrite (debug->ptr,				\
-		     (bfd_size_type) size * symhdr->count,	\
-		     abfd) != size * symhdr->count)		\
+      && bfd_write (debug->ptr, size * symhdr->count,		\
+		    abfd) != size * symhdr->count)		\
     return false;
 
   WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset);
@@ -1502,8 +1501,7 @@ bfd_ecoff_write_debug (bfd *abfd,
   WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset);
   WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset);
   WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset);
-  WRITE (external_aux, iauxMax, (bfd_size_type) sizeof (union aux_ext),
-	 cbAuxOffset);
+  WRITE (external_aux, iauxMax, sizeof (union aux_ext), cbAuxOffset);
   WRITE (ss, issMax, sizeof (char), cbSsOffset);
   WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset);
   WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset);
@@ -1524,23 +1522,21 @@ ecoff_write_shuffle (bfd *abfd,
 		     void * space)
 {
   struct shuffle *l;
-  unsigned long total;
+  size_t total;
 
   total = 0;
-  for (l = shuffle; l != (struct shuffle *) NULL; l = l->next)
+  for (l = shuffle; l != NULL; l = l->next)
     {
       if (! l->filep)
 	{
-	  if (bfd_bwrite (l->u.memory, (bfd_size_type) l->size, abfd)
-	      != l->size)
+	  if (bfd_write (l->u.memory, l->size, abfd) != l->size)
 	    return false;
 	}
       else
 	{
 	  if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
-	      || bfd_bread (space, (bfd_size_type) l->size,
-			   l->u.file.input_bfd) != l->size
-	      || bfd_bwrite (space, (bfd_size_type) l->size, abfd) != l->size)
+	      || bfd_read (space, l->size, l->u.file.input_bfd) != l->size
+	      || bfd_write (space, l->size, abfd) != l->size)
 	    return false;
 	}
       total += l->size;
@@ -1548,15 +1544,15 @@ ecoff_write_shuffle (bfd *abfd,
 
   if ((total & (swap->debug_align - 1)) != 0)
     {
-      unsigned int i;
+      size_t i;
       bfd_byte *s;
 
       i = swap->debug_align - (total & (swap->debug_align - 1));
-      s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
+      s = bfd_zmalloc (i);
       if (s == NULL && i != 0)
 	return false;
 
-      if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i)
+      if (bfd_write (s, i, abfd) != i)
 	{
 	  free (s);
 	  return false;
@@ -1611,36 +1607,34 @@ bfd_ecoff_write_accumulated_debug (void * handle,
       bfd_byte null;
       struct string_hash_entry *sh;
 
-      BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL);
+      BFD_ASSERT (ainfo->ss == NULL);
       null = 0;
-      if (bfd_bwrite (&null, (bfd_size_type) 1, abfd) != 1)
+      if (bfd_write (&null, 1, abfd) != 1)
 	goto error_return;
       total = 1;
       BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1);
-      for (sh = ainfo->ss_hash;
-	   sh != (struct string_hash_entry *) NULL;
-	   sh = sh->next)
+      for (sh = ainfo->ss_hash; sh != NULL; sh = sh->next)
 	{
 	  size_t len;
 
 	  len = strlen (sh->root.string);
 	  amt = len + 1;
-	  if (bfd_bwrite (sh->root.string, amt, abfd) != amt)
+	  if (bfd_write (sh->root.string, amt, abfd) != amt)
 	    goto error_return;
 	  total += len + 1;
 	}
 
       if ((total & (swap->debug_align - 1)) != 0)
 	{
-	  unsigned int i;
+	  size_t i;
 	  bfd_byte *s;
 
 	  i = swap->debug_align - (total & (swap->debug_align - 1));
-	  s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
+	  s = bfd_zmalloc (i);
 	  if (s == NULL && i != 0)
 	    goto error_return;
 
-	  if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i)
+	  if (bfd_write (s, i, abfd) != i)
 	    {
 	      free (s);
 	      goto error_return;
@@ -1652,20 +1646,20 @@ bfd_ecoff_write_accumulated_debug (void * handle,
   /* The external strings and symbol are not converted over to using
      shuffles.  FIXME: They probably should be.  */
   amt = debug->symbolic_header.issExtMax;
-  if (amt != 0 && bfd_bwrite (debug->ssext, amt, abfd) != amt)
+  if (amt != 0 && bfd_write (debug->ssext, amt, abfd) != amt)
     goto error_return;
   if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0)
     {
-      unsigned int i;
+      size_t i;
       bfd_byte *s;
 
       i = (swap->debug_align
 	   - (debug->symbolic_header.issExtMax & (swap->debug_align - 1)));
-      s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
+      s = bfd_zmalloc (i);
       if (s == NULL && i != 0)
 	goto error_return;
 
-      if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i)
+      if (bfd_write (s, i, abfd) != i)
 	{
 	  free (s);
 	  goto error_return;
@@ -1682,7 +1676,7 @@ bfd_ecoff_write_accumulated_debug (void * handle,
 		  == (bfd_vma) bfd_tell (abfd)));
 
   amt = debug->symbolic_header.iextMax * swap->external_ext_size;
-  if (amt != 0 && bfd_bwrite (debug->external_ext, amt, abfd) != amt)
+  if (amt != 0 && bfd_write (debug->external_ext, amt, abfd) != amt)
     goto error_return;
 
   free (space);
@@ -2520,8 +2514,7 @@ ecoff_collect_shuffle (struct shuffle *l, bfd_byte *buff)
       else
 	{
 	  if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
-	      || (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd)
-		  != l->size))
+	      || bfd_read (buff, l->size, l->u.file.input_bfd) != l->size)
 	    return false;
 	}
       buff += l->size;
diff --git a/bfd/elf-nacl.c b/bfd/elf-nacl.c
index b021bba9afc..f701af6e657 100644
--- a/bfd/elf-nacl.c
+++ b/bfd/elf-nacl.c
@@ -348,7 +348,7 @@ nacl_final_write_processing (bfd *abfd)
 
 	if (fill == NULL
 	    || bfd_seek (abfd, sec->filepos, SEEK_SET) != 0
-	    || bfd_bwrite (fill, sec->size, abfd) != sec->size)
+	    || bfd_write (fill, sec->size, abfd) != sec->size)
 	  {
 	    /* We don't have a proper way to report an error here.  So
 	       instead fudge things so that elf_write_shdrs_and_ehdr will
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index 6925bc9de0c..5de5af73bb4 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -315,7 +315,7 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
   bfd_size_type off = 1;
   size_t i;
 
-  if (bfd_bwrite ("", 1, abfd) != 1)
+  if (bfd_write ("", 1, abfd) != 1)
     return false;
 
   for (i = 1; i < tab->size; ++i)
@@ -329,7 +329,7 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
 	continue;
 
       str = tab->array[i]->root.string;
-      if (bfd_bwrite (str, len, abfd) != len)
+      if (bfd_write (str, len, abfd) != len)
 	return false;
 
       off += len;
diff --git a/bfd/elf.c b/bfd/elf.c
index d38e0afff2e..c797c11d62d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -460,7 +460,7 @@ bfd_elf_get_elf_syms (bfd *ibfd,
     }
   if (extsym_buf == NULL
       || bfd_seek (ibfd, pos, SEEK_SET) != 0
-      || bfd_bread (extsym_buf, amt, ibfd) != amt)
+      || bfd_read (extsym_buf, amt, ibfd) != amt)
     {
       intsym_buf = NULL;
       goto out;
@@ -484,7 +484,7 @@ bfd_elf_get_elf_syms (bfd *ibfd,
 	}
       if (extshndx_buf == NULL
 	  || bfd_seek (ibfd, pos, SEEK_SET) != 0
-	  || bfd_bread (extshndx_buf, amt, ibfd) != amt)
+	  || bfd_read (extshndx_buf, amt, ibfd) != amt)
 	{
 	  intsym_buf = NULL;
 	  goto out;
@@ -2133,8 +2133,7 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr,
 				 NULL);
       if (filepos == (file_ptr) -1
 	  || bfd_seek (abfd, filepos, SEEK_SET) != 0
-	  || (bfd_bread (nb, 2 * hash_ent_size, abfd)
-	      != (2 * hash_ent_size)))
+	  || bfd_read (nb, 2 * hash_ent_size, abfd) != 2 * hash_ent_size)
 	goto error_return;
 
       /* The number of dynamic symbol table entries equals the number
@@ -2163,7 +2162,7 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr,
 				 sizeof (nb), NULL);
       if (filepos == (file_ptr) -1
 	  || bfd_seek (abfd, filepos, SEEK_SET) != 0
-	  || bfd_bread (nb, sizeof (nb), abfd) != sizeof (nb))
+	  || bfd_read (nb, sizeof (nb), abfd) != sizeof (nb))
 	goto error_return;
 
       ngnubuckets = bfd_get_32 (abfd, nb);
@@ -2210,7 +2209,7 @@ _bfd_elf_get_dynamic_symbols (bfd *abfd, Elf_Internal_Phdr *phdr,
 
       do
 	{
-	  if (bfd_bread (nb, 4, abfd) != 4)
+	  if (bfd_read (nb, 4, abfd) != 4)
 	    goto error_return;
 	  ++maxchain;
 	  if (maxchain == 0)
@@ -7302,7 +7301,7 @@ _bfd_elf_write_object_contents (bfd *abfd)
 	  bfd_size_type amt = i_shdrp[count]->sh_size;
 
 	  if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0
-	      || bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt)
+	      || bfd_write (i_shdrp[count]->contents, amt, abfd) != amt)
 	    return false;
 	}
     }
@@ -13819,8 +13818,7 @@ _bfd_elf_slurp_secondary_reloc_section (bfd *       abfd,
 	    }
 
 	  if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
-	      || (bfd_bread (native_relocs, hdr->sh_size, abfd)
-		  != hdr->sh_size))
+	      || bfd_read (native_relocs, hdr->sh_size, abfd) != hdr->sh_size)
 	    {
 	      free (native_relocs);
 	      /* The internal_relocs will be freed when
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index ccee076555f..5622aaa30c0 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1641,7 +1641,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info)
 	}
 
       if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0
-	  || (bfd_bread (buffer, length, ibfd) != length))
+	  || (bfd_read (buffer, length, ibfd) != length))
 	{
 	  /* xgettext:c-format */
 	  error_message = _("unable to read in %s section from %pB");
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 8e1abb39104..c181523a85f 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2720,7 +2720,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int sec_index,
 
       if (bfd_seek (abfd, hdr->p_offset, SEEK_SET) != 0)
 	return false;
-      if (bfd_bread (&sig, 4, abfd) != 4)
+      if (bfd_read (&sig, 4, abfd) != 4)
 	return false;
 
       elf_tdata (abfd)->core->signal = sig;
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index a260c7ee6d8..28d30692b7d 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -4703,7 +4703,7 @@ elf64_vms_write_shdrs_and_ehdr (bfd *abfd)
   bfd_putl64 (elf_ia64_vms_tdata (abfd)->needed_count, needed_count);
 
   if (bfd_seek (abfd, sizeof (Elf64_External_Ehdr), SEEK_SET) != 0
-      || bfd_bwrite (needed_count, 8, abfd) != 8)
+      || bfd_write (needed_count, 8, abfd) != 8)
     return false;
 
   return true;
@@ -4724,7 +4724,7 @@ elf64_vms_close_and_cleanup (bfd *abfd)
 	  uint64_t pad = 0;
 
 	  bfd_seek (abfd, isize, SEEK_SET);
-	  bfd_bwrite (&pad, ishort, abfd);
+	  bfd_write (&pad, ishort, abfd);
 	}
     }
 
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index b2277921680..92e727b73e7 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -529,7 +529,7 @@ elf_object_p (bfd *abfd)
 
   /* Read in the ELF header in external format.  */
 
-  if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
+  if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	goto got_wrong_format_error;
@@ -642,7 +642,7 @@ elf_object_p (bfd *abfd)
 
       /* Read the first section header at index 0, and convert to internal
 	 form.  */
-      if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+      if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
 	goto got_no_match;
       elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
 
@@ -688,7 +688,7 @@ elf_object_p (bfd *abfd)
 
 	  if (bfd_seek (abfd, where, SEEK_SET) != 0)
 	    goto got_no_match;
-	  if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+	  if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
 	    goto got_no_match;
 
 	  /* Back to where we were.  */
@@ -730,7 +730,7 @@ elf_object_p (bfd *abfd)
 	 to internal form.  */
       for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
 	{
-	  if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+	  if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
 	    goto got_no_match;
 	  elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
 
@@ -817,7 +817,7 @@ elf_object_p (bfd *abfd)
 	= (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
       if (elf_tdata (abfd)->phdr == NULL)
 	goto got_no_match;
-      if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
+      if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
 	goto got_no_match;
       bool eu_strip_broken_phdrs = false;
       i_phdr = elf_tdata (abfd)->phdr;
@@ -825,7 +825,7 @@ elf_object_p (bfd *abfd)
 	{
 	  Elf_External_Phdr x_phdr;
 
-	  if (bfd_bread (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
+	  if (bfd_read (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
 	    goto got_no_match;
 	  elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
 	  /* Too much code in BFD relies on alignment being a power of
@@ -1082,7 +1082,7 @@ elf_write_out_phdrs (bfd *abfd,
       Elf_External_Phdr extphdr;
 
       elf_swap_phdr_out (abfd, phdr, &extphdr);
-      if (bfd_bwrite (&extphdr, sizeof (Elf_External_Phdr), abfd)
+      if (bfd_write (&extphdr, sizeof (Elf_External_Phdr), abfd)
 	  != sizeof (Elf_External_Phdr))
 	return -1;
       phdr++;
@@ -1112,8 +1112,8 @@ elf_write_shdrs_and_ehdr (bfd *abfd)
 #endif
   elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
   amt = sizeof (x_ehdr);
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
-      || bfd_bwrite (&x_ehdr, amt, abfd) != amt)
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0
+      || bfd_write (&x_ehdr, amt, abfd) != amt)
     return false;
 
   if ((abfd->flags & BFD_NO_SECTION_HEADER) != 0)
@@ -1146,8 +1146,8 @@ elf_write_shdrs_and_ehdr (bfd *abfd)
       elf_swap_shdr_out (abfd, *i_shdrp, x_shdrp + count);
     }
   amt = (bfd_size_type) i_ehdrp->e_shnum * sizeof (*x_shdrp);
-  if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
-      || bfd_bwrite (x_shdrp, amt, abfd) != amt)
+  if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0
+      || bfd_write (x_shdrp, amt, abfd) != amt)
     return false;
 
   /* need to dump the string table too...  */
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 77c240caafa..543f40b7774 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -95,7 +95,7 @@ elf_core_file_p (bfd *abfd)
   ufile_ptr filesize;
 
   /* Read in the ELF header in external format.  */
-  if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
+  if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	goto wrong;
@@ -185,7 +185,7 @@ elf_core_file_p (bfd *abfd)
 
       /* Read the first section header at index 0, and convert to internal
 	 form.  */
-      if (bfd_bread (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr))
+      if (bfd_read (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr))
 	goto fail;
       elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
 
@@ -217,12 +217,12 @@ elf_core_file_p (bfd *abfd)
 
       if (bfd_seek (abfd, where, SEEK_SET) != 0)
 	goto fail;
-      if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
+      if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
 	goto fail;
     }
 
   /* Move to the start of the program headers.  */
-  if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
+  if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
     goto wrong;
 
   /* Allocate space for the program headers.  */
@@ -238,7 +238,7 @@ elf_core_file_p (bfd *abfd)
     {
       Elf_External_Phdr x_phdr;
 
-      if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
+      if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
 	goto fail;
 
       elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
@@ -315,7 +315,7 @@ NAME(_bfd_elf, core_find_build_id)
     goto fail;
 
   /* Read in the ELF header in external format.  */
-  if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
+  if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
     {
       if (bfd_get_error () != bfd_error_system_call)
 	goto wrong;
@@ -367,7 +367,7 @@ NAME(_bfd_elf, core_find_build_id)
   if (i_phdr == NULL)
     goto fail;
 
-  if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff), SEEK_SET) != 0)
+  if (bfd_seek (abfd, offset + i_ehdr.e_phoff, SEEK_SET) != 0)
     goto fail;
 
   /* Read in program headers and parse notes.  */
@@ -375,7 +375,7 @@ NAME(_bfd_elf, core_find_build_id)
     {
       Elf_External_Phdr x_phdr;
 
-      if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
+      if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
 	goto fail;
       elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
 
@@ -385,8 +385,8 @@ NAME(_bfd_elf, core_find_build_id)
 			  i_phdr->p_filesz, i_phdr->p_align);
 
 	  /* Make sure ABFD returns to processing the program headers.  */
-	  if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff
-					  + (i + 1) * sizeof (x_phdr)),
+	  if (bfd_seek (abfd,
+			offset + i_ehdr.e_phoff + (i + 1) * sizeof (x_phdr),
 			SEEK_SET) != 0)
 	    goto fail;
 
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 7217c2f038b..c4f286e3d90 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2651,7 +2651,7 @@ elf_link_read_relocs_from_section (bfd *abfd,
     return false;
 
   /* Read the relocations.  */
-  if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
+  if (bfd_read (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
     return false;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -10188,7 +10188,7 @@ elf_link_swap_symbols_out (struct elf_final_link_info *flinfo)
   pos = hdr->sh_offset + hdr->sh_size;
   amt = bed->s->sizeof_sym * flinfo->output_bfd->symcount;
   if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0
-      && bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt)
+      && bfd_write (symbuf, amt, flinfo->output_bfd) == amt)
     {
       hdr->sh_size += amt;
       ret = true;
@@ -13071,7 +13071,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
 							       off, true);
 
 	      if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
-		  || (bfd_bwrite (flinfo.symshndxbuf, amt, abfd) != amt))
+		  || (bfd_write (flinfo.symshndxbuf, amt, abfd) != amt))
 		{
 		  ret = false;
 		  goto return_local_hash_table;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 1e9851c3190..92dd4c20a7d 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7355,7 +7355,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
 		    SEEK_SET) != 0)
 	return false;
       H_PUT_32 (abfd, elf_gp (abfd), buf);
-      if (bfd_bwrite (buf, 4, abfd) != 4)
+      if (bfd_write (buf, 4, abfd) != 4)
 	return false;
     }
 
@@ -7403,7 +7403,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
 			     SEEK_SET) != 0)
 		return false;
 	      H_PUT_64 (abfd, elf_gp (abfd), buf);
-	      if (bfd_bwrite (buf, 8, abfd) != 8)
+	      if (bfd_write (buf, 8, abfd) != 8)
 		return false;
 	    }
 	  else if (intopt.kind == ODK_REGINFO)
@@ -7418,7 +7418,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
 			    SEEK_SET) != 0)
 		return false;
 	      H_PUT_32 (abfd, elf_gp (abfd), buf);
-	      if (bfd_bwrite (buf, 4, abfd) != 4)
+	      if (bfd_write (buf, 4, abfd) != 4)
 		return false;
 	    }
 	  l += intopt.size;
diff --git a/bfd/format.c b/bfd/format.c
index c790f86d202..66dc2e7e51e 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -359,7 +359,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
   /* If the target type was explicitly specified, just check that target.  */
   if (!abfd->target_defaulted)
     {
-      if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)	/* rewind! */
+      if (bfd_seek (abfd, 0, SEEK_SET) != 0)	/* rewind! */
 	goto err_ret;
 
       cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -425,7 +425,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
       /* Change BFD's target temporarily.  */
       abfd->xvec = *target;
 
-      if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+      if (bfd_seek (abfd, 0, SEEK_SET) != 0)
 	goto err_ret;
 
       cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -573,7 +573,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
 	{
 	  bfd_reinit (abfd, initial_section_id, &preserve, cleanup);
 	  bfd_release (abfd, preserve.marker);
-	  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+	  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
 	    goto err_ret;
 	  cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
 	  BFD_ASSERT (cleanup != NULL);
diff --git a/bfd/hash.c b/bfd/hash.c
index 483593eb6f0..c14921a9e49 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -1119,8 +1119,8 @@ _bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab)
 	  bfd_byte buf[4];
 
 	  /* The output length includes the null byte.  */
-	  bfd_put_32 (abfd, (bfd_vma) len, buf);
-	  if (bfd_bwrite ((void *) buf, (bfd_size_type) 4, abfd) != 4)
+	  bfd_put_32 (abfd, len, buf);
+	  if (bfd_write (buf, 4, abfd) != 4)
 	    return false;
 	}
       else if (tab->length_field_size == 2)
@@ -1128,12 +1128,12 @@ _bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab)
 	  bfd_byte buf[2];
 
 	  /* The output length includes the null byte.  */
-	  bfd_put_16 (abfd, (bfd_vma) len, buf);
-	  if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2)
+	  bfd_put_16 (abfd, len, buf);
+	  if (bfd_write (buf, 2, abfd) != 2)
 	    return false;
 	}
 
-      if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len)
+      if (bfd_write (str, len, abfd) != len)
 	return false;
     }
 
diff --git a/bfd/hppabsd-core.c b/bfd/hppabsd-core.c
index b9abc1a539b..4410db7cc6f 100644
--- a/bfd/hppabsd-core.c
+++ b/bfd/hppabsd-core.c
@@ -100,7 +100,7 @@ hppabsd_core_core_file_p (bfd *abfd)
 
   /* Try to read in the u-area.  We will need information from this
      to know how to grok the rest of the core structures.  */
-  val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd);
+  val = bfd_read (&u, sizeof u, abfd);
   if (val != sizeof u)
     {
       if (bfd_get_error () != bfd_error_system_call)
diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c
index a165da48a57..f9603f5ffed 100644
--- a/bfd/hpux-core.c
+++ b/bfd/hpux-core.c
@@ -161,8 +161,7 @@ hpux_core_core_file_p (bfd *abfd)
       int val;
       struct corehead core_header;
 
-      val = bfd_bread ((void *) &core_header,
-		      (bfd_size_type) sizeof core_header, abfd);
+      val = bfd_read (&core_header, sizeof core_header, abfd);
       if (val <= 0)
 	break;
       switch (core_header.type)
@@ -170,14 +169,13 @@ hpux_core_core_file_p (bfd *abfd)
 	case CORE_KERNEL:
 	case CORE_FORMAT:
 	  /* Just skip this.  */
-	  bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR);
+	  bfd_seek (abfd, core_header.len, SEEK_CUR);
 	  good_sections++;
 	  break;
 	case CORE_EXEC:
 	  {
 	    struct proc_exec proc_exec;
-	    if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len,
-			  abfd) != core_header.len)
+	    if (bfd_read (&proc_exec, core_header.len, abfd) != core_header.len)
 	      break;
 	    strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1);
 	    good_sections++;
@@ -191,13 +189,12 @@ hpux_core_core_file_p (bfd *abfd)
 	    /* We need to read this section, 'cause we need to determine
 	       whether the core-dumped app was threaded before we create
 	       any .reg sections. */
-	    if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd)
-		!= core_header.len)
+	    if (bfd_read (&proc_info, core_header.len, abfd) != core_header.len)
 	      break;
 
 	      /* However, we also want to create those sections with the
 		 file positioned at the start of the record, it seems. */
-	    if (bfd_seek (abfd, -((file_ptr) core_header.len), SEEK_CUR) != 0)
+	    if (bfd_seek (abfd, -(file_ptr) core_header.len, SEEK_CUR) != 0)
 	      break;
 
 #if defined(PROC_INFO_HAS_THREAD_ID)
diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c
index 1df85bd881f..c2eded8dfb6 100644
--- a/bfd/i386lynx.c
+++ b/bfd/i386lynx.c
@@ -34,48 +34,46 @@
 #include "libbfd.h"
 
 #ifndef WRITE_HEADERS
-#define WRITE_HEADERS(abfd, execp)					      \
-      {									      \
-	if (adata(abfd).magic == undecided_magic)			      \
-	  NAME(aout,adjust_sizes_and_vmas) (abfd);			      \
-									      \
-	execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;	      \
-	execp->a_entry = bfd_get_start_address (abfd);			      \
-									      \
-	execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *		      \
-			   obj_reloc_entry_size (abfd));		      \
-	execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *		      \
-			   obj_reloc_entry_size (abfd));		      \
-	NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);	      \
-									      \
-	if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0		      \
-	    || bfd_bwrite (&exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
-			  abfd) != EXEC_BYTES_SIZE)			      \
-	  return false;							      \
-	/* Now write out reloc info, followed by syms and strings */	      \
-									      \
-	if (bfd_get_symcount (abfd) != 0)				      \
-	    {								      \
-	      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET)    \
-		  != 0)							      \
-		return false;						      \
-									      \
-	      if (! NAME(aout,write_syms) (abfd)) return false;		      \
-									      \
-	      if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET)   \
-		  != 0)							      \
-		return false;						      \
-									      \
-	      if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd)))   \
-		return false;						      \
-	      if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET)   \
-		  != 0)							      \
-		return 0;						      \
-									      \
-	      if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd)))   \
-		return false;						      \
-	    }								      \
-      }
+#define WRITE_HEADERS(abfd, execp)					\
+  {									\
+    if (adata(abfd).magic == undecided_magic)				\
+      NAME (aout, adjust_sizes_and_vmas) (abfd);			\
+									\
+    execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;	\
+    execp->a_entry = bfd_get_start_address (abfd);			\
+									\
+    execp->a_trsize = ((obj_textsec (abfd)->reloc_count)		\
+		       * obj_reloc_entry_size (abfd));			\
+    execp->a_drsize = ((obj_datasec (abfd)->reloc_count)		\
+		       * obj_reloc_entry_size (abfd));			\
+    NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes);	\
+									\
+    if (bfd_seek (abfd, 0, SEEK_SET) != 0				\
+	|| bfd_write (&exec_bytes, EXEC_BYTES_SIZE,			\
+		      abfd) != EXEC_BYTES_SIZE)				\
+      return false;							\
+    /* Now write out reloc info, followed by syms and strings.  */	\
+									\
+    if (bfd_get_outsymbols (abfd) != NULL				\
+	&& bfd_get_symcount (abfd) != 0)				\
+      {									\
+	if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0)		\
+	  return false;							\
+									\
+	if (! NAME (aout, write_syms) (abfd))				\
+	  return false;							\
+      }									\
+									\
+    if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0)		\
+      return false;							\
+    if (!NAME (lynx, squirt_out_relocs) (abfd, obj_textsec (abfd)))	\
+      return false;							\
+									\
+    if (bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0)		\
+      return false;							\
+    if (!NAME (lynx, squirt_out_relocs) (abfd, obj_datasec (abfd)))	\
+      return false;							\
+  }
 #endif
 
 #include "libaout.h"
@@ -494,7 +492,7 @@ NAME(lynx,squirt_out_relocs) (bfd *abfd, asection *section)
 	NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr);
     }
 
-  if (bfd_bwrite (native, natsize, abfd) != natsize)
+  if (bfd_write (native, natsize, abfd) != natsize)
     {
       bfd_release (abfd, native);
       return false;
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 49e566d9932..5d8788fcc84 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -49,8 +49,8 @@ msdos_object_p (bfd *abfd)
   asection *section;
   bfd_size_type size;
 
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
-      || (size = bfd_bread (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1)
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0
+      || (size = bfd_read (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1)
     {
       if (bfd_get_error () != bfd_error_system_call)
 	bfd_set_error (bfd_error_wrong_format);
@@ -71,7 +71,7 @@ msdos_object_p (bfd *abfd)
       || H_GET_16 (abfd, hdr.e_cparhdr) < 4)
     ;
   else if (bfd_seek (abfd, H_GET_32 (abfd, hdr.e_lfanew), SEEK_SET) != 0
-	   || bfd_bread (buffer, (bfd_size_type) 2, abfd) != 2)
+	   || bfd_read (buffer, 2, abfd) != 2)
     {
       if (bfd_get_error () == bfd_error_system_call)
 	return NULL;
@@ -179,8 +179,8 @@ msdos_write_object_contents (bfd *abfd)
      The program's crt0 code must relocate it to a real stack.  */
   H_PUT_16 (abfd, high_vma, &hdr[16]);
 
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
-      || bfd_bwrite (hdr, (bfd_size_type) sizeof(hdr), abfd) != sizeof(hdr))
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0
+      || bfd_write (hdr, sizeof (hdr), abfd) != sizeof (hdr))
     return false;
 
   return true;
@@ -202,7 +202,7 @@ msdos_set_section_contents (bfd *abfd,
   if (bfd_section_flags (section) & SEC_LOAD)
     {
       if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
-	  || bfd_bwrite (location, count, abfd) != count)
+	  || bfd_write (location, count, abfd) != count)
 	return false;
     }
 
diff --git a/bfd/ihex.c b/bfd/ihex.c
index d038b0a94be..f610dd1a528 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -194,14 +194,14 @@ ihex_get_byte (bfd *abfd, bool *errorptr)
 {
   bfd_byte c;
 
-  if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
+  if (bfd_read (&c, 1, abfd) != 1)
     {
       if (bfd_get_error () != bfd_error_file_truncated)
 	*errorptr = true;
       return EOF;
     }
 
-  return (int) (c & 0xff);
+  return c & 0xff;
 }
 
 /* Report a problem in an Intel Hex file.  */
@@ -248,7 +248,7 @@ ihex_scan (bfd *abfd)
   size_t bufsize;
   int c;
 
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
     goto error_return;
 
   abfd->start_address = 0;
@@ -289,7 +289,7 @@ ihex_scan (bfd *abfd)
 	  pos = bfd_tell (abfd) - 1;
 
 	  /* Read the header bytes.  */
-	  if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
+	  if (bfd_read (hdr, 8, abfd) != 8)
 	    goto error_return;
 
 	  for (i = 0; i < 8; i++)
@@ -309,13 +309,13 @@ ihex_scan (bfd *abfd)
 	  chars = len * 2 + 2;
 	  if (chars >= bufsize)
 	    {
-	      buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
+	      buf = bfd_realloc (buf, chars);
 	      if (buf == NULL)
 		goto error_return;
 	      bufsize = chars;
 	    }
 
-	  if (bfd_bread (buf, (bfd_size_type) chars, abfd) != chars)
+	  if (bfd_read (buf, chars, abfd) != chars)
 	    goto error_return;
 
 	  for (i = 0; i < chars; i++)
@@ -493,9 +493,9 @@ ihex_object_p (bfd *abfd)
 
   ihex_init ();
 
-  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+  if (bfd_seek (abfd, 0, SEEK_SET) != 0)
     return NULL;
-  if (bfd_bread (b, (bfd_size_type) 9, abfd) != 9)
+  if (bfd_read (b, 9, abfd) != 9)
     {
       if (bfd_get_error () == bfd_error_file_truncated)
 	bfd_set_error (bfd_error_wrong_format);
@@ -568,7 +568,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
 	 know the exact format.  */
       BFD_ASSERT (c == ':');
 
-      if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
+      if (bfd_read (hdr, 8, abfd) != 8)
 	goto error_return;
 
       len = HEX2 (hdr);
@@ -585,13 +585,13 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
 
       if (len * 2 > bufsize)
 	{
-	  buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
+	  buf = bfd_realloc (buf, len * 2);
 	  if (buf == NULL)
 	    goto error_return;
 	  bufsize = len * 2;
 	}
 
-      if (bfd_bread (buf, (bfd_size_type) len * 2, abfd) != len * 2)
+      if (bfd_read (buf, len * 2, abfd) != len * 2)
 	goto error_return;
 
       for (i = 0; i < len; i++)
@@ -604,7 +604,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
 	}
 
       /* Skip the checksum.  */
-      if (bfd_bread (buf, (bfd_size_type) 2, abfd) != 2)
+      if (bfd_read (buf, 2, abfd) != 2)
 	goto error_return;
     }
 
@@ -745,7 +745,7 @@ ihex_write_record (bfd *abfd,
   p[3] = '\n';
 
   total = 9 + count * 2 + 4;
-  if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total)
+  if (bfd_write (buf, total, abfd) != total)
     return false;
 
   return true;
diff --git a/bfd/irix-core.c b/bfd/irix-core.c
index f32ebeab956..fe564e42fb0 100644
--- a/bfd/irix-core.c
+++ b/bfd/irix-core.c
@@ -61,7 +61,7 @@ do_sections64 (bfd *abfd, struct coreout *coreout)
 
   for (i = 0; i < coreout->c_nvmap; i++)
     {
-      val = bfd_bread (&vmap, (bfd_size_type) sizeof vmap, abfd);
+      val = bfd_read (&vmap, sizeof vmap, abfd);
       if (val != sizeof vmap)
 	break;
 
@@ -109,7 +109,7 @@ do_sections (bfd *abfd, struct coreout *coreout)
 
   for (i = 0; i < coreout->c_nvmap; i++)
     {
-      val = bfd_bread (&vmap, (bfd_size_type) sizeof vmap, abfd);
+      val = bfd_read (&vmap, sizeof vmap, abfd);
       if (val != sizeof vmap)
 	break;
 
@@ -174,7 +174,7 @@ irix_core_core_file_p (bfd *abfd)
   struct idesc *idg, *idf, *ids;
   size_t amt;
 
-  val = bfd_bread (&coreout, (bfd_size_type) sizeof coreout, abfd);
+  val = bfd_read (&coreout, sizeof coreout, abfd);
   if (val != sizeof coreout)
     {
       if (bfd_get_error () != bfd_error_system_call)
diff --git a/bfd/libaout.h b/bfd/libaout.h
index 20487af1f4f..5491d9bd084 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -619,46 +619,46 @@ extern bool [...]

[diff truncated at 100000 bytes]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-08 23:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 23:25 [binutils-gdb] Rename bfd_bread and bfd_bwrite Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).