2025-04-23 22:51:00 +03:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
enum fs_filetype {
|
|
|
|
REGULAR,
|
|
|
|
DIRECTORY
|
|
|
|
};
|
|
|
|
|
|
|
|
__attribute__((packed))
|
|
|
|
struct fs_header {
|
|
|
|
unsigned char version;
|
|
|
|
unsigned int max_inode_count:24;
|
|
|
|
unsigned int block_count;
|
|
|
|
unsigned int next_extension;
|
|
|
|
unsigned int inode_ptrs[(FS_BLOCK_SIZE-sizeof(int)*3) / sizeof(int)];
|
|
|
|
};
|
|
|
|
|
2025-04-24 21:40:16 +03:00
|
|
|
__attribute__((packed))
|
2025-04-23 22:51:00 +03:00
|
|
|
struct fs_header_extension {
|
|
|
|
unsigned int next_extension;
|
|
|
|
unsigned int inode_ptrs[(FS_BLOCK_SIZE-sizeof(int)) / sizeof(int)];
|
|
|
|
};
|
|
|
|
|
|
|
|
__attribute__((packed))
|
|
|
|
struct fs_inode {
|
|
|
|
unsigned int ftype:8;
|
|
|
|
unsigned int ref_count:24;
|
|
|
|
unsigned int size;
|
|
|
|
unsigned int next_extension;
|
|
|
|
unsigned int blocks[(FS_BLOCK_SIZE-sizeof(int)*3) / sizeof(int)];
|
|
|
|
};
|
|
|
|
|
2025-04-24 21:40:16 +03:00
|
|
|
__attribute__((packed))
|
2025-04-23 22:51:00 +03:00
|
|
|
struct fs_inode_extension {
|
|
|
|
unsigned int next_extension;
|
|
|
|
unsigned int blocks[(FS_BLOCK_SIZE-sizeof(int)) / sizeof(int)];
|
|
|
|
};
|
|
|
|
|
2025-04-24 21:40:16 +03:00
|
|
|
__attribute__((packed))
|
2025-04-25 21:41:08 +03:00
|
|
|
struct fs_directory_record {
|
2025-04-24 21:40:16 +03:00
|
|
|
unsigned char fname[60];
|
|
|
|
unsigned int inode_no;
|
|
|
|
};
|
|
|
|
|
|
|
|
char *fs_get_cwd(void);
|
|
|
|
|
2025-04-23 22:51:00 +03:00
|
|
|
int fs_create(void *d);
|
2025-04-25 21:41:08 +03:00
|
|
|
int fs_ln(void *);
|
2025-04-23 22:51:00 +03:00
|
|
|
int fs_use(void *d);
|
|
|
|
int fs_mkfs(void *d);
|
2025-04-25 21:41:08 +03:00
|
|
|
int fs_ls(void *d);
|
|
|
|
int fs_la(void *d);
|
2025-04-26 10:21:23 +03:00
|
|
|
int fs_rm(void *d);
|
2025-04-23 22:51:00 +03:00
|
|
|
int fs_allow_write(void *d);
|
|
|
|
int fs_prohibit_write(void *d);
|