if (::mount(cryptoBlkDev.c_str(), destination.c_str(), "ext4", 0, 0) < 0)
throw runtime::Exception(runtime::GetSystemErrorMessage());
+
+ mounted = true;
}
void DMCryptEngine::umount()
throw runtime::Exception(runtime::GetSystemErrorMessage());
destroyCryptoBlkDev(DM_DEFAULT_LABEL_NAME);
+
+ mounted = false;
+}
+
+bool DMCryptEngine::isMounted()
+{
+ return mounted;
}
void DMCryptEngine::encrypt(const DMCryptEngine::data &key, unsigned int options)
#include <vector>
#include <string>
+#include <atomic>
#include "progress-bar.h"
void mount(const data &key, unsigned int options);
void umount();
+ bool isMounted();
void encrypt(const data &key, unsigned int options);
void decrypt(const data &key, unsigned int options);
private:
std::string source, destination;
ProgressBar progress;
+ std::atomic<bool> mounted;
};
} // namespace ode
void EcryptfsEngine::mount(const data &key, unsigned int options)
{
ecryptfsMount(source, destination, key, options);
+
+ mounted = true;
}
void EcryptfsEngine::umount()
{
ecryptfsUmount(destination);
+
+ mounted = false;
+}
+
+bool EcryptfsEngine::isMounted()
+{
+ return mounted;
}
void EcryptfsEngine::encrypt(const data &key, unsigned int options)
#include <vector>
#include <string>
+#include <atomic>
#include "progress-bar.h"
void mount(const data& key, unsigned int);
void umount();
+ bool isMounted();
void encrypt(const data& key, unsigned int);
void decrypt(const data& key, unsigned int);
private:
std::string source, destination;
ProgressBar progress;
+ std::atomic<bool> mounted;
};
} // namespace ode
if (::mount(encryptedPath.c_str(), destination.c_str(), NULL, MS_BIND, 0) < 0) {
throw runtime::Exception("Mount error - " + runtime::GetSystemErrorMessage());
}
+
+ mounted = true;
}
void Ext4Engine::umount()
if (::umount(destination.c_str())) {
throw runtime::Exception(runtime::GetSystemErrorMessage());
}
+
+ mounted = false;
+}
+
+bool Ext4Engine::isMounted()
+{
+ return mounted;
}
void Ext4Engine::encrypt(const Ext4Engine::data& key, unsigned int options)
#include <vector>
#include <string>
+#include <atomic>
#include "progress-bar.h"
void mount(const data &key, unsigned int options);
void umount();
+ bool isMounted();
void encrypt(const data &key, unsigned int options);
void decrypt(const data &key, unsigned int options);
private:
std::string source, destination;
ProgressBar progress;
+ std::atomic<bool> mounted;
};
} // namespace ode
return -2;
}
+ if (engine->isMounted()) {
+ INFO("Already mounted");
+ return 0;
+ }
+
engine->mount(keyManager.getMasterKey(data), getOptions());
context.notify("ExternalEncryption::mount");
return -1;
}
+ if (!engine->isMounted()) {
+ INFO("Already umounted");
+ return 0;
+ }
+
INFO("Close all applications using external storage...");
killDependedApplications();
INFO("Umount external storage...");
return -2;
}
+ if (engine->isMounted()) {
+ INFO("Already mounted");
+ return 0;
+ }
+
engine->mount(keyManager.getMasterKey(pwData), getOptions());
context.notify("InternalEncryption::mount");
return -1;
}
+ if (!engine->isMounted()) {
+ INFO("Already umounted");
+ return 0;
+ }
+
INFO("Close all processes using internal storage...");
stopDependedSystemdServices();
INFO("Umount internal storage...");