shell: ftl: change mount command to probe and probe a flash device with FTL enabled

tags/0.1.0
S.J.R. van Schaik 8 years ago
parent b55fea5379
commit 2bae987d27
  1. 17
      source/shell/ftl.c

@ -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…
Cancel
Save