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.
43 lines
682 B
43 lines
682 B
8 years ago
|
#include <ctype.h>
|
||
|
#include <stdint.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
#include <errno.h>
|
||
|
|
||
|
#include <flash.h>
|
||
|
#include <macros.h>
|
||
|
#include <shell.h>
|
||
|
|
||
|
#include <fs/part.h>
|
||
|
|
||
|
static void do_part_create(const char *s);
|
||
|
|
||
|
static struct cmd part_cmds[] = {
|
||
|
{ "create", do_part_create },
|
||
|
{ NULL, NULL },
|
||
|
};
|
||
|
|
||
|
extern struct flash_dev *flash;
|
||
|
|
||
|
static void do_part_create(const char *s)
|
||
|
{
|
||
|
(void)s;
|
||
|
|
||
|
if (!flash) {
|
||
|
fprintf(stderr, "error: no flash device probed.\n");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (part_create(flash) != 0) {
|
||
|
fprintf(stderr, "error: unable to create partition table.\n");
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void do_part_cmd(const char *line)
|
||
|
{
|
||
|
cmd_exec(part_cmds, line);
|
||
|
}
|