* limitations under the License
*/
#include <set>
+#include <algorithm>
#include <fcntl.h>
#include <signal.h>
#include "rmi/internal-encryption.h"
#define INTERNAL_ENGINE DMCryptEngine
-#define INTERNAL_DEV "/dev/disk/by-partlabel/USER"
-#define INTERNAL_PATH "/opt/usr"
+#define INTERNAL_DEV_PATH "/dev/disk/by-partlabel"
+#define INTERNAL_DEV_NAME "USER"
+#define INTERNAL_PATH "/opt/usr"
#define INTERNAL_STATE_VCONF_KEY VCONFKEY_ODE_CRYPTO_STATE
#define INTERNAL_OPTION_ONLY_USED_REGION_VCONF_KEY VCONFKEY_ODE_FAST_ENCRYPTION
context.createNotification("InternalEncryption::mount");
+ std::string source = INTERNAL_DEV_PATH "/" INTERNAL_DEV_NAME;
+ try {
+ runtime::DirectoryIterator iter(INTERNAL_DEV_PATH), end;
+
+ while (iter != end) {
+ const std::string& path = (*iter).getPath();
+ std::string name = path.substr(path.rfind('/') + 1);
+ std::string upper;
+ upper.reserve(name.size());
+ for (char c : name) {
+ upper += std::toupper(c);
+ }
+ if (upper == INTERNAL_DEV_NAME) {
+ source = path;
+ break;
+ }
+ ++iter;
+ }
+ } catch (runtime::Exception &e) {}
+
engine.reset(new INTERNAL_ENGINE(
- INTERNAL_DEV, INTERNAL_PATH,
+ source, INTERNAL_PATH,
ProgressBar([](int v) {
::vconf_set_str(VCONFKEY_ODE_ENCRYPT_PROGRESS,
std::to_string(v).c_str());