PCI IDE driver, new create_volume () syscall, test scripts
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m37s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m37s
This commit is contained in:
38
ce/interp.c
38
ce/interp.c
@@ -8,6 +8,7 @@
|
||||
#include <desc.h>
|
||||
#include <filereader.h>
|
||||
#include <filewriter.h>
|
||||
#include <fs_types.h>
|
||||
#include <kb.h>
|
||||
#include <liballoc.h>
|
||||
#include <path.h>
|
||||
@@ -272,6 +273,27 @@ 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 {
|
||||
cprintf (context, "Unknown filesystem '%s'\n", str_fs_type);
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = create_volume (volume, fs_type, device);
|
||||
|
||||
if (ret < 0)
|
||||
cprintf (context, "Could not create volume: %s\n", str_status[-ret]);
|
||||
}
|
||||
|
||||
static void help (struct context* context) {
|
||||
cprintf (context, "Available commands:\n");
|
||||
cprintf (context, "help\n");
|
||||
@@ -284,6 +306,7 @@ 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, "quit\n");
|
||||
}
|
||||
|
||||
@@ -309,7 +332,10 @@ static void execute_cmd (struct ast_cmd* cmd, struct context* context) {
|
||||
} else if (strcmp (cmd->name, "cat") == 0) {
|
||||
cat (context, cmd->args, cmd->arg_count);
|
||||
} else if (strcmp (cmd->name, "ls") == 0) {
|
||||
ls (context, cmd->args[0]);
|
||||
if (cmd->args[0] != NULL)
|
||||
ls (context, cmd->args[0]);
|
||||
else
|
||||
cprintf (context, "No directory path provided\n");
|
||||
} else if (strcmp (cmd->name, "quit") == 0) {
|
||||
quit1 (context);
|
||||
} else if (strcmp (cmd->name, "mkfile") == 0) {
|
||||
@@ -319,11 +345,19 @@ static void execute_cmd (struct ast_cmd* cmd, struct context* context) {
|
||||
} else if (strcmp (cmd->name, "rm") == 0) {
|
||||
rm (context, cmd->args, cmd->arg_count);
|
||||
} else if (strcmp (cmd->name, "edit") == 0) {
|
||||
edit (context, cmd->args[0]);
|
||||
if (cmd->args[0] != NULL)
|
||||
edit (context, cmd->args[0]);
|
||||
else
|
||||
cprintf (context, "No file path provided\n");
|
||||
} else if (strcmp (cmd->name, "terminfo") == 0) {
|
||||
terminfo (context);
|
||||
} else if (strcmp (cmd->name, "cls") == 0) {
|
||||
cls (context);
|
||||
} else if (strcmp (cmd->name, "mkvol") == 0) {
|
||||
if ((cmd->args[0] != NULL) && (cmd->args[1] != NULL) && (cmd->args[2] != NULL))
|
||||
mkvol (context, cmd->args[0], cmd->args[1], cmd->args[2]);
|
||||
else
|
||||
cprintf (context, "No volume key, filesystem type or device key provided\n");
|
||||
} else {
|
||||
char volume[VOLUME_MAX];
|
||||
const char* path;
|
||||
|
||||
Reference in New Issue
Block a user