return true;
}
-unsigned long long getUsedSpace(const std::string& mountPoint)
+off_t getUsedSpace(const std::string& mountPoint)
{
struct statfs statbuf;
if (::statfs(mountPoint.c_str(), &statbuf)) {
throw runtime::Exception("Failed to access " + mountPoint);
}
- return (unsigned long long)(statbuf.f_blocks - statbuf.f_bfree) * statbuf.f_bsize;
+ return (off_t)(statbuf.f_blocks - statbuf.f_bfree) * statbuf.f_bsize;
}
-unsigned long long getAvailableSpace(const std::string& mountPoint)
+off_t getAvailableSpace(const std::string& mountPoint)
{
struct statfs statbuf;
if (::statfs(mountPoint.c_str(), &statbuf)) {
throw runtime::Exception("Failed to access " + mountPoint);
}
- return (unsigned long long)statbuf.f_bfree * statbuf.f_bsize;
+ return (off_t)statbuf.f_bfree * statbuf.f_bsize;
}
static void copyDac(const std::string& srcPath, const std::string& destPath)
bool isEnoughToCopyInPlace(const std::string& path)
{
- unsigned long long availableSpace = getAvailableSpace(path);
+ off_t availableSpace = getAvailableSpace(path);
std::function<bool(const std::string &path)> check;
check = [&check, availableSpace](const std::string &path) {
}
void copyInPlace(const std::string& source, const std::string& destination,
- const std::function<void(unsigned long long)> &addProgress)
+ const std::function<void(off_t)> &addProgress)
{
for (runtime::DirectoryIterator iter(source), end; iter != end; ++iter) {
if (iter->getPath() == destination) {
encrypted.makeDirectory();
setPolicy(encrypted.getPath(), sanitizedKey);
- unsigned long long totalSize = getUsedSpace(source), current = 0;
+ off_t totalSize = getUsedSpace(source), current = 0;
copyInPlace(destination, encrypted.getPath(),
- [¤t, &totalSize, this](unsigned long long size) {
+ [¤t, &totalSize, this](off_t size) {
current += size;
this->progress.update(current, totalSize, 1);
});
runtime::File encrypted(destination + "/" ENCRYPTION_DIR);
- unsigned long long totalSize = getUsedSpace(source), current = 0;
+ off_t totalSize = getUsedSpace(source), current = 0;
copyInPlace(encrypted.getPath(), destination,
- [¤t, &totalSize, this](unsigned long long size) {
+ [¤t, &totalSize, this](off_t size) {
current += size;
this->progress.update(current, totalSize, 1);
});