mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-03 00:47:07 +00:00
Revert "Add disk_space() to llvm::fs"
Breaks windows bot. This reverts commit r265050. This reverts commit r265055. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265062
This commit is contained in:
parent
5fe6dfe713
commit
601ceabd04
@ -32,7 +32,6 @@
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/TimeValue.h"
|
||||
#include <ctime>
|
||||
#include <iterator>
|
||||
@ -649,16 +648,6 @@ std::error_code identify_magic(const Twine &path, file_magic &result);
|
||||
|
||||
std::error_code getUniqueID(const Twine Path, UniqueID &Result);
|
||||
|
||||
/// @brief Get disk space usage information.
|
||||
///
|
||||
/// Note: Users must be careful about "Time Of Check, Time Of Use" kind of bug.
|
||||
/// Note: Windows reports results according to the quota allocated to the user.
|
||||
///
|
||||
/// @param Path Input path.
|
||||
/// @results errc::success if result has been successfully set, otherwise a
|
||||
/// platform specific error_code.
|
||||
ErrorOr<space_info> disk_space(const Twine Path);
|
||||
|
||||
/// This class represents a memory mapped file. It is based on
|
||||
/// boost::iostreams::mapped_file.
|
||||
class mapped_file_region {
|
||||
|
@ -60,24 +60,6 @@
|
||||
# define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__ANDROID__)
|
||||
#include <sys/statvfs.h>
|
||||
#define STATVFS statvfs
|
||||
#define STATVFS_F_FRSIZE(vfs) vfs.f_frsize
|
||||
#else
|
||||
#ifdef __OpenBSD__
|
||||
#include <sys/param.h>
|
||||
#elif defined(__ANDROID__)
|
||||
#include <sys/vfs.h>
|
||||
#else
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
#define STATVFS statfs
|
||||
#define STATVFS_F_FRSIZE(vfs) static_cast<uint64_t>(vfs.f_bsize)
|
||||
#endif
|
||||
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
@ -88,7 +70,7 @@ namespace fs {
|
||||
defined(__linux__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||
static int
|
||||
test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
|
||||
{
|
||||
{
|
||||
struct stat sb;
|
||||
char fullpath[PATH_MAX];
|
||||
|
||||
@ -208,18 +190,6 @@ UniqueID file_status::getUniqueID() const {
|
||||
return UniqueID(fs_st_dev, fs_st_ino);
|
||||
}
|
||||
|
||||
ErrorOr<space_info> disk_space(const Twine Path) {
|
||||
struct STATVFS Vfs;
|
||||
if (::STATVFS(Path.str().c_str(), &Vfs))
|
||||
return std::error_code(errno, std::generic_category());
|
||||
auto FrSize = STATVFS_F_FRSIZE(Vfs);
|
||||
space_info SpaceInfo;
|
||||
SpaceInfo.capacity = static_cast<uint64_t>(Vfs.f_blocks) * FrSize;
|
||||
SpaceInfo.free = static_cast<uint64_t>(Vfs.f_bfree) * FrSize;
|
||||
SpaceInfo.available = static_cast<uint64_t>(Vfs.f_bavail) * FrSize;
|
||||
return SpaceInfo;
|
||||
}
|
||||
|
||||
std::error_code current_path(SmallVectorImpl<char> &result) {
|
||||
result.clear();
|
||||
|
||||
|
@ -151,19 +151,6 @@ UniqueID file_status::getUniqueID() const {
|
||||
return UniqueID(VolumeSerialNumber, FileID);
|
||||
}
|
||||
|
||||
ErrorOr<space_info> disk_space(const Twine Path) {
|
||||
PULARGE_INTEGER Avail, Total, Free;
|
||||
if (!::GetDiskFreeSpaceExW(Path.str().c_str(), &Avail, &Total, &Free))
|
||||
return mapWindowsError(::GetLastError());
|
||||
space_info SpaceInfo;
|
||||
SpaceInfo.capacity =
|
||||
(static_cast<uint64_t>(Total.HighPart) << 32) + Total.LowPart;
|
||||
SpaceInfo.Free = (static_cast<uint64_t>(Free.HighPart) << 32) + Free.LowPart;
|
||||
SpaceInfo.available =
|
||||
(static_cast<uint64_t>(Avail.HighPart) << 32) + Avail.LowPart;
|
||||
return SpaceInfo;
|
||||
}
|
||||
|
||||
TimeValue file_status::getLastAccessedTime() const {
|
||||
ULARGE_INTEGER UI;
|
||||
UI.LowPart = LastAccessedTimeLow;
|
||||
|
Loading…
Reference in New Issue
Block a user