#include #include #include #include #include #include #include #include #include #include #include #include extern struct flash_dev *flash; static int do_ftl_probe(struct console *con, size_t argc, const char **argv) { (void)argv; (void)argc; if (flash) { flash_release(flash); flash = NULL; } if (!(flash = flash_probe())) { fprintf(con->fp, "error: unable to probe the flash device.\n"); return -1; } if (!(flash = ftl_mount(flash))) { fprintf(con->fp, "error: unable to mount the flash translation layer.\n"); return -1; } return 0; } static struct cmd ftl_cmds[] = { { "probe", NULL, do_ftl_probe }, { NULL, NULL, NULL }, }; int do_ftl_cmd(struct console *con, size_t argc, const char **argv) { if (argc < 1) { fprintf(con->fp, "usage: flash \n"); return -1; } return cmd_exec(ftl_cmds, con, argc, argv); }