int nandroid_restore_partition_extended(const char* backup_path, const char* root, int umount_when_finished) { int ret; char mount_point[PATH_MAX]; translate_root_path(root, mount_point, PATH_MAX); 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); unyaffs_callback callback = NULL; if (0 != stat("/sdcard/ebrecovery/.hidenandroidprogress", &file_info)) { callback = yaffs_callback; } 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_root_device(root))) { ui_print("Error while formatting %s!\n", root); return ret; } if (0 != (ret = ensure_root_path_mounted(root))) { ui_print("Can't mount %s!\n", mount_point); return ret; } if (0 != (ret = unyaffs(tmp, mount_point, callback))) { ui_print("Error while restoring %s!\n", mount_point); return ret; } if (umount_when_finished) { ensure_root_path_unmounted(root); } return 0; }
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; }
static int unyaffs_wrapper(const char* backup_file_image, const char* backup_path, int callback) { return unyaffs(backup_file_image, backup_path, callback ? yaffs_callback : NULL); }
static int unyaffs_wrapper(const char* backup_file_image, const char* backup_path, int callback) { gettimeofday(&lastupdate,NULL); return unyaffs(backup_file_image, backup_path, callback ? yaffs_callback : NULL); }