diff options
author | Zachary Turner <zturner@google.com> | 2017-03-21 04:01:04 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-21 04:01:04 +0000 |
commit | bfe8bcbc43ccd45d4d32d0c5b6acc22d43ff330d (patch) | |
tree | 5ff5e415e11a606c7fcb67746733309d3592932d /lldb/source/Host/posix | |
parent | ab2dae0a9c415b5f56cf298fdcbeec0620150675 (diff) | |
download | bcm5719-llvm-bfe8bcbc43ccd45d4d32d0c5b6acc22d43ff330d.tar.gz bcm5719-llvm-bfe8bcbc43ccd45d4d32d0c5b6acc22d43ff330d.zip |
Delete various lldb FileSystem functions.
Use LLVM's equivalent versions instead.
Differential Revision: https://reviews.llvm.org/D31111
llvm-svn: 298334
Diffstat (limited to 'lldb/source/Host/posix')
-rw-r--r-- | lldb/source/Host/posix/DomainSocket.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/posix/FileSystem.cpp | 78 | ||||
-rw-r--r-- | lldb/source/Host/posix/PipePosix.cpp | 3 |
3 files changed, 3 insertions, 82 deletions
diff --git a/lldb/source/Host/posix/DomainSocket.cpp b/lldb/source/Host/posix/DomainSocket.cpp index cb0a1d05750..538979df2b6 100644 --- a/lldb/source/Host/posix/DomainSocket.cpp +++ b/lldb/source/Host/posix/DomainSocket.cpp @@ -9,7 +9,7 @@ #include "lldb/Host/posix/DomainSocket.h" -#include "lldb/Host/FileSystem.h" +#include "llvm/Support/FileSystem.h" #include <stddef.h> #include <sys/socket.h> @@ -116,5 +116,5 @@ Error DomainSocket::Accept(llvm::StringRef name, bool child_processes_inherit, size_t DomainSocket::GetNameOffset() const { return 0; } void DomainSocket::DeleteSocketFile(llvm::StringRef name) { - FileSystem::Unlink(FileSpec{name, true}); + llvm::sys::fs::remove(name); } diff --git a/lldb/source/Host/posix/FileSystem.cpp b/lldb/source/Host/posix/FileSystem.cpp index 4c21fcd34a0..22f337fcfec 100644 --- a/lldb/source/Host/posix/FileSystem.cpp +++ b/lldb/source/Host/posix/FileSystem.cpp @@ -36,33 +36,6 @@ using namespace lldb_private; const char *FileSystem::DEV_NULL = "/dev/null"; -FileSpec::PathSyntax FileSystem::GetNativePathSyntax() { - return FileSpec::ePathSyntaxPosix; -} - -lldb::user_id_t FileSystem::GetFileSize(const FileSpec &file_spec) { - return file_spec.GetByteSize(); -} - -bool FileSystem::GetFileExists(const FileSpec &file_spec) { - return file_spec.Exists(); -} - -Error FileSystem::Hardlink(const FileSpec &src, const FileSpec &dst) { - Error error; - if (::link(dst.GetCString(), src.GetCString()) == -1) - error.SetErrorToErrno(); - return error; -} - -int FileSystem::GetHardlinkCount(const FileSpec &file_spec) { - struct stat file_stat; - if (::stat(file_spec.GetCString(), &file_stat) == 0) - return file_stat.st_nlink; - - return -1; -} - Error FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { Error error; if (::symlink(dst.GetCString(), src.GetCString()) == -1) @@ -70,13 +43,6 @@ Error FileSystem::Symlink(const FileSpec &src, const FileSpec &dst) { return error; } -Error FileSystem::Unlink(const FileSpec &file_spec) { - Error error; - if (::unlink(file_spec.GetCString()) == -1) - error.SetErrorToErrno(); - return error; -} - Error FileSystem::Readlink(const FileSpec &src, FileSpec &dst) { Error error; char buf[PATH_MAX]; @@ -108,50 +74,6 @@ Error FileSystem::ResolveSymbolicLink(const FileSpec &src, FileSpec &dst) { return Error(); } -#if defined(__NetBSD__) -static bool IsLocal(const struct statvfs &info) { - return (info.f_flag & MNT_LOCAL) != 0; -} -#else -static bool IsLocal(const struct statfs &info) { -#ifdef __linux__ -#define CIFS_MAGIC_NUMBER 0xFF534D42 - switch ((uint32_t)info.f_type) { - case NFS_SUPER_MAGIC: - case SMB_SUPER_MAGIC: - case CIFS_MAGIC_NUMBER: - return false; - default: - return true; - } -#else - return (info.f_flags & MNT_LOCAL) != 0; -#endif -} -#endif - -#if defined(__NetBSD__) -bool FileSystem::IsLocal(const FileSpec &spec) { - struct statvfs statfs_info; - std::string path(spec.GetPath()); - if (statvfs(path.c_str(), &statfs_info) == 0) - return ::IsLocal(statfs_info); - return false; -} -#else -bool FileSystem::IsLocal(const FileSpec &spec) { - struct statfs statfs_info; - std::string path(spec.GetPath()); - if (statfs(path.c_str(), &statfs_info) == 0) - return ::IsLocal(statfs_info); - return false; -} -#endif - FILE *FileSystem::Fopen(const char *path, const char *mode) { return ::fopen(path, mode); } - -int FileSystem::Stat(const char *path, struct stat *stats) { - return ::stat(path, stats); -} diff --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp index 4e0810c1a9b..3ac5d480de8 100644 --- a/lldb/source/Host/posix/PipePosix.cpp +++ b/lldb/source/Host/posix/PipePosix.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/posix/PipePosix.h" -#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/SelectHelper.h" #include "llvm/ADT/SmallString.h" @@ -231,7 +230,7 @@ void PipePosix::Close() { } Error PipePosix::Delete(llvm::StringRef name) { - return FileSystem::Unlink(FileSpec{name.data(), true}); + return llvm::sys::fs::remove(name); } bool PipePosix::CanRead() const { |