diff options
author | Koushik Dutta <koushd@gmail.com> | 2011-08-31 23:26:45 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2011-08-31 23:26:45 -0700 |
commit | 5268131918bc9ffdcd2f82de12778247bf86782e (patch) | |
tree | 71e8b7cbc5146617df664642381dec43bfed378d /roots.c | |
parent | d6bf694ff0d00ab096c7926f42ce55b7575fcc1b (diff) | |
download | android_bootable_recovery-5268131918bc9ffdcd2f82de12778247bf86782e.tar.gz android_bootable_recovery-5268131918bc9ffdcd2f82de12778247bf86782e.tar.bz2 android_bootable_recovery-5268131918bc9ffdcd2f82de12778247bf86782e.zip |
allow explicitly provided mount locations
Change-Id: I3930b2abeb81c09c25c1750f0545c233c0d5a4a2
Diffstat (limited to 'roots.c')
-rw-r--r-- | roots.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -176,6 +176,10 @@ void setup_data_media() { } int ensure_path_mounted(const char* path) { + return ensure_path_mounted_at_mount_point(path, NULL); +} + +int ensure_path_mounted_at_mount_point(const char* path, const char* mount_point) { Volume* v = volume_for_path(path); if (v == NULL) { // no /sdcard? let's assume /data/media @@ -202,14 +206,17 @@ int ensure_path_mounted(const char* path) { return -1; } + if (NULL == mount_point) + mount_point = v->mount_point; + const MountedVolume* mv = - find_mounted_volume_by_mount_point(v->mount_point); + find_mounted_volume_by_mount_point(mount_point); if (mv) { // volume is already mounted return 0; } - mkdir(v->mount_point, 0755); // in case it doesn't already exist + mkdir(mount_point, 0755); // in case it doesn't already exist if (strcmp(v->fs_type, "yaffs2") == 0) { // mount an MTD partition as a YAFFS2 filesystem. @@ -218,21 +225,21 @@ int ensure_path_mounted(const char* path) { partition = mtd_find_partition_by_name(v->device); if (partition == NULL) { LOGE("failed to find \"%s\" partition to mount at \"%s\"\n", - v->device, v->mount_point); + v->device, mount_point); return -1; } - return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0); + return mtd_mount_partition(partition, mount_point, v->fs_type, 0); } else if (strcmp(v->fs_type, "ext4") == 0 || strcmp(v->fs_type, "ext3") == 0 || strcmp(v->fs_type, "rfs") == 0 || strcmp(v->fs_type, "vfat") == 0) { - if ((result = try_mount(v->device, v->mount_point, v->fs_type, v->fs_options)) == 0) + if ((result = try_mount(v->device, mount_point, v->fs_type, v->fs_options)) == 0) return 0; - if ((result = try_mount(v->device2, v->mount_point, v->fs_type, v->fs_options)) == 0) + if ((result = try_mount(v->device2, mount_point, v->fs_type, v->fs_options)) == 0) return 0; - if ((result = try_mount(v->device, v->mount_point, v->fs_type2, v->fs_options2)) == 0) + if ((result = try_mount(v->device, mount_point, v->fs_type2, v->fs_options2)) == 0) return 0; - if ((result = try_mount(v->device2, v->mount_point, v->fs_type2, v->fs_options2)) == 0) + if ((result = try_mount(v->device2, mount_point, v->fs_type2, v->fs_options2)) == 0) return 0; return result; } else { @@ -242,7 +249,7 @@ int ensure_path_mounted(const char* path) { return __system(mount_cmd); } - LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, v->mount_point); + LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, mount_point); return -1; } |