]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd: Use size_t in the BFD mmap interface
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 13 Mar 2024 13:45:16 +0000 (06:45 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 13 Mar 2024 13:55:44 +0000 (06:55 -0700)
Change the size type in the BFD mmap interface from bfd_size_type to
size_t to be consistent with the size type of the host mmap interface.

* bfdio.c (bfd_iovec): Change the bmmap size type to size_t.
(bfd_mmap): Likewise.
(memory_bmmap): Likewise.
* cache.c (cache_bmmap): Change the bmmap size type to size_t.
* opncls.c (opncls_bmmap): Change the bmmap size type to size_t.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

bfd/bfd-in2.h
bfd/bfdio.c
bfd/cache.c
bfd/libbfd.h
bfd/opncls.c

index 79b24a7f6e9789422cb7f1b744e1af01a73fde52..29602e054da2d4219324484b7bd8c7f3a125fa8e 100644 (file)
@@ -2768,9 +2768,9 @@ ufile_ptr bfd_get_size (bfd *abfd);
 
 ufile_ptr bfd_get_file_size (bfd *abfd);
 
-void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
+void *bfd_mmap (bfd *abfd, void *addr, size_t len,
     int prot, int flags, file_ptr offset,
-    void **map_addr, bfd_size_type *map_len)
+    void **map_addr, size_t *map_len)
 ATTRIBUTE_WARN_UNUSED_RESULT;
 
 time_t bfd_get_current_time (time_t now);
index 1572de00ad497bb5aef0af54afe8fc27ddfffcca..4ed0eeadc52c7b2d2d6e8cd677899a6d4e79c4e3 100644 (file)
@@ -219,9 +219,9 @@ DESCRIPTION
 .     Also write in MAP_ADDR the address of the page aligned buffer and in
 .     MAP_LEN the size mapped (a page multiple).  Use unmap with MAP_ADDR and
 .     MAP_LEN to unmap.  *}
-.  void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
+.  void *(*bmmap) (struct bfd *abfd, void *addr, size_t len,
 .                 int prot, int flags, file_ptr offset,
-.                 void **map_addr, bfd_size_type *map_len);
+.                 void **map_addr, size_t *map_len);
 .};
 
 .extern const struct bfd_iovec _bfd_memory_iovec;
@@ -638,9 +638,9 @@ FUNCTION
        bfd_mmap
 
 SYNOPSIS
-       void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
+       void *bfd_mmap (bfd *abfd, void *addr, size_t len,
                        int prot, int flags, file_ptr offset,
-                       void **map_addr, bfd_size_type *map_len)
+                       void **map_addr, size_t *map_len)
                        ATTRIBUTE_WARN_UNUSED_RESULT;
 
 DESCRIPTION
@@ -651,9 +651,9 @@ DESCRIPTION
 */
 
 void *
-bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
+bfd_mmap (bfd *abfd, void *addr, size_t len,
          int prot, int flags, file_ptr offset,
-         void **map_addr, bfd_size_type *map_len)
+         void **map_addr, size_t *map_len)
 {
   while (abfd->my_archive != NULL
         && !bfd_is_thin_archive (abfd->my_archive))
@@ -815,10 +815,10 @@ memory_bstat (bfd *abfd, struct stat *statbuf)
 
 static void *
 memory_bmmap (bfd *abfd ATTRIBUTE_UNUSED, void *addr ATTRIBUTE_UNUSED,
-             bfd_size_type len ATTRIBUTE_UNUSED, int prot ATTRIBUTE_UNUSED,
+             size_t len ATTRIBUTE_UNUSED, int prot ATTRIBUTE_UNUSED,
              int flags ATTRIBUTE_UNUSED, file_ptr offset ATTRIBUTE_UNUSED,
              void **map_addr ATTRIBUTE_UNUSED,
-             bfd_size_type *map_len ATTRIBUTE_UNUSED)
+             size_t *map_len ATTRIBUTE_UNUSED)
 {
   return (void *)-1;
 }
index 3bc2afc9f3609b90ada79a498c181cf687aa7be8..d0e7be293a522c2601d3eb1eaf40ae793723d122 100644 (file)
@@ -478,12 +478,12 @@ cache_bstat (struct bfd *abfd, struct stat *sb)
 static void *
 cache_bmmap (struct bfd *abfd ATTRIBUTE_UNUSED,
             void *addr ATTRIBUTE_UNUSED,
-            bfd_size_type len ATTRIBUTE_UNUSED,
+            size_t len ATTRIBUTE_UNUSED,
             int prot ATTRIBUTE_UNUSED,
             int flags ATTRIBUTE_UNUSED,
             file_ptr offset ATTRIBUTE_UNUSED,
             void **map_addr ATTRIBUTE_UNUSED,
-            bfd_size_type *map_len ATTRIBUTE_UNUSED)
+            size_t *map_len ATTRIBUTE_UNUSED)
 {
   void *ret = MAP_FAILED;
 
index a60063b5ae13143955d901d1010a379d0c9d760c..f15b5f27db8cdbbf2ac7ba4aee2eef90b11fadca 100644 (file)
@@ -969,9 +969,9 @@ struct bfd_iovec
      Also write in MAP_ADDR the address of the page aligned buffer and in
      MAP_LEN the size mapped (a page multiple).  Use unmap with MAP_ADDR and
      MAP_LEN to unmap.  */
-  void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
+  void *(*bmmap) (struct bfd *abfd, void *addr, size_t len,
                  int prot, int flags, file_ptr offset,
-                 void **map_addr, bfd_size_type *map_len);
+                 void **map_addr, size_t *map_len);
 };
 extern const struct bfd_iovec _bfd_memory_iovec;
 
index 096672475c4b1c5ae1c68a5d9cf2136a68db6504..c764d20483197c8973d9c503f03032fd4d962bf0 100644 (file)
@@ -668,12 +668,12 @@ opncls_bstat (struct bfd *abfd, struct stat *sb)
 static void *
 opncls_bmmap (struct bfd *abfd ATTRIBUTE_UNUSED,
              void *addr ATTRIBUTE_UNUSED,
-             bfd_size_type len ATTRIBUTE_UNUSED,
+             size_t len ATTRIBUTE_UNUSED,
              int prot ATTRIBUTE_UNUSED,
              int flags ATTRIBUTE_UNUSED,
              file_ptr offset ATTRIBUTE_UNUSED,
              void **map_addr ATTRIBUTE_UNUSED,
-             bfd_size_type *map_len ATTRIBUTE_UNUSED)
+             size_t *map_len ATTRIBUTE_UNUSED)
 {
   return MAP_FAILED;
 }