2024-10-08 23:01:29 +02:00
|
|
|
#ifndef SUPER_H_
|
|
|
|
#define SUPER_H_
|
|
|
|
|
|
|
|
#include "util.h"
|
2024-10-19 19:52:24 +02:00
|
|
|
#include "inode.h"
|
2024-10-08 23:01:29 +02:00
|
|
|
|
|
|
|
// fs attributes
|
|
|
|
#define MAGIC 0x7F631EC4
|
|
|
|
#define VERSION 0.0.0.1
|
|
|
|
#define BLOCKSIZE 4096
|
|
|
|
|
|
|
|
uint32_t free_blocks;
|
|
|
|
uint32_t inode_count;
|
|
|
|
|
2024-10-19 19:52:24 +02:00
|
|
|
struct inode_table {
|
|
|
|
// TODO: Change currently hardcoded value to actually accurately describe the size of the filesystem, only for temporary purposes.
|
|
|
|
Inode* inodes[640000];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct super_block {
|
|
|
|
// fs info
|
|
|
|
char version[8];
|
|
|
|
uint64_t magic;
|
|
|
|
// fs attributes
|
|
|
|
uint16_t blocksize;
|
|
|
|
uint64_t block_count;
|
|
|
|
uint64_t free_bloks;
|
|
|
|
uint64_t inode_count;
|
|
|
|
uint64_t free_inodes;
|
|
|
|
// Timestamps
|
|
|
|
tm fs_creation;
|
|
|
|
tm last_write;
|
|
|
|
|
|
|
|
// inode table
|
|
|
|
struct inode_table* inode_table;
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: Do research on how the fuck to actually do this kind of Array operation
|
|
|
|
Inode* find_inode(char filename[], struct super_block sblock) {
|
|
|
|
struct inode_table* itable = sblock.inode_table;
|
|
|
|
// while (itable[inode] != NULL; inode++) {
|
|
|
|
// if (strcmp(filename, itable[inode]->filesize))
|
|
|
|
// }
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-10-08 23:01:29 +02:00
|
|
|
|
|
|
|
#endif // SUPER_H_
|