diff options
Diffstat (limited to 'lib/fs/debug.c')
-rw-r--r-- | lib/fs/debug.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/fs/debug.c b/lib/fs/debug.c index 85990fee..b89eee83 100644 --- a/lib/fs/debug.c +++ b/lib/fs/debug.c @@ -27,6 +27,7 @@ #include <stdio.h> #include <stdlib.h> #include <platform.h> +#include <err.h> static void test_normalize(const char *in) { @@ -88,6 +89,7 @@ usage: printf("%s mount <path> <type> [device]\n", argv[0].str); printf("%s unmount <path>\n", argv[0].str); printf("%s write <path> <string> [<offset>]\n", argv[0].str); + printf("%s format <type> [device]\n", argv[0].str); return -1; } @@ -115,6 +117,23 @@ usage: printf("error %d unmounting device\n", err); return err; } + } else if (!strcmp(argv[1].str, "format")) { + int err; + + if (argc < 3) + goto notenoughargs; + + err = fs_format_device( + argv[2].str, + (argc >= 4) ? argv[3].str : NULL, + NULL + ); + + if (err != NO_ERROR) { + printf("error %d formatting device\n", err); + return err; + } + } else if (!strcmp(argv[1].str, "write")) { int err; off_t off; |