From 5a44ceb692c3d5e68007f46b68847d3d885831fa Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 26 Jan 2012 14:56:56 -0800 Subject: [PATCH] remove hacky board define around usb storage mounting on /data/media devices. Change-Id: I2d382762271a2cfc6d83454160ed127b7457c88c --- extendedcommands.c | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/extendedcommands.c b/extendedcommands.c index 729778c..af67c3e 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -635,7 +635,7 @@ void show_partition_menu() string options[255]; if(!device_volumes) - return; + return; mountable_volumes = 0; formatable_volumes = 0; @@ -644,25 +644,24 @@ void show_partition_menu() format_menue = malloc(num_volumes * sizeof(FormatMenuEntry)); for (i = 0; i < num_volumes; ++i) { - Volume* v = &device_volumes[i]; - if(strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) != 0 && strcmp("emmc", v->fs_type) != 0 && strcmp("bml", v->fs_type) != 0) - { - sprintf(&mount_menue[mountable_volumes].mount, "mount %s", v->mount_point); - sprintf(&mount_menue[mountable_volumes].unmount, "unmount %s", v->mount_point); - mount_menue[mountable_volumes].v = &device_volumes[i]; - ++mountable_volumes; - if (is_safe_to_format(v->mount_point)) { - sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point); - format_menue[formatable_volumes].v = &device_volumes[i]; - ++formatable_volumes; - } - } - else if (strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) == 0 && is_safe_to_format(v->mount_point)) - { - sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point); - format_menue[formatable_volumes].v = &device_volumes[i]; - ++formatable_volumes; - } + Volume* v = &device_volumes[i]; + if(strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) != 0 && strcmp("emmc", v->fs_type) != 0 && strcmp("bml", v->fs_type) != 0) { + sprintf(&mount_menue[mountable_volumes].mount, "mount %s", v->mount_point); + sprintf(&mount_menue[mountable_volumes].unmount, "unmount %s", v->mount_point); + mount_menue[mountable_volumes].v = &device_volumes[i]; + ++mountable_volumes; + if (is_safe_to_format(v->mount_point)) { + sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point); + format_menue[formatable_volumes].v = &device_volumes[i]; + ++formatable_volumes; + } + } + else if (strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) == 0 && is_safe_to_format(v->mount_point)) + { + sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point); + format_menue[formatable_volumes].v = &device_volumes[i]; + ++formatable_volumes; + } } @@ -672,37 +671,39 @@ void show_partition_menu() for (;;) { + for (i = 0; i < mountable_volumes; i++) + { + MountMenuEntry* e = &mount_menue[i]; + Volume* v = e->v; + if(is_path_mounted(v->mount_point)) + options[i] = e->unmount; + else + options[i] = e->mount; + } - for (i = 0; i < mountable_volumes; i++) - { - MountMenuEntry* e = &mount_menue[i]; - Volume* v = e->v; - if(is_path_mounted(v->mount_point)) - options[i] = e->unmount; - else - options[i] = e->mount; - } + for (i = 0; i < formatable_volumes; i++) + { + FormatMenuEntry* e = &format_menue[i]; - for (i = 0; i < formatable_volumes; i++) - { - FormatMenuEntry* e = &format_menue[i]; + options[mountable_volumes+i] = e->txt; + } - options[mountable_volumes+i] = e->txt; - } - - options[mountable_volumes+formatable_volumes] = "mount USB storage"; - options[mountable_volumes+formatable_volumes + 1] = NULL; + if (is_data_media()) { + options[mountable_volumes + formatable_volumes] = "mount USB storage"; + options[mountable_volumes + formatable_volumes + 1] = NULL; + } + else { + options[mountable_volumes + formatable_volumes] = NULL; + } int chosen_item = get_menu_selection(headers, &options, 0, 0); if (chosen_item == GO_BACK) break; - if (chosen_item == (mountable_volumes+formatable_volumes)) - { + if (chosen_item == (mountable_volumes+formatable_volumes)) { show_mount_usb_storage_menu(); } - else if (chosen_item < mountable_volumes) - { - MountMenuEntry* e = &mount_menue[chosen_item]; + else if (chosen_item < mountable_volumes) { + MountMenuEntry* e = &mount_menue[chosen_item]; Volume* v = e->v; if (is_path_mounted(v->mount_point)) @@ -736,7 +737,6 @@ void show_partition_menu() free(mount_menue); free(format_menue); - } void show_nandroid_advanced_restore_menu(const char* path)