v29.4-roots.4 · Commit 2: [PATCH 02/37] runtime: preserve shared operator controls
src/util/fs_helpers.h
Before: src/util/fs_helpers.h · After: src/util/fs_helpers.h
File metadata
index 28dd6d979d5253ea5a09c58bd68d670e10ad6f9b..e5ce1a3ce298b6193af6915e4d1754857af7f61a 100644
Download original patch · Release notes
Diff rows 1–38 of 38. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/util/fs_helpers.h
CHANGED
|
@@ -55,6 +55,15 @@ bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0);
|
|
|
55
55
|
*/
|
|
56
56
|
std::streampos GetFileSize(const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max());
|
|
57
57
|
|
|
58
|
+
//! Return the original FILE* unchanged. On systems that support it,
|
|
59
|
+
//! also advise the OS that the file will be accessed sequentially.
|
|
60
|
+
FILE* AdviseSequential(FILE*);
|
|
61
|
+
|
|
62
|
+
//! Close a file and return the result of fclose(). On systems that
|
|
63
|
+
//! support it, advise the OS to remove the file contents from the page
|
|
64
|
+
//! cache (which can help on memory-constrained systems).
|
|
65
|
+
int CloseAndUncache(FILE*);
|
|
66
|
+
|
|
58
67
|
/** Release all directory locks. This is used for unit testing only, at runtime
|
|
59
68
|
* the global destructor will take care of the locks.
|
|
60
69
|
*/
|
|
@@ -76,8 +85,23 @@ std::string PermsToSymbolicString(fs::perms p);
|
|
|
76
85
|
*/
|
|
77
86
|
std::optional<fs::perms> InterpretPermString(const std::string& s);
|
|
78
87
|
|
|
88
|
+
/** Check if a directory is writable by creating a temporary file on it.
|
|
89
|
+
*
|
|
90
|
+
* @param[in] dir_path Path of the directory to test
|
|
91
|
+
* @return true if a temporary file could be created and removed, false otherwise.
|
|
92
|
+
* @throw std::runtime_error if dir_path is not a directory.
|
|
93
|
+
*/
|
|
94
|
+
bool IsDirWritable(const fs::path& dir_path);
|
|
95
|
+
|
|
79
96
|
#ifdef WIN32
|
|
80
97
|
fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
|
81
98
|
#endif
|
|
82
99
|
|
|
100
|
+
/** Determine whether the given path is a symbolic link or a reparse point on windows
|
|
101
|
+
*
|
|
102
|
+
* @param[in] path The path to check
|
|
103
|
+
* @return Whether path is a symlink or reparse point
|
|
104
|
+
*/
|
|
105
|
+
bool IsSymlink(const fs::path& path);
|
|
106
|
+
|
|
83
107
|
#endif // BITCOIN_UTIL_FS_HELPERS_H
|