From: VMware, Inc <> Date: Thu, 2 Aug 2012 06:52:15 +0000 (-0700) Subject: lib/file: use 64 bit offset to support large files X-Git-Tag: 2012.10.14-874563~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2189f80e5c527daaada9ef4183d383a4d698124a;p=thirdparty%2Fopen-vm-tools.git lib/file: use 64 bit offset to support large files Quick fix to call 64 bit offset version of preadv and pwritev. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/file/fileIOPosix.c b/open-vm-tools/lib/file/fileIOPosix.c index 0f44eb967..524a29abb 100644 --- a/open-vm-tools/lib/file/fileIOPosix.c +++ b/open-vm-tools/lib/file/fileIOPosix.c @@ -217,12 +217,15 @@ static AlignedPool alignedPool; */ #if defined(__linux__) - -extern ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, - off_t offset) __attribute__ ((weak)); -extern ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, - off_t offset) __attribute__ ((weak)); - + #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) + extern ssize_t preadv64(int fd, const struct iovec *iov, int iovcnt, + off64_t offset) __attribute__ ((weak)); + + extern ssize_t pwritev64(int fd, const struct iovec *iov, int iovcnt, + off64_t offset) __attribute__ ((weak)); + #else + #error "Large file support unavailable. Aborting." + #endif #endif /* defined(__linux__) */ /* @@ -1965,8 +1968,8 @@ FileIOPreadvInternal(FileIODescriptor *fd, // IN: File descriptor ssize_t retval = 0; ASSERT(numVec > 0); - if (preadv != NULL) { - retval = preadv(fd->posix, vPtr, numVec, offset); + if (preadv64 != NULL) { + retval = preadv64(fd->posix, vPtr, numVec, offset); } else { fret = FileIOPreadvCoalesced(fd, entries, numEntries, offset, totalSize); @@ -2084,8 +2087,8 @@ FileIOPwritevInternal(FileIODescriptor *fd, // IN: File descriptor ASSERT(numVec > 0); - if (pwritev != NULL) { - retval = pwritev(fd->posix, vPtr, numVec, offset); + if (pwritev64 != NULL) { + retval = pwritev64(fd->posix, vPtr, numVec, offset); } else { fret = FileIOPwritevCoalesced(fd, entries, numEntries, offset, totalSize);