author | Frank Chen <frank.chen@amlogic.com> | 2014-10-24 07:44:32 (GMT) |
---|---|---|
committer | Frank Chen <frank.chen@amlogic.com> | 2014-12-18 05:28:40 (GMT) |
commit | ae3fe1baa3849d43869390b28e97a96009d702eb (patch) | |
tree | 45090b65be06ae318a84a7f9a8fe22962af5828b | |
parent | 7b2fc691a12c79b422bdaca5f72b9bed317c0480 (diff) | |
download | ntfs-3g-ae3fe1baa3849d43869390b28e97a96009d702eb.zip ntfs-3g-ae3fe1baa3849d43869390b28e97a96009d702eb.tar.gz ntfs-3g-ae3fe1baa3849d43869390b28e97a96009d702eb.tar.bz2 |
PD #100988 off_t --> loff_t to fix >2G file access
Change-Id: I712a53e0645d971e917147517bd18e8b4dd7653b
-rw-r--r-- | config.h | 6 | ||||
-rwxr-xr-x | libntfs-3g/unix_io.c | 18 |
2 files changed, 23 insertions, 1 deletions
@@ -1,3 +1,4 @@ +#include <sys/types.h> /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ @@ -412,6 +413,11 @@ /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ +#ifndef _OFF_T_DEFINED_ +#define _OFF_T_DEFINED_ +#define off_t loff_t +#endif + /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ diff --git a/libntfs-3g/unix_io.c b/libntfs-3g/unix_io.c index 4f2c18b..799db0b 100755 --- a/libntfs-3g/unix_io.c +++ b/libntfs-3g/unix_io.c @@ -61,10 +61,14 @@ #include "logging.h" #include "misc.h" +#ifdef __USE_FILE_OFFSET64 +#include <unistd.h> +#endif + #define DEV_FD(dev) (*(int *)dev->d_private) #ifdef __USE_FILE_OFFSET64 -#include <unistd.h> +#define fcntl __fcntl64 #endif /* Define to nothing if not present on this system. */ @@ -227,7 +231,11 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, int whence) { +#ifdef __USE_FILE_OFFSET64 return lseek64(DEV_FD(dev), offset, whence); +#else + return lseek(DEV_FD(dev), offset, whence); +#endif } /** @@ -281,7 +289,11 @@ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, s64 count, s64 offset) { +#ifdef __USE_FILE_OFFSET64 return pread64(DEV_FD(dev), buf, count, offset); +#else + return pread(DEV_FD(dev), buf, count, offset); +#endif } /** @@ -303,7 +315,11 @@ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, return -1; } NDevSetDirty(dev); +#ifdef __USE_FILE_OFFSET64 return pwrite64(DEV_FD(dev), buf, count, offset); +#else + return pwrite(DEV_FD(dev), buf, count, offset); +#endif } /** |