16 Commits

5 changed files with 1251 additions and 171 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
#ifndef CONFIG_FILE #ifndef CONFIG_FILE
#define CONFIG_FILE #define CONFIG_FILE
/* Global config options */ /* Global config options */
#define DEBUG 1 #define DEBUG 1
#define LOG_LEVEL 4 #define LOG_LEVEL 4
@@ -20,9 +21,11 @@
/* FS config section */ /* FS config section */
#define FS_MAX_DEVICE_FILE_NAME_LEN 512 #define FS_MAX_DEVICE_FILE_NAME_LEN 512
#define FS_BLOCK_SIZE 4096 #define FS_BLOCK_SIZE 16
#define FS_MAX_BITMAP_SIZE 64 #define FS_MAX_BITMAP_SIZE 64
#define FS_MAX_PATH_LEN 512 #define FS_MAX_PATH_LEN 512
#define FS_MAX_OPEN_FD 32
#define FS_MAX_FNAME_LEN 11
#endif #endif
+14 -1
View File
@@ -37,10 +37,15 @@ struct fs_inode_extension {
__attribute__((packed)) __attribute__((packed))
struct fs_directory_record { struct fs_directory_record {
unsigned char fname[60]; unsigned char fname[FS_MAX_FNAME_LEN+1];
unsigned int inode_no; unsigned int inode_no;
}; };
struct fs_file_description {
unsigned int inode;
unsigned int rw_offset;
};
char *fs_get_cwd(void); char *fs_get_cwd(void);
int fs_create(void *d); int fs_create(void *d);
@@ -49,5 +54,13 @@ int fs_use(void *d);
int fs_mkfs(void *d); int fs_mkfs(void *d);
int fs_ls(void *d); int fs_ls(void *d);
int fs_la(void *d); int fs_la(void *d);
int fs_stat(void *d);
int fs_rm(void *d);
int fs_open(void *d);
int fs_seek(void *d);
int fs_read(void *d);
int fs_write(void *d);
int fs_close(void *d);
int fs_truncate(void *d);
int fs_allow_write(void *d); int fs_allow_write(void *d);
int fs_prohibit_write(void *d); int fs_prohibit_write(void *d);
+4
View File
@@ -3,6 +3,8 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include "config.h" #include "config.h"
#include "color.h" #include "color.h"
@@ -15,8 +17,10 @@
#if ENABLE_STDOUT == 1 #if ENABLE_STDOUT == 1
#define pr_stdout(...) { printf(__VA_ARGS__); } #define pr_stdout(...) { printf(__VA_ARGS__); }
#define write_stdout(data, size) { write(1, (data), (size)); }
#else #else
#define pr_stdout(...) {} #define pr_stdout(...) {}
#define write_stdout(data, size) {}
#endif #endif
+8
View File
@@ -15,8 +15,16 @@ static const struct CliCommandEntry cmd[] = {
// mandatory commands // mandatory commands
{"mkfs", 1, (enum CliArgType[]) {INT}, fs_mkfs}, {"mkfs", 1, (enum CliArgType[]) {INT}, fs_mkfs},
{"create", 1, (enum CliArgType[]) {STR}, fs_create}, {"create", 1, (enum CliArgType[]) {STR}, fs_create},
{"stat", 1, (enum CliArgType[]) {STR}, fs_stat},
{"ls", 0, NULL, fs_ls}, {"ls", 0, NULL, fs_ls},
{"ln", 2, (enum CliArgType[]) {STR, STR}, fs_ln}, {"ln", 2, (enum CliArgType[]) {STR, STR}, fs_ln},
{"rm", 1, (enum CliArgType[]) {STR}, fs_rm},
{"truncate", 2, (enum CliArgType[]) {STR, INT}, fs_truncate},
{"open", 1, (enum CliArgType[]) {STR}, fs_open},
{"seek", 2, (enum CliArgType[]) {INT, INT}, fs_seek},
{"read", 2, (enum CliArgType[]) {INT, INT}, fs_read},
{"write", 2, (enum CliArgType[]) {INT, STR}, fs_write},
{"close", 1, (enum CliArgType[]) {INT}, fs_close},
// custom commands // custom commands
{"use", 1, (enum CliArgType[]) {STR}, fs_use}, {"use", 1, (enum CliArgType[]) {STR}, fs_use},
+1212 -160
View File
File diff suppressed because it is too large Load Diff