summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/roots.cpp b/roots.cpp
index 09471225d..c52cf591d 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -22,12 +22,15 @@
#include <unistd.h>
#include <ctype.h>
+extern "C" {
#include <fs_mgr.h>
#include "mtdutils/mtdutils.h"
#include "mtdutils/mounts.h"
+}
#include "roots.h"
#include "common.h"
#include "make_ext4fs.h"
+#include "partitions.hpp"
static struct fstab *fstab = NULL;
@@ -67,6 +70,10 @@ Volume* volume_for_path(const char* path) {
}
int ensure_path_mounted(const char* path) {
+ if (PartitionManager.Mount_By_Path(path, true))
+ return 0;
+ else
+ return -1;
Volume* v = volume_for_path(path);
if (v == NULL) {
LOGE("unknown volume for path [%s]\n", path);
@@ -119,6 +126,10 @@ int ensure_path_mounted(const char* path) {
}
int ensure_path_unmounted(const char* path) {
+ if (PartitionManager.UnMount_By_Path(path, true))
+ return 0;
+ else
+ return -1;
Volume* v = volume_for_path(path);
if (v == NULL) {
LOGE("unknown volume for path [%s]\n", path);
@@ -147,6 +158,10 @@ int ensure_path_unmounted(const char* path) {
}
int format_volume(const char* volume) {
+ if (PartitionManager.Wipe_By_Path(volume))
+ return 0;
+ else
+ return -1;
Volume* v = volume_for_path(volume);
if (v == NULL) {
LOGE("unknown volume \"%s\"\n", volume);