本文整理汇总了C++中ensure_path_unmounted函数的典型用法代码示例。如果您正苦于以下问题:C++ ensure_path_unmounted函数的具体用法?C++ ensure_path_unmounted怎么用?C++ ensure_path_unmounted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ensure_path_unmounted函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: format_volume
int format_volume(const char* volume) {
Volume* v = volume_for_path(volume);
if (v == NULL) {
LOGE("unknown volume \"%s\"\n", volume);
return -1;
}
if (strcmp(v->fs_type, "ramdisk") == 0) {
// you can't format the ramdisk.
LOGE("can't format_volume \"%s\"", volume);
return -1;
}
if (strcmp(v->mount_point, volume) != 0) {
LOGE("can't give path \"%s\" to format_volume\n", volume);
return -1;
}
if (ensure_path_unmounted(volume) != 0) {
LOGE("format_volume failed to unmount \"%s\"\n", v->mount_point);
return -1;
}
if (strcmp(v->fs_type, "yaffs2") == 0 || strcmp(v->fs_type, "mtd") == 0) {
mtd_scan_partitions();
const MtdPartition* partition = mtd_find_partition_by_name(v->device);
if (partition == NULL) {
LOGE("format_volume: no MTD partition \"%s\"\n", v->device);
return -1;
}
MtdWriteContext *write = mtd_write_partition(partition);
if (write == NULL) {
LOGW("format_volume: can't open MTD \"%s\"\n", v->device);
return -1;
} else if (mtd_erase_blocks(write, -1) == (off_t) -1) {
LOGW("format_volume: can't erase MTD \"%s\"\n", v->device);
mtd_write_close(write);
return -1;
} else if (mtd_write_close(write)) {
LOGW("format_volume: can't close MTD \"%s\"\n", v->device);
return -1;
}
return 0;
}
if (strcmp(v->fs_type, "ext4") == 0) {
reset_ext4fs_info();
int result = make_ext4fs(v->device, NULL, NULL, 0, 0, 0);
if (result != 0) {
LOGE("format_volume: make_extf4fs failed on %s\n", v->device);
return -1;
}
return 0;
}
LOGE("format_volume: fs_type \"%s\" unsupported\n", v->fs_type);
return -1;
}
开发者ID:onyx-intl,项目名称:p400_bootable,代码行数:57,代码来源:roots.c
示例2: intent_unmount
//INTENT_MOUNT, mount recovery.fstab
static intentResult* intent_unmount(int argc, char* argv[])
{
return_intent_result_if_fail(argc == 1);
return_intent_result_if_fail(argv != NULL);
int result = ensure_path_unmounted(argv[0]);
if (result == 0)
return miuiIntent_result_set(result, "ok");
return miuiIntent_result_set(result, "fail");
}
开发者ID:junjie511,项目名称:miui_recovery,代码行数:10,代码来源:recovery.c
示例3: bml_check_volume
int bml_check_volume(const char *path) {
ui_print("Checking %s...\n", path);
ensure_path_unmounted(path);
if (0 == ensure_path_mounted(path)) {
ensure_path_unmounted(path);
return 0;
}
Volume *vol = volume_for_path(path);
if (vol == NULL) {
LOGE("Unable process volume! Skipping...\n");
return 0;
}
ui_print("%s may be rfs. Checking...\n", path);
char tmp[PATH_MAX];
sprintf(tmp, "mount -t rfs %s %s", vol->device, path);
int ret = __system(tmp);
printf("%d\n", ret);
return ret == 0 ? 1 : 0;
}
开发者ID:ghbhaha,项目名称:mtk6589_bootable_recovery,代码行数:21,代码来源:extendedcommands.c
示例4: nandroid_backup_datamedia
// backup /data/media support
// we reach here only if backup_data_media == 1
// backup_data_media can be set to 1 only in "custom backup and restore" menu AND if is_data_media() && !twrp_backup_mode.value
int nandroid_backup_datamedia(const char* backup_path) {
char tmp[PATH_MAX];
ui_print("\n>> Backing up /data/media...\n");
if (is_data_media_volume_path(backup_path)) {
// non fatal failure
LOGE(" - can't backup folder to its self, skipping...\n");
return 0;
}
if (0 != ensure_path_mounted("/data"))
return -1;
sprintf(tmp, "%s/%s", get_primary_storage_path(), NANDROID_HIDE_PROGRESS_FILE);
ensure_path_mounted(tmp);
int callback = !file_found(tmp);
compute_directory_stats("/data/media");
Volume *v = volume_for_path("/data");
if (v == NULL)
return -1;
char backup_file_image[PATH_MAX];
sprintf(backup_file_image, "%s/datamedia.%s", backup_path, v->fs_type == NULL ? "auto" : v->fs_type);
int fmt;
fmt = nandroid_get_default_backup_format();
if (fmt == NANDROID_BACKUP_FORMAT_TAR) {
sprintf(tmp, "cd / ; touch %s.tar ; set -o pipefail ; (tar -cpv data/media | split -a 1 -b 1000000000 /proc/self/fd/0 %s.tar.) 2> /proc/self/fd/1 ; exit $?",
backup_file_image, backup_file_image);
} else if (fmt == NANDROID_BACKUP_FORMAT_TGZ) {
sprintf(tmp, "cd / ; touch %s.tar.gz ; set -o pipefail ; (tar -cpv data/media | pigz -c -%d | split -a 1 -b 1000000000 /proc/self/fd/0 %s.tar.gz.) 2> /proc/self/fd/1 ; exit $?",
backup_file_image, compression_value.value, backup_file_image);
} else {
// non fatal failure
LOGE(" - backup format must be tar(.gz), skipping...\n");
return 0;
}
int ret;
ret = do_tar_compress(tmp, callback, backup_file_image);
ensure_path_unmounted("/data");
if (0 != ret)
return print_and_error("Failed to backup /data/media!\n", ret);
ui_print("Backup of /data/media completed.\n");
return 0;
}
开发者ID:Shoxxy,项目名称:PhilMeHd7aio,代码行数:52,代码来源:nandroid_advanced.c
示例5: nandroid_restore_partition_extended
int nandroid_restore_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
int ret = 0;
char* name = basename(mount_point);
char tmp[PATH_MAX];
sprintf(tmp, "%s/%s.img", backup_path, name);
struct stat file_info;
if (0 != (ret = statfs(tmp, &file_info))) {
ui_print("%s.img not found. Skipping restore of %s.\n", name, mount_point);
return 0;
}
ensure_directory(mount_point);
int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) != 0;
ui_print("Restoring %s...\n", name);
/*
if (0 != (ret = ensure_root_path_unmounted(root))) {
ui_print("Can't unmount %s!\n", mount_point);
return ret;
}
*/
if (0 != (ret = format_volume(mount_point))) {
ui_print("Error while formatting %s!\n", mount_point);
return ret;
}
if (0 != (ret = ensure_path_mounted(mount_point))) {
ui_print("Can't mount %s!\n", mount_point);
return ret;
}
nandroid_restore_handler restore_handler = get_restore_handler(mount_point);
if (restore_handler == NULL) {
ui_print("Error finding an appropriate restore handler.\n");
return -2;
}
if (0 != (ret = restore_handler(tmp, mount_point, callback))) {
ui_print("Error while restoring %s!\n", mount_point);
return ret;
}
if (umount_when_finished) {
ensure_path_unmounted(mount_point);
}
return 0;
}
开发者ID:rex12345,项目名称:sc02c_cwm_recovery,代码行数:49,代码来源:nandroid.c
示例6: copy_databk_to_data
static int
copy_databk_to_data(){
printf("begin copy databk to data\n");
char *argv_execv[] = {"data_resume.sh", NULL};
ensure_path_mounted("/data");
ensure_path_mounted("/system");
pid_t pid =fork();
if(pid==0){
execv("/system/bin/data_resume.sh",argv_execv);
_exit(-1);
}
int status;
waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
printf("Error (Status %d),fail to resume data\n", WEXITSTATUS(status));
ensure_path_unmounted("/data");
ensure_path_unmounted("/system");
return -1;
}
printf("copy databk to data succeed\n");
ensure_path_unmounted("/data");
ensure_path_unmounted("/system");
return 0;
}
开发者ID:menghang,项目名称:a31_422_v33_android,代码行数:24,代码来源:recovery.cpp
示例7: smdt_update_directory
/* add by cjcheng start... */
static int
smdt_update_directory(const char* path, const char* unmount_when_done,
int* wipe_cache) {
ensure_path_mounted(path);
int result;
char new_path[PATH_MAX];
strlcpy(new_path, path, PATH_MAX);
strlcat(new_path, "/", PATH_MAX);
strlcat(new_path, "update.zip", PATH_MAX);
ui->Print("\n-- Install %s ...\n", new_path);
if (access(new_path, F_OK) == 0) {
ui->Print("\n read -- %s ok...\n", new_path);
ui->SetTipTitle(RecoveryUI::TIP_TITLE_READ_PACKAGE);
} else {
ui->Print("\n read -- %s error...\n", new_path);
if (unmount_when_done != NULL) {
ensure_path_unmounted(unmount_when_done);
}
return INSTALL_ERROR;
}
set_sdcard_update_bootloader_message();
char* copy = copy_sideloaded_package(new_path);
if (unmount_when_done != NULL) {
ensure_path_unmounted(unmount_when_done);
}
if (copy) {
result = install_package(copy, wipe_cache, TEMPORARY_INSTALL_FILE);
free(copy);
} else {
result = INSTALL_ERROR;
}
return result;
}
开发者ID:menghang,项目名称:a31_422_v33_android,代码行数:37,代码来源:recovery.cpp
示例8: finish_recovery
// clear the recovery command and prepare to boot a (hopefully working) system,
// copy our log file to cache as well (for the system to read), and
// record any intent we were asked to communicate back to the system.
// this function is idempotent: call it as many times as you like.
static void
finish_recovery(const char *send_intent) {
// By this point, we're ready to return to the main system...
if (send_intent != NULL) {
FILE *fp = fopen_path(INTENT_FILE, "w");
if (fp == NULL) {
LOGE("Can't open %s\n", INTENT_FILE);
} else {
fputs(send_intent, fp);
check_and_fclose(fp, INTENT_FILE);
}
}
// Save the locale to cache, so if recovery is next started up
// without a --locale argument (eg, directly from the bootloader)
// it will use the last-known locale.
if (locale != NULL) {
LOGI("Saving locale \"%s\"\n", locale);
FILE* fp = fopen_path(LOCALE_FILE, "w");
fwrite(locale, 1, strlen(locale), fp);
fflush(fp);
fsync(fileno(fp));
check_and_fclose(fp, LOCALE_FILE);
}
// Copy logs to cache so the system can find out what happened.
copy_log_file(TEMPORARY_LOG_FILE, LOG_FILE, true);
copy_log_file(TEMPORARY_LOG_FILE, LAST_LOG_FILE, false);
copy_log_file(TEMPORARY_INSTALL_FILE, LAST_INSTALL_FILE, false);
chmod(LOG_FILE, 0600);
chown(LOG_FILE, 1000, 1000); // system user
chmod(LAST_LOG_FILE, 0640);
chmod(LAST_INSTALL_FILE, 0644);
// Reset to normal system boot so recovery won't cycle indefinitely.
struct bootloader_message boot;
memset(&boot, 0, sizeof(boot));
set_bootloader_message(&boot);
// Remove the command file, so recovery won't repeat indefinitely.
if (ensure_path_mounted(COMMAND_FILE) != 0 ||
(unlink(COMMAND_FILE) && errno != ENOENT)) {
LOGW("Can't unlink %s\n", COMMAND_FILE);
}
ensure_path_unmounted(CACHE_ROOT);
sync(); // For good measure.
}
开发者ID:menghang,项目名称:a31_422_v33_android,代码行数:52,代码来源:recovery.cpp
示例9: ensure_path_unmounted
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 && is_data_media ())
{
return ensure_path_unmounted ("/data");
}
LOGE ("unknown volume for path [%s]\n", path);
return -1;
}
if (strcmp (v->fs_type, "ramdisk") == 0)
{
// the ramdisk is always mounted; you can't unmount it.
return -1;
}
int result;
result = scan_mounted_volumes ();
if (result < 0)
{
LOGE ("failed to scan mounted volumes\n");
return -1;
}
const MountedVolume *mv =
find_mounted_volume_by_mount_point (v->mount_point);
if (mv == NULL)
{
// volume is already unmounted
return 0;
}
return unmount_mounted_volume (mv);
}
开发者ID:ProjectOpenCannibal,项目名称:RZrecovery,代码行数:47,代码来源:roots.c
示例10: nandroid_restore_partition_extended
int nandroid_restore_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
int ret = 0;
char* name = basename(mount_point);
char tmp[PATH_MAX];
sprintf(tmp, "%s/%s.img", backup_path, name);
struct stat file_info;
if (0 != (ret = statfs(tmp, &file_info))) {
ui_print("%s.img没有发现. 放弃还原 %s.\n", name, mount_point);
return 0;
}
ensure_directory(mount_point);
unyaffs_callback callback = NULL;
if (0 != stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info)) {
callback = yaffs_callback;
}
ui_print("还原 %s...\n", name);
/*
if (0 != (ret = ensure_root_path_unmounted(root))) {
ui_print("Can't unmount %s!\n", mount_point);
return ret;
}
*/
if (0 != (ret = format_volume(mount_point))) {
ui_print("格式化时出错 %s!\n", mount_point);
return ret;
}
if (0 != (ret = ensure_path_mounted(mount_point))) {
ui_print("不能挂载 %s!\n", mount_point);
return ret;
}
if (0 != (ret = unyaffs(tmp, mount_point, callback))) {
ui_print("还原时出错 %s!\n", mount_point);
return ret;
}
if (umount_when_finished) {
ensure_path_unmounted(mount_point);
}
return 0;
}
开发者ID:ShunYea,项目名称:recovery_chinese,代码行数:47,代码来源:nandroid.c
示例11: nandroid_backup_partition_extended
int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
int ret = 0;
char name[PATH_MAX];
char tmp[PATH_MAX];
strcpy(name, basename(mount_point));
struct stat file_info;
build_configuration_path(tmp, NANDROID_HIDE_PROGRESS_FILE);
ensure_path_mounted(tmp);
int callback = stat(tmp, &file_info) != 0;
ui_print("Backing up %s...\n", name);
if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
ui_print("Can't mount %s!\n", mount_point);
return ret;
}
compute_directory_stats(mount_point);
scan_mounted_volumes();
Volume *v = volume_for_path(mount_point);
const MountedVolume *mv = NULL;
if (v != NULL)
mv = find_mounted_volume_by_mount_point(v->mount_point);
if (strcmp(backup_path, "-") == 0)
sprintf(tmp, "/proc/self/fd/1");
else if (mv == NULL || mv->filesystem == NULL)
sprintf(tmp, "%s/%s.auto", backup_path, name);
else
sprintf(tmp, "%s/%s.%s", backup_path, name, mv->filesystem);
nandroid_backup_handler backup_handler = get_backup_handler(mount_point);
if (backup_handler == NULL) {
ui_print("Error finding an appropriate backup handler.\n");
return -2;
}
ret = backup_handler(mount_point, tmp, callback);
if (umount_when_finished) {
ensure_path_unmounted(mount_point);
}
if (0 != ret) {
ui_print("Error while making a backup image of %s!\n", mount_point);
return ret;
}
ui_print("Backup of %s completed.\n", name);
return 0;
}
开发者ID:iebie,项目名称:bootmenu_z1_and_z1c,代码行数:47,代码来源:nandroid.c
示例12: erase_volume
static int
erase_volume(const char *volume) {
ui->SetBackground(RecoveryUI::INSTALLING);
ui->SetProgressType(RecoveryUI::INDETERMINATE);
ui->Print("Formatting %s...\n", volume);
ensure_path_unmounted(volume);
if (strcmp(volume, "/cache") == 0) {
// Any part of the log we'd copied to cache is now gone.
// Reset the pointer so we copy from the beginning of the temp
// log.
tmplog_offset = 0;
}
return format_volume(volume);
}
开发者ID:Shaaan,项目名称:android_bootable_twrp,代码行数:17,代码来源:recovery.cpp
示例13: erase_volume
static int
erase_volume(const char *volume) {
ui_set_background(BACKGROUND_ICON_INSTALLING);
ui_show_indeterminate_progress();
ui_print("Formatting %s...\n", volume);
ensure_path_unmounted(volume);
if (strcmp(volume, "/cache") == 0) {
// Any part of the log we'd copied to cache is now gone.
// Reset the pointer so we copy from the beginning of the temp
// log.
tmplog_offset = 0;
}
return format_volume(volume);
}
开发者ID:ebmajor,项目名称:msm7627a_2038_recovery,代码行数:17,代码来源:recovery.c
示例14: nandroid_backup_partition_extended
int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
int ret = 0;
char name[PATH_MAX];
strcpy(name, basename(mount_point));
struct stat file_info;
int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) != 0;
ui_print("备份中 %s...\n", name);
if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
ui_print("无法挂载 %s!\n", mount_point);
return ret;
}
compute_directory_stats(mount_point);
char tmp[PATH_MAX];
scan_mounted_volumes();
Volume *v = volume_for_path(mount_point);
MountedVolume *mv = NULL;
if (v != NULL)
mv = find_mounted_volume_by_mount_point(v->mount_point);
if (strcmp(backup_path, "-") == 0)
sprintf(tmp, "/proc/self/fd/1");
else if (mv == NULL || mv->filesystem == NULL)
sprintf(tmp, "%s/%s.auto", backup_path, name);
else
sprintf(tmp, "%s/%s.%s", backup_path, name, mv->filesystem);
nandroid_backup_handler backup_handler = get_backup_handler(mount_point);
if (backup_handler == NULL) {
ui_print("找不到合适的备份方案.\n");
return -2;
}
ret = backup_handler(mount_point, tmp, callback);
if (umount_when_finished) {
ensure_path_unmounted(mount_point);
}
if (0 != ret) {
ui_print("生成下列镜像文件时失败: %s!\n", mount_point);
return ret;
}
ui_print("备份 %s 完成.\n", name);
return 0;
}
开发者ID:Aromer-room,项目名称:mtk6589_recovery_cn,代码行数:45,代码来源:nandroid.c
示例15: setup_install_mounts
int setup_install_mounts() {
if (fstab == NULL) {
LOGE("can't set up install mounts: no fstab loaded\n");
return -1;
}
for (int i = 0; i < fstab->num_entries; ++i) {
Volume* v = fstab->recs + i;
if (strcmp(v->mount_point, "/tmp") == 0 ||
strcmp(v->mount_point, "/cache") == 0) {
if (ensure_path_mounted(v->mount_point) != 0) return -1;
} else {
if (ensure_path_unmounted(v->mount_point) != 0) return -1;
}
}
return 0;
}
开发者ID:MonsieurCode,项目名称:udoo-quad-kitkat,代码行数:18,代码来源:roots.cpp
示例16: erase_dalvik_cache
void erase_dalvik_cache(int orscallback) {
if(orscallback && orswipeprompt && !confirm_selection("Confirm wipe?","Yes- Wipe Dalvik Cache")) {
ui_print("Skipping dalvik cache wipe...\n");
return;
}
if (0 != ensure_path_mounted("/data"))
return;
ensure_path_mounted("/sd-ext");
ensure_path_mounted("/cache");
__system("rm -r /data/dalvik-cache");
__system("rm -r /cache/dalvik-cache");
__system("rm -r /sd-ext/dalvik-cache");
ui_print("Dalvik Cache wiped.\n");
ensure_path_unmounted("/data");
return;
}
开发者ID:fjy2003,项目名称:COT_bootable_recovery_touch,代码行数:19,代码来源:eraseandformat.c
示例17: verify_root_and_recovery
int verify_root_and_recovery() {
if (ensure_path_mounted("/system") != 0)
return 0;
int ret = 0;
struct stat st;
if (0 == lstat("/system/etc/install-recovery.sh", &st)) {
if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
ui_show_text(1);
ret = 1;
if (confirm_selection("ROM may flash stock recovery on boot. Fix?", "Yes - Disable recovery flash")) {
__system("chmod -x /system/etc/install-recovery.sh");
}
}
}
if (0 == lstat("/system/bin/su", &st)) {
if (S_ISREG(st.st_mode)) {
if ((st.st_mode & (S_ISUID | S_ISGID)) != (S_ISUID | S_ISGID)) {
ui_show_text(1);
ret = 1;
if (confirm_selection("Root access possibly lost. Fix?", "Yes - Fix root (/system/bin/su)")) {
__system("chmod 6755 /system/bin/su");
}
}
}
}
if (0 == lstat("/system/xbin/su", &st)) {
if (S_ISREG(st.st_mode)) {
if ((st.st_mode & (S_ISUID | S_ISGID)) != (S_ISUID | S_ISGID)) {
ui_show_text(1);
ret = 1;
if (confirm_selection("Root access possibly lost. Fix?", "Yes - Fix root (/system/xbin/su)")) {
__system("chmod 6755 /system/xbin/su");
}
}
}
}
ensure_path_unmounted("/system");
return ret;
}
开发者ID:zeroknight2014,项目名称:Samsung_s5830_android_bootable_recovery,代码行数:43,代码来源:extendedcommands.c
示例18: tw_reboot
// reboot: Reboot the system. Return -1 on error, no return on success
int tw_reboot(RebootCommand command)
{
if (DataManager_GetIntValue(TW_BACKUP_SYSTEM_SIZE) < DataManager_GetIntValue(TW_MIN_SYSTEM_VAR)) {
update_system_details();
if (DataManager_GetIntValue(TW_BACKUP_SYSTEM_SIZE) < DataManager_GetIntValue(TW_MIN_SYSTEM_VAR)) {
LOGE("System is not installed - preventing reboot!\n");
return -1;
}
}
// Always force a sync before we reboot
sync();
ensure_path_unmounted("/sdcard");
switch (command)
{
case rb_current:
case rb_system:
finish_recovery("s");
sync();
check_and_run_script("/sbin/rebootsystem.sh", "reboot system");
return reboot(RB_AUTOBOOT);
case rb_recovery:
check_and_run_script("/sbin/rebootrecovery.sh", "reboot recovery");
return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "recovery");
case rb_bootloader:
check_and_run_script("/sbin/rebootbootloader.sh", "reboot bootloader");
return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "bootloader");
case rb_poweroff:
check_and_run_script("/sbin/poweroff.sh", "power off");
return reboot(RB_POWER_OFF);
case rb_download:
check_and_run_script("/sbin/rebootdownload.sh", "reboot download");
return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "download");
return 1;
default:
return -1;
}
return -1;
}
开发者ID:Borkata,项目名称:linux,代码行数:42,代码来源:reboot.c
示例19: device_toggle_truedualboot
void device_toggle_truedualboot(void) {
char confirm[PATH_MAX];
int enable = dualboot_is_tdb_enabled();
#ifndef PHILZ_TOUCH_RECOVERY
ui_setMenuTextColor(MENU_TEXT_COLOR_RED);
#endif
sprintf(confirm, "Yes - %s TrueDualBoot", enable?"DISABLE":"ENABLE");
if (confirm_selection("This will WIPE DATA. Confirm?", confirm)) {
// unmount /data
if(ensure_path_unmounted("/data")!=0) {
LOGE("Error unmounting /data!\n");
return;
}
// format /data
ui_set_background(BACKGROUND_ICON_INSTALLING);
ui_show_indeterminate_progress();
ui_print("Formatting /data...\n");
set_force_raw_format_enabled(1);
if(format_volume("/data")!=0) {
ui_print("Error formatting /data!\n");
ui_reset_progress();
return;
}
ui_reset_progress();
set_force_raw_format_enabled(0);
ui_print("Done.\n");
// toggle
dualboot_set_tdb_enabled(!enable);
}
#ifndef PHILZ_TOUCH_RECOVERY
ui_setMenuTextColor(MENU_TEXT_COLOR);
#endif
return;
}
开发者ID:Rohirimor,项目名称:android_device_xiaomi_mione_plus-carbon,代码行数:41,代码来源:recovery_ui.c
示例20: nandroid_backup_partition_extended
int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
int ret = 0;
char name[PATH_MAX];
strcpy(name, basename(mount_point));
ensure_path_mounted("/sdcard");
struct stat file_info;
int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) != 0;
ui_print("Backing up %s...\n", name);
if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
ui_print("Can't mount %s!\n", mount_point);
return ret;
}
compute_directory_stats(mount_point);
char tmp[PATH_MAX];
scan_mounted_volumes();
Volume *v = volume_for_path(mount_point);
MountedVolume *mv = NULL;
if (v != NULL)
mv = find_mounted_volume_by_mount_point(v->mount_point);
if (mv == NULL || mv->filesystem == NULL)
sprintf(tmp, "%s/%s.auto", backup_path, name);
else
sprintf(tmp, "%s/%s.%s", backup_path, name, mv->filesystem);
nandroid_backup_handler backup_handler = get_backup_handler(mount_point);
if (backup_handler == NULL) {
ui_print("Error finding an appropriate backup handler.\n");
return -2;
}
ret = backup_handler(mount_point, tmp, callback);
if (umount_when_finished) {
ensure_path_unmounted(mount_point);
}
if (0 != ret) {
ui_print("Error while making a backup image of %s!\n", mount_point);
return ret;
}
ui_print("Backup of %s completed.\n", name);
return 0;
}
开发者ID:regina-book,项目名称:touch_recovery_cm10,代码行数:41,代码来源:nandroid.c
注:本文中的ensure_path_unmounted函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论