]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/FileSystem.h
Merge ACPICA 20160930.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / FileSystem.h
1 //===-- FileSystem.h --------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_Host_FileSystem_h
11 #define liblldb_Host_FileSystem_h
12
13 #include <stdint.h>
14
15 #include "lldb/lldb-types.h"
16
17 #include "lldb/Core/Error.h"
18 #include "lldb/Host/FileSpec.h"
19
20 namespace lldb_private
21 {
22 class FileSystem
23 {
24   public:
25     static const char *DEV_NULL;
26
27     static FileSpec::PathSyntax GetNativePathSyntax();
28
29     static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode);
30     static Error DeleteDirectory(const FileSpec &file_spec, bool recurse);
31
32     static Error GetFilePermissions(const FileSpec &file_spec,
33                                     uint32_t &file_permissions);
34     static Error SetFilePermissions(const FileSpec &file_spec,
35                                     uint32_t file_permissions);
36     static lldb::user_id_t GetFileSize(const FileSpec &file_spec);
37     static bool GetFileExists(const FileSpec &file_spec);
38
39     static Error Hardlink(const FileSpec &src, const FileSpec &dst);
40     static int GetHardlinkCount(const FileSpec &file_spec);
41     static Error Symlink(const FileSpec &src, const FileSpec &dst);
42     static Error Readlink(const FileSpec &src, FileSpec &dst);
43     static Error Unlink(const FileSpec &file_spec);
44     
45     static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
46
47     static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high);
48     static bool CalculateMD5(const FileSpec &file_spec,
49                              uint64_t offset,
50                              uint64_t length,
51                              uint64_t &low,
52                              uint64_t &high);
53
54     static bool CalculateMD5AsString(const FileSpec &file_spec, std::string& digest_str);
55     static bool CalculateMD5AsString(const FileSpec &file_spec,
56                                      uint64_t offset,
57                                      uint64_t length,
58                                      std::string& digest_str);
59
60     /// Return \b true if \a spec is on a locally mounted file system, \b false otherwise.
61     static bool IsLocal(const FileSpec &spec);
62 };
63 }
64
65 #endif