]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file: use 64 bit offset to support large files
authorVMware, Inc <>
Thu, 2 Aug 2012 06:52:15 +0000 (23:52 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Thu, 2 Aug 2012 18:23:08 +0000 (11:23 -0700)
Quick fix to call 64 bit offset version of preadv and pwritev.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/file/fileIOPosix.c

index 0f44eb967fd1fe2ff9ca2a557ce226f6a1ce8564..524a29abbc597e17d29ccbf93adda26562e3c1f7 100644 (file)
@@ -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);