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))
|
|
|
|
struct fs_directory_block_data {
|
|
|
|
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);
|
|
|
|
int fs_use(void *d);
|
|
|
|
int fs_mkfs(void *d);
|
|
|
|
int fs_allow_write(void *d);
|
|
|
|
int fs_prohibit_write(void *d);
|