static struct blocklevel_device *arch_init_blocklevel(const char *file) { int rc; struct blocklevel_device *new_bl = NULL; char *real_file = NULL; if (!file) { rc = get_dev_mtd(FDT_FLASH_PATH, &real_file); if (rc) return NULL; } file_init_path(file ? file : real_file, NULL, &new_bl); free(real_file); return new_bl; }
int arch_flash_init(struct blocklevel_device **r_bl, const char *file, bool keep_alive) { int rc; struct blocklevel_device *new_bl; /* Must have passed through a file to operate on */ if (!file) { fprintf(stderr, "Cannot operate without a file\n"); return -1; } rc = file_init_path(file, NULL, keep_alive, &new_bl); if (rc) return -1; *r_bl = new_bl; return 0; }