You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.0 KiB
62 lines
1.0 KiB
#include <ctype.h>
|
|
#include <inttypes.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <flash.h>
|
|
#include <ftl.h>
|
|
#include <macros.h>
|
|
#include <shell.h>
|
|
|
|
#include <fs/mufs.h>
|
|
|
|
static void do_mufs_mount(const char *s);
|
|
static void do_mufs_format(const char *s);
|
|
|
|
static struct cmd mufs_cmds[] = {
|
|
{ "mount", do_mufs_mount },
|
|
{ "format", do_mufs_format },
|
|
{ NULL, NULL },
|
|
};
|
|
|
|
extern struct flash_dev *flash;
|
|
struct mufs mufs;
|
|
|
|
static void do_mufs_mount(const char *s)
|
|
{
|
|
(void)s;
|
|
|
|
if (!flash) {
|
|
fprintf(stderr, "error: no flash device probed.\n");
|
|
return;
|
|
}
|
|
|
|
if (mufs_mount(&mufs, flash) < 0) {
|
|
fprintf(stderr, "error: unable to mount the filesystem.\n");
|
|
return;
|
|
}
|
|
}
|
|
|
|
static void do_mufs_format(const char *s)
|
|
{
|
|
(void)s;
|
|
|
|
if (!flash) {
|
|
fprintf(stderr, "error: no flash device probed.\n");
|
|
return;
|
|
}
|
|
|
|
if (mufs_format(flash) < 0) {
|
|
fprintf(stderr, "error: unable to format the flash device.\n");
|
|
return;
|
|
}
|
|
}
|
|
|
|
void do_mufs_cmd(const char *line)
|
|
{
|
|
cmd_exec(mufs_cmds, line);
|
|
}
|
|
|