int download_ex(u32 data_length)//Big image and parallel transfer. { thread_t *thr; init_engine_context(&ctx); init_sto_info(&sto_info, FALSE); //no checksum enabled. sto_info.to_write_data_len = data_length; thr = thread_create("fastboot", write_storage_proc, 0, DEFAULT_PRIORITY, 16*1024); if (!thr) { return -1; } thread_resume(thr); TIME_START; read_usb_proc(&data_length); //wait for write thread end. event_wait(&ctx.thr_end_ev); destroy_engine(&ctx); if(ctx.b_error) { fastboot_fail_wrapper("\n@DOWNLOAD ERROR@\nPlease re-plug your USB cable\n"); fastboot_state = STATE_ERROR; }else { fastboot_okay(""); } return 0; }
static void reload_engine(ENGINE_HANDLE **h, ENGINE_HANDLE_V1 **h1, const char* engine, const char *cfg, bool init) { destroy_engine(); handle_v1 = start_your_engines(engine, cfg, init); handle = (ENGINE_HANDLE*)(handle_v1); *h1 = handle_v1; *h = handle; }
static enum test_result run_test(engine_test_t test, const char *engine, const char *default_cfg) { enum test_result ret = PENDING; if (test.tfun != NULL) { #if !defined(USE_GCOV) && !defined(WIN32) pid_t pid = fork(); if (pid == 0) { #endif /* Start the engines and go */ start_your_engines(engine, test.cfg ? test.cfg : default_cfg, true); if (test.test_setup != NULL) { if (!test.test_setup(handle, handle_v1)) { fprintf(stderr, "Failed to run setup for test %s\n", test.name); return FAIL; } } ret = test.tfun(handle, handle_v1); if (test.test_teardown != NULL) { if (!test.test_teardown(handle, handle_v1)) { fprintf(stderr, "WARNING: Failed to run teardown for test %s\n", test.name); } } destroy_engine(false); #if !defined(USE_GCOV) && !defined(WIN32) exit((int)ret); } else if (pid == (pid_t)-1) { ret = FAIL; } else { int rc; while (alarmed == 0 && waitpid(pid, &rc, 0) == (pid_t)-1) { if (errno != EINTR) { abort(); } } if (alarmed) { kill(pid, 9); ret = TIMEOUT; } else if (WIFEXITED(rc)) { ret = (enum test_result)WEXITSTATUS(rc); } else if (WIFSIGNALED(rc) && WCOREDUMP(rc)) { ret = CORE; } else { ret = DIED; } } #endif } return ret; }
int download_ex(u32 data_length)//Big image and parallel transfer. { thread_t *thr; init_engine_context(&ctx); init_sto_info(&sto_info, FALSE); //no checksum enabled. sto_info.to_write_data_len = data_length; enable_security(&ctx, FALSE); //Modify the security step according to some variable. //set_security_step(&ctx, S_CHECK_ONLY); set_security_step(&ctx, S_CHECK_AND_DOWNLOAD); //now is one step to security download. thr = thread_create("fastboot", write_storage_proc, 0, DEFAULT_PRIORITY, 16*1024); if (!thr) { return -1; } thread_resume(thr); TIME_START; read_usb_proc(&data_length); //wait for write thread end. event_wait(&ctx.thr_end_ev); destroy_engine(&ctx); if(ctx.b_error) { fastboot_fail_wrapper("\n@DOWNLOAD ERROR@"); } else { fastboot_okay(""); } }
static gboolean theme_engine_destroy(ThemeEngine* engine) { destroy_engine(engine); return FALSE; }