#if defined(__linux__)
# include <pwd.h>
#endif
+
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif
*-----------------------------------------------------------------------------
*/
-Bool
+static Bool
FilePosixGetParent(char **canPath) // IN/OUT: Canonical file path
{
char *pathName;
}
-#if !defined(__APPLE__) || TARGET_OS_IPHONE
/*
*----------------------------------------------------------------------
*
}
if (FileGetStats(fullPath, doNotAscend, &statfsbuf)) {
- ret = (uint64) statfsbuf.f_bavail * statfsbuf.f_bsize;
+ ret = (uint64) statfsbuf.f_bavail * statfsbuf.f_bsize; // available space
} else {
Warning("%s: Couldn't statfs %s\n", __func__, fullPath);
ret = -1;
return ret;
}
-#endif
#if defined(VMX86_SERVER)
*
* File_GetCapacity --
*
- * Return the total capacity (in bytes) available to the user on a disk
- * where a file is or would be
+ * Return the total capacity (in bytes) of the file system that the
+ * specified file resides on. This is not be confused with the
+ * amount of free space available in the file system the specified
+ * file resides on.
*
* Results:
* -1 if error (reported to the user)
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; // FS size
+ } else {
+ Warning(LGPFX" %s: Couldn't statfs\n", __func__);
+ ret = -1;
+ }
+
+ Posix_Free(fullPath);
+
+ return ret;
}