diff options
author | philz-cwm6 <phytowardt@gmail.com> | 2013-10-02 21:34:35 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-10-19 08:31:08 +0000 |
commit | f4c69bf953881288088be92751712fe92ed94dbd (patch) | |
tree | d575c7c51b3a180cfa6a1195c94c62b0ad3d3d0d /roots.c | |
parent | cd352084711c4dff13c570865679feeb06c3d90c (diff) | |
download | android_bootable_recovery-f4c69bf953881288088be92751712fe92ed94dbd.tar.gz android_bootable_recovery-f4c69bf953881288088be92751712fe92ed94dbd.tar.bz2 android_bootable_recovery-f4c69bf953881288088be92751712fe92ed94dbd.zip |
fix the following bugs to better handle new vold code
- do not show partition sdcard entries for vold managed volumes until we have a valid blk_device2. That also caused a memory overflow
- make it possible again to partition old style blk_device volumes
- enable format voldmanaged devices to ext2 and ext3 with existing binaries by using optional blk_device2 (defined in recovery to NULL but not currently implemented by fs_mgr
- fix unexpected behavior when in format/partition menus and insert an usb key (REFRESH return code)
- ensure_path_unmounted() could not unmount /sdcard path on /data/media devices
- format_device() and format_volume() properly handle /sdcard path argument on /data/media devices
Change-Id: I2d5872690805e70175ba1346fd03978e3c2b879e
Diffstat (limited to 'roots.c')
-rw-r--r-- | roots.c | 30 |
1 files changed, 16 insertions, 14 deletions
@@ -283,6 +283,9 @@ static int ignore_data_media = 0; int ensure_path_unmounted(const char* path) { // if we are using /data/media, do not ever unmount volumes /data or /sdcard + if (is_data_media_volume_path(path)) { + return ensure_path_unmounted("/data"); + } if (strstr(path, "/data") == path && is_data_media() && !ignore_data_media) { return 0; } @@ -292,9 +295,7 @@ int ensure_path_unmounted(const char* path) { LOGE("unknown volume for path [%s]\n", path); return -1; } - if (is_data_media_volume_path(path)) { - return ensure_path_unmounted("/data"); - } + if (strcmp(v->fs_type, "ramdisk") == 0) { // the ramdisk is always mounted; you can't unmount it. return -1; @@ -323,11 +324,20 @@ int ensure_path_unmounted(const char* path) { extern struct selabel_handle *sehandle; int format_volume(const char* volume) { + if (is_data_media_volume_path(volume)) { + return format_unknown_device(NULL, volume, NULL); + } + // check to see if /data is being formatted, and if it is /data/media + // Note: the /sdcard check is redundant probably, just being safe. + if (strstr(volume, "/data") == volume && is_data_media() && !ignore_data_media) { + return format_unknown_device(NULL, volume, NULL); + } + Volume* v = volume_for_path(volume); if (v == NULL) { // silent failure for sd-ext if (strcmp(volume, "/sd-ext") != 0) - LOGE("unknown volume \"%s\"\n", volume); + LOGE("unknown volume '%s'\n", volume); return -1; } // silent failure to format non existing sd-ext when defined in recovery.fstab @@ -339,8 +349,8 @@ int format_volume(const char* volume) { } } - // Only use vold format for exact matches (otherwise /sdcard will be - // formatted instead of /sdcard/.android_secure) + // Only use vold format for exact matches otherwise /sdcard will be + // formatted instead of /storage/sdcard0/.android_secure if (fs_mgr_is_voldmanaged(v) && strcmp(volume, v->mount_point) == 0) { if (ensure_path_unmounted(volume) != 0) { LOGE("format_volume failed to unmount %s", v->mount_point); @@ -348,14 +358,6 @@ int format_volume(const char* volume) { return vold_format_volume(v->mount_point, 1) == CommandOkay ? 0 : -1; } - if (is_data_media_volume_path(volume)) { - return format_unknown_device(NULL, volume, NULL); - } - // check to see if /data is being formatted, and if it is /data/media - // Note: the /sdcard check is redundant probably, just being safe. - if (strstr(volume, "/data") == volume && is_data_media() && !ignore_data_media) { - return format_unknown_device(NULL, volume, NULL); - } if (strcmp(v->fs_type, "ramdisk") == 0) { // you can't format the ramdisk. LOGE("can't format_volume \"%s\"", volume); |