diff options
author | Colin Cross <ccross@android.com> | 2010-12-22 18:40:14 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-01-05 15:35:58 -0800 |
commit | 33f96c66e9a1f2e266a75e5e84c091dffa6ef118 (patch) | |
tree | 6e9a08128cd925d464bc2bb209f1f1874dc9a11d /ext4_utils/ext4_utils.h | |
parent | 22742ce739a046a079b2e1b03342a25472dfa352 (diff) | |
download | extras-33f96c66e9a1f2e266a75e5e84c091dffa6ef118.tar.gz |
ext4_utils: Add support for >2G input files
Change-Id: I6af69d676610099d3912e90fcab3cbdc27ace4e2
Diffstat (limited to 'ext4_utils/ext4_utils.h')
-rw-r--r-- | ext4_utils/ext4_utils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext4_utils/ext4_utils.h b/ext4_utils/ext4_utils.h index 712fea66..8a6c3c46 100644 --- a/ext4_utils/ext4_utils.h +++ b/ext4_utils/ext4_utils.h @@ -17,6 +17,12 @@ #ifndef _EXT4_UTILS_H_ #define _EXT4_UTILS_H_ +#define _GNU_SOURCE +#define _FILE_OFFSET_BITS 64 +#define _LARGEFILE64_SOURCE +#include <sys/types.h> +#include <unistd.h> + #include <sys/types.h> #include <errno.h> #include <stdarg.h> @@ -24,6 +30,20 @@ #include <stdlib.h> #include <string.h> +#if defined(__APPLE__) && defined(__MACH__) +#define lseek64 lseek +#define off64_t off_t +#endif + +#ifdef __BIONIC__ +extern void* __mmap2(void *, size_t, int, int, int, off_t); +static inline void *mmap64(void *addr, size_t length, int prot, int flags, + int fd, off64_t offset) +{ + return __mmap2(addr, length, prot, flags, fd, offset >> 12); +} +#endif + extern int force; #define warn(fmt, args...) do { fprintf(stderr, "warning: %s: " fmt "\n", __func__, ## args); } while (0) |