#src: https://git.alpinelinux.org/aports/tree/community/open-vm-tools?id=6e0f65e51bfcd02c53bc2b78f46ed18af2dd7ea0
#upstream: no

From 099ef837922ee97c64651bc49c26022b7a97f816 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 2 Jan 2017 15:25:32 +0000
Subject: [PATCH 11/12] use off64_t instead of loff_t

---
 open-vm-tools/vmhgfs-fuse/file.c   | 12 ++++++------
 open-vm-tools/vmhgfs-fuse/fsutil.c |  2 +-
 open-vm-tools/vmhgfs-fuse/fsutil.h |  8 ++------
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/open-vm-tools/vmhgfs-fuse/file.c b/open-vm-tools/vmhgfs-fuse/file.c
index 389ebba8..d22b66df 100644
--- a/open-vm-tools/vmhgfs-fuse/file.c
+++ b/open-vm-tools/vmhgfs-fuse/file.c
@@ -535,7 +535,7 @@ static int
 HgfsDoRead(HgfsHandle handle,  // IN:  Handle for this file
            char *buf,          // OUT: Buffer to copy data into
            size_t count,       // IN:  Number of bytes to read
-           loff_t offset)      // IN:  Offset at which to read
+           off64_t offset)      // IN:  Offset at which to read
 {
    HgfsReq *req;
    HgfsOp opUsed;
@@ -668,11 +668,11 @@ ssize_t
 HgfsRead(struct fuse_file_info *fi,  // IN:  File info struct
          char  *buf,                 // OUT: User buffer to copy data into
          size_t count,               // IN:  Number of bytes to read
-         loff_t offset)              // IN:  Offset at which to read
+         off64_t offset)              // IN:  Offset at which to read
 {
    int result = 0;
    char *buffer = buf;
-   loff_t curOffset = offset;
+   off64_t curOffset = offset;
    size_t nextCount, remainingCount = count;
 
    ASSERT(NULL != fi);
@@ -729,7 +729,7 @@ static int
 HgfsDoWrite(HgfsHandle handle,       // IN: Handle for the file
             const char *buf,         // IN: Buffer containing data
             size_t count,            // IN: Number of bytes to write
-            loff_t offset)           // IN: Offset to begin writing at
+            off64_t offset)           // IN: Offset to begin writing at
 {
    HgfsReq *req;
    int result = 0;
@@ -853,11 +853,11 @@ ssize_t
 HgfsWrite(struct fuse_file_info *fi,  // IN: File info structure
          const char  *buf,            // OUT: User buffer to copy data into
          size_t count,                // IN:  Number of bytes to read
-         loff_t offset)               // IN:  Offset at which to read
+         off64_t offset)               // IN:  Offset at which to read
 {
    int result;
    const char *buffer = buf;
-   loff_t curOffset = offset;
+   off64_t curOffset = offset;
    size_t nextCount, remainingCount = count;
    ssize_t bytesWritten = 0;
 
diff --git a/open-vm-tools/vmhgfs-fuse/fsutil.c b/open-vm-tools/vmhgfs-fuse/fsutil.c
index 042c223c..c3d581d3 100644
--- a/open-vm-tools/vmhgfs-fuse/fsutil.c
+++ b/open-vm-tools/vmhgfs-fuse/fsutil.c
@@ -680,7 +680,7 @@ HgfsStatusConvertToLinux(HgfsStatus hgfsStatus) // IN: Status code to convert
 unsigned long
 HgfsCalcBlockSize(uint64 tsize)
 {
-   loff_t used = (tsize + 511) >> 9;
+   off64_t used = (tsize + 511) >> 9;
    return (used > ULONG_MAX) ? ULONG_MAX : used;
 }
 
diff --git a/open-vm-tools/vmhgfs-fuse/fsutil.h b/open-vm-tools/vmhgfs-fuse/fsutil.h
index 34b6d489..a75cff82 100644
--- a/open-vm-tools/vmhgfs-fuse/fsutil.h
+++ b/open-vm-tools/vmhgfs-fuse/fsutil.h
@@ -32,10 +32,6 @@
 #include "hgfsProto.h"
 #include <fuse.h>
 
-#if defined(__FreeBSD__) || defined(__SOLARIS__) || defined(__APPLE__)
-typedef long long loff_t;
-#endif
-
 /*
  * Struct used to pass around attributes.
  * These aren't just the attributes seen in HgfsAttr[V2]; we add a filename
@@ -73,7 +69,7 @@ ssize_t
 HgfsWrite(struct fuse_file_info *fi,
           const char  *buf,
           size_t count,
-          loff_t offset);
+          off64_t offset);
 
 int
 HgfsRename(const char* from, const char* to);
@@ -93,7 +89,7 @@ ssize_t
 HgfsRead(struct fuse_file_info *fi,
          char  *buf,
          size_t count,
-         loff_t offset);
+         off64_t offset);
 
 int
 HgfsSetattr(const char* path,
-- 
2.19.1

