volumes Move volume management code to a specialized app
This commit is contained in:
29
ce/interp.c
29
ce/interp.c
@@ -395,29 +395,6 @@ static void quit1(struct context* context) {
|
||||
|
||||
static void cls(struct context* context) { cprintf(context, ANSIQ_CUR_HOME ANSIQ_SCR_CLR_ALL); }
|
||||
|
||||
static void mkvol(struct context* context, const char* volume, const char* str_fs_type,
|
||||
const char* device) {
|
||||
int fs_type;
|
||||
|
||||
if (strcmp(str_fs_type, "tar") == 0) {
|
||||
fs_type = FS_TARFS;
|
||||
} else if (strcmp(str_fs_type, "fat16") == 0) {
|
||||
fs_type = FS_FAT16;
|
||||
} else if (strcmp(str_fs_type, "fat32") == 0) {
|
||||
fs_type = FS_FAT32;
|
||||
} else if (strcmp(str_fs_type, "iso9660") == 0) {
|
||||
fs_type = FS_ISO9660;
|
||||
} else {
|
||||
cprintf(context, "ERROR Unknown filesystem '%s'\n", str_fs_type);
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = create_volume(volume, fs_type, device);
|
||||
|
||||
if (ret < 0)
|
||||
cprintf(context, "ERROR Could not create volume: %s\n", str_status[-ret]);
|
||||
}
|
||||
|
||||
static void stall(uint64_t ms) { stall_ms(ms); }
|
||||
|
||||
static void help(struct context* context) {
|
||||
@@ -432,7 +409,6 @@ static void help(struct context* context) {
|
||||
cprintf(context, "edit <path>\n");
|
||||
cprintf(context, "terminfo\n");
|
||||
cprintf(context, "cls\n");
|
||||
cprintf(context, "mkvol <volume> <filesystem> <device>\n");
|
||||
cprintf(context, "procinfo\n");
|
||||
cprintf(context, "quit\n");
|
||||
cprintf(context, "stall <milliseconds>\n");
|
||||
@@ -504,11 +480,6 @@ static void execute_cmd(struct ast_cmd* cmd, struct context* context, bool run_b
|
||||
terminfo(context);
|
||||
} else if (strcmp(cmd->name, "cls") == 0) {
|
||||
cls(context);
|
||||
} else if (strcmp(cmd->name, "mkvol") == 0) {
|
||||
if (cmd->arg_count == 3)
|
||||
mkvol(context, cmd->args[0], cmd->args[1], cmd->args[2]);
|
||||
else
|
||||
cprintf(context, "ERROR No volume key, filesystem type or device key provided\n");
|
||||
} else if (strcmp(cmd->name, "procinfo") == 0) {
|
||||
procinfo(context);
|
||||
} else if (strcmp(cmd->name, "stall") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user