]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Backout previous change to lib/file/filePosix.c.
authorOliver Kurth <okurth@vmware.com>
Fri, 22 Nov 2019 22:52:31 +0000 (14:52 -0800)
committerOliver Kurth <okurth@vmware.com>
Fri, 22 Nov 2019 22:52:31 +0000 (14:52 -0800)
open-vm-tools/lib/file/filePosix.c

index d6b7f770461144775267071171d4f7f824ce0db8..31e3440878adaa61ce7210bc8acf7cc146309fad 100644 (file)
@@ -992,7 +992,7 @@ File_SetFilePermissions(const char *pathName,  // IN:
  *-----------------------------------------------------------------------------
  */
 
-Bool
+static Bool
 FilePosixGetParent(char **canPath)  // IN/OUT: Canonical file path
 {
    char *pathName;
@@ -1049,7 +1049,6 @@ File_GetParent(char **canPath)  // IN/OUT: Canonical file path
 }
 
 
-#if !defined(__APPLE__) || TARGET_OS_IPHONE
 /*
  *----------------------------------------------------------------------
  *
@@ -1141,7 +1140,6 @@ File_GetFreeSpace(const char *pathName,  // IN: File name
 
    return ret;
 }
-#endif
 
 
 #if defined(VMX86_SERVER)
@@ -1624,7 +1622,25 @@ File_SupportsOptimisticLock(const char *pathName)  // IN:
 uint64
 File_GetCapacity(const char *pathName)  // IN: Path name
 {
-   return File_GetFreeSpace(pathName, FALSE);
+   uint64 ret;
+   char *fullPath;
+   struct statfs statfsbuf;
+
+   fullPath = File_FullPath(pathName);
+   if (fullPath == NULL) {
+      return -1;
+   }
+
+   if (FileGetStats(fullPath, FALSE, &statfsbuf)) {
+      ret = (uint64) statfsbuf.f_blocks * statfsbuf.f_bsize;
+   } else {
+      Warning(LGPFX" %s: Couldn't statfs\n", __func__);
+      ret = -1;
+   }
+
+   Posix_Free(fullPath);
+
+   return ret;
 }