Compare commits
14 Commits
447a1448ad
...
lab4
| Author | SHA1 | Date | |
|---|---|---|---|
| a90f09ff6e | |||
| 0a14404160 | |||
| c296e6e93d | |||
| 0315963125 | |||
| e39815a2e7 | |||
| ba8f8031f0 | |||
| 60a2815f3a | |||
| dc611bb787 | |||
| 3ee64e5b5d | |||
| 3b3ce23df0 | |||
| 87f3239c52 | |||
| 4f610340f5 | |||
| 4de89d57f1 | |||
| ef7f9ff553 |
@@ -1,6 +1,7 @@
|
||||
#ifndef CONFIG_FILE
|
||||
#define CONFIG_FILE
|
||||
|
||||
|
||||
/* Global config options */
|
||||
#define DEBUG 1
|
||||
#define LOG_LEVEL 4
|
||||
@@ -20,9 +21,11 @@
|
||||
|
||||
/* FS config section */
|
||||
#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_PATH_LEN 512
|
||||
#define FS_MAX_OPEN_FD 32
|
||||
#define FS_MAX_FNAME_LEN 11
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,10 +37,15 @@ struct fs_inode_extension {
|
||||
|
||||
__attribute__((packed))
|
||||
struct fs_directory_record {
|
||||
unsigned char fname[60];
|
||||
unsigned char fname[FS_MAX_FNAME_LEN+1];
|
||||
unsigned int inode_no;
|
||||
};
|
||||
|
||||
struct fs_file_description {
|
||||
unsigned int inode;
|
||||
unsigned int rw_offset;
|
||||
};
|
||||
|
||||
char *fs_get_cwd(void);
|
||||
|
||||
int fs_create(void *d);
|
||||
@@ -49,6 +54,13 @@ int fs_use(void *d);
|
||||
int fs_mkfs(void *d);
|
||||
int fs_ls(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_prohibit_write(void *d);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "color.h"
|
||||
|
||||
@@ -15,8 +17,10 @@
|
||||
|
||||
#if ENABLE_STDOUT == 1
|
||||
#define pr_stdout(...) { printf(__VA_ARGS__); }
|
||||
#define write_stdout(data, size) { write(1, (data), (size)); }
|
||||
#else
|
||||
#define pr_stdout(...) {}
|
||||
#define write_stdout(data, size) {}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,16 @@ static const struct CliCommandEntry cmd[] = {
|
||||
// mandatory commands
|
||||
{"mkfs", 1, (enum CliArgType[]) {INT}, fs_mkfs},
|
||||
{"create", 1, (enum CliArgType[]) {STR}, fs_create},
|
||||
{"stat", 1, (enum CliArgType[]) {STR}, fs_stat},
|
||||
{"ls", 0, NULL, fs_ls},
|
||||
{"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
|
||||
{"use", 1, (enum CliArgType[]) {STR}, fs_use},
|
||||
|
||||
Reference in New Issue
Block a user