6#ifndef BITCOIN_UTIL_FS_HELPERS_H
7#define BITCOIN_UTIL_FS_HELPERS_H
37[[nodiscard]]
bool RenameOver(fs::path src, fs::path dest);
45[[nodiscard]]
LockResult LockDirectory(
const fs::path& directory,
const fs::path& lockfile_name,
bool probe_only =
false);
47void UnlockDirectory(
const fs::path& directory,
const fs::path& lockfile_name);
48bool CheckDiskSpace(
const fs::path& dir, uint64_t additional_bytes = 0);
56std::streampos
GetFileSize(
const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max());
80fs::path GetSpecialFolderPath(
int nFolder,
bool fCreate =
true);
fs::path GetDefaultDataDir()
bool RenameOver(fs::path src, fs::path dest)
Rename src to dest.
int RaiseFileDescriptorLimit(int nMinFD)
this function tries to raise the file descriptor limit to the requested number.
std::streampos GetFileSize(const char *path, std::streamsize max=std::numeric_limits< std::streamsize >::max())
Get the size of a file by scanning it.
void DirectoryCommit(const fs::path &dirname)
Sync directory contents.
void ReleaseDirectoryLocks()
Release all directory locks.
bool TryCreateDirectories(const fs::path &p)
Ignores exceptions thrown by create_directories if the requested directory exists.
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length)
this function tries to make a particular range of a file allocated (corresponding to disk space) it i...
std::optional< fs::perms > InterpretPermString(const std::string &s)
Interpret a custom permissions level string as fs::perms.
bool TruncateFile(FILE *file, unsigned int length)
bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes=0)
std::string PermsToSymbolicString(fs::perms p)
Convert fs::perms to symbolic string of the form 'rwxrwxrwx'.
bool FileCommit(FILE *file)
Ensure file contents are fully committed to disk, using a platform-specific feature analogous to fsyn...
void UnlockDirectory(const fs::path &directory, const fs::path &lockfile_name)
LockResult LockDirectory(const fs::path &directory, const fs::path &lockfile_name, bool probe_only)