shell: ftl: change mount command to probe and probe a flash device with FTL enabled
This commit is contained in:
parent
b55fea5379
commit
2bae987d27
1 changed files with 11 additions and 6 deletions
|
@ -12,26 +12,31 @@
|
|||
#include <macros.h>
|
||||
#include <shell.h>
|
||||
|
||||
static void do_ftl_mount(const char *s);
|
||||
static void do_ftl_probe(const char *s);
|
||||
|
||||
static struct cmd ftl_cmds[] = {
|
||||
{ "mount", do_ftl_mount },
|
||||
{ "probe", do_ftl_probe },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
extern struct flash_dev *flash;
|
||||
|
||||
static void do_ftl_mount(const char *s)
|
||||
static void do_ftl_probe(const char *s)
|
||||
{
|
||||
(void)s;
|
||||
|
||||
if (!flash) {
|
||||
fprintf(stderr, "error: no flash device probed.\n");
|
||||
if (flash) {
|
||||
flash_release(flash);
|
||||
flash = NULL;
|
||||
}
|
||||
|
||||
if (!(flash = flash_probe())) {
|
||||
fprintf(stderr, "error: unable to probe the flash device.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(flash = ftl_mount(flash))) {
|
||||
fprintf(stderr, "error: unable to mount the device.\n");
|
||||
fprintf(stderr, "error: unable to mount the flash translation layer.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue