libelf: Use int64_t for offsets in libelf.h
authorJosh Stone <jistone@redhat.com>
Sat, 10 Oct 2015 00:32:52 +0000 (17:32 -0700)
committerJosh Stone <jistone@redhat.com>
Wed, 14 Oct 2015 16:29:27 +0000 (09:29 -0700)
Some systems don't have loff_t, like FreeBSD where off_t always supports
large files.  We need a standardized 64-bit signed type for the public
header, without depending on configuration... OK, just use int64_t.

Signed-off-by: Josh Stone <jistone@redhat.com>
libelf/ChangeLog
libelf/libelf.h

index af2438b..d8651d7 100644 (file)
@@ -1,3 +1,7 @@
+2015-10-09  Josh Stone  <jistone@redhat.com>
+
+       * libelf.h: Replace loff_t with int64_t throughout.
+
 2015-10-05  Mark Wielaard  <mjw@redhat.com>
 
        * elf_update.c (write_file): Only use posix_fallocate when using
index 5a2b3af..54f7c29 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef _LIBELF_H
 #define _LIBELF_H 1
 
+#include <stdint.h>
 #include <sys/types.h>
 
 /* Get the ELF types.  */
@@ -74,7 +75,7 @@ typedef struct
   Elf_Type d_type;             /* Type of this piece of data.  */
   unsigned int d_version;      /* ELF version.  */
   size_t d_size;               /* Size in bytes.  */
-  loff_t d_off;                        /* Offset into section.  */
+  int64_t d_off;               /* Offset into section.  */
   size_t d_align;              /* Alignment in section.  */
 } Elf_Data;
 
@@ -136,7 +137,7 @@ typedef struct
   uid_t ar_uid;                        /* User ID.  */
   gid_t ar_gid;                        /* Group ID.  */
   mode_t ar_mode;              /* File mode.  */
-  loff_t ar_size;              /* File size.  */
+  int64_t ar_size;             /* File size.  */
   char *ar_rawname;            /* Original name of archive member.  */
 } Elf_Arhdr;
 
@@ -177,13 +178,13 @@ extern Elf_Cmd elf_next (Elf *__elf);
 extern int elf_end (Elf *__elf);
 
 /* Update ELF descriptor and write file to disk.  */
-extern loff_t elf_update (Elf *__elf, Elf_Cmd __cmd);
+extern int64_t elf_update (Elf *__elf, Elf_Cmd __cmd);
 
 /* Determine what kind of file is associated with ELF.  */
 extern Elf_Kind elf_kind (Elf *__elf) __attribute__ ((__pure__));
 
 /* Get the base offset for an object file.  */
-extern loff_t elf_getbase (Elf *__elf);
+extern int64_t elf_getbase (Elf *__elf);
 
 
 /* Retrieve file identification data.  */
@@ -301,7 +302,7 @@ extern Elf_Data *elf_newdata (Elf_Scn *__scn);
    would be for TYPE.  The resulting Elf_Data pointer is valid until
    elf_end (ELF) is called.  */
 extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
-                                      loff_t __offset, size_t __size,
+                                      int64_t __offset, size_t __size,
                                       Elf_Type __type);
 
 
@@ -313,7 +314,7 @@ extern char *elf_strptr (Elf *__elf, size_t __index, size_t __offset);
 extern Elf_Arhdr *elf_getarhdr (Elf *__elf);
 
 /* Return offset in archive for current file ELF.  */
-extern loff_t elf_getaroff (Elf *__elf);
+extern int64_t elf_getaroff (Elf *__elf);
 
 /* Select archive element at OFFSET.  */
 extern size_t elf_rand (Elf *__elf, size_t __offset);