aboutsummaryrefslogtreecommitdiffstats
path: root/roots.c
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2011-06-08 19:03:27 -0700
committerKoushik Dutta <koushd@gmail.com>2011-06-08 19:03:27 -0700
commit50822991460cbee65757e9de12b29e39238d6386 (patch)
tree0bc903c7faeb630f66e0571b5b20f39e687ae011 /roots.c
parentc56768cfb173cededb914e8c33399110cd2a2d3f (diff)
downloadbootable_recovery-50822991460cbee65757e9de12b29e39238d6386.zip
bootable_recovery-50822991460cbee65757e9de12b29e39238d6386.tar.gz
bootable_recovery-50822991460cbee65757e9de12b29e39238d6386.tar.bz2
tar nandroid and /data/media support.
Change-Id: I9405e701887fc83c422c63c1dbf5ff087fff880d
Diffstat (limited to 'roots.c')
-rw-r--r--roots.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/roots.c b/roots.c
index 4ecc4dd..49b7729 100644
--- a/roots.c
+++ b/roots.c
@@ -167,6 +167,16 @@ int try_mount(const char* device, const char* mount_point, const char* fs_type,
int ensure_path_mounted(const char* path) {
Volume* v = volume_for_path(path);
if (v == NULL) {
+ // no /sdcard? let's assume /data/media
+ if (strstr(path, "/sdcard") == path) {
+ LOGW("using /data/media, no /sdcard found.\n");
+ int ret;
+ if (0 != (ret = ensure_path_mounted("/data")))
+ return ret;
+ rmdir("/sdcard");
+ symlink("/data/media", "/sdcard");
+ return 0;
+ }
LOGE("unknown volume for path [%s]\n", path);
return -1;
}
@@ -227,8 +237,17 @@ int ensure_path_mounted(const char* path) {
}
int ensure_path_unmounted(const char* path) {
+ // if we are using /data/media, do not ever unmount volumes /data or /sdcard
+ if (volume_for_path("/sdcard") == NULL && (strstr(path, "/sdcard") == path || strstr(path, "/data") == path)) {
+ return 0;
+ }
+
Volume* v = volume_for_path(path);
if (v == NULL) {
+ // no /sdcard? let's assume /data/media
+ if (strstr(path, "/sdcard") == path) {
+ return ensure_path_unmounted("/data");
+ }
LOGE("unknown volume for path [%s]\n", path);
return -1;
}