]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Code clean up in lib/file/filePosix.c
authorOliver Kurth <okurth@vmware.com>
Fri, 22 Nov 2019 22:52:35 +0000 (14:52 -0800)
committerOliver Kurth <okurth@vmware.com>
Fri, 22 Nov 2019 22:52:35 +0000 (14:52 -0800)
Consolidate identical code in File_GetCapacity() and File_GetFreeSpace().

open-vm-tools/lib/file/filePosix.c

index 31e3440878adaa61ce7210bc8acf7cc146309fad..d6b7f770461144775267071171d4f7f824ce0db8 100644 (file)
@@ -992,7 +992,7 @@ File_SetFilePermissions(const char *pathName,  // IN:
  *-----------------------------------------------------------------------------
  */
 
-static Bool
+Bool
 FilePosixGetParent(char **canPath)  // IN/OUT: Canonical file path
 {
    char *pathName;
@@ -1049,6 +1049,7 @@ File_GetParent(char **canPath)  // IN/OUT: Canonical file path
 }
 
 
+#if !defined(__APPLE__) || TARGET_OS_IPHONE
 /*
  *----------------------------------------------------------------------
  *
@@ -1140,6 +1141,7 @@ File_GetFreeSpace(const char *pathName,  // IN: File name
 
    return ret;
 }
+#endif
 
 
 #if defined(VMX86_SERVER)
@@ -1622,25 +1624,7 @@ File_SupportsOptimisticLock(const char *pathName)  // IN:
 uint64
 File_GetCapacity(const char *pathName)  // IN: Path name
 {
-   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;
+   return File_GetFreeSpace(pathName, FALSE);
 }