Commit code from several developing sessions]

This commit is contained in:
Emma Nora Theuer 2024-10-23 03:00:36 +02:00
parent 7c84b7bcee
commit 8272aa245b
2 changed files with 66 additions and 3 deletions

21
inode.h
View file

@ -16,6 +16,8 @@ enum permissions {
X = 4
};
// NOTE: Add handling for the block bitmap for when a file is deleted and created. That's how you solve the issue of when a block is usable.
struct inode_table {
// the following keyword spam purely exist so I definitely see it with highlighting.
// NOTE, TODO, FIXME, DEPRECATED, HACK, IMPORTANT: always initialize all values to be null when the inode table is created!!!!
@ -44,8 +46,25 @@ struct Inode {
tm created;
tm last_modified;
// needed to determine file size
uint16_t block_count;
block* data_block;
// Data block pointers!!
struct data_block* first_data_block;
struct data_block* second_data_block;
struct data_block* third_data_block;
struct data_block* fourth_data_block;
struct data_block* fifth_data_block;
struct data_block* sixth_data_block;
struct data_block* seventh_data_block;
struct data_block* eighth_data_block;
struct data_block* nineth_data_block;
struct data_block* tenth_data_block;
struct data_block* eleventh_data_block;
struct data_block* twelveth_data_block;
struct indirect_data_block* file_indirect_data_block;
struct doubly_indirect_data_block* file_doubly_indirect_data_block;
struct trebly_indirect_data_block* file_trebly_indirect_data_block;
};
Inode* create_inode(char name[64], uint8_t user_permissions, uint8_t group_permissions, uint16_t owner, uint16_t group, block* data_block);

48
util.h
View file

@ -10,12 +10,56 @@
#define BITS_PER_INODE 16384
typedef struct tm tm;
typedef struct block block;
struct block {
struct data_block {
char data[BLOCKSIZE];
};
struct indirect_data_block {
struct data_block* first_data_block;
struct data_block* second_data_block;
struct data_block* third_data_block;
struct data_block* fourth_data_block;
struct data_block* fifth_data_block;
struct data_block* sixth_data_block;
struct data_block* seventh_data_block;
struct data_block* eighth_data_block;
struct data_block* nineth_data_block;
struct data_block* tenth_data_block;
struct data_block* eleventh_data_block;
struct data_block* twelveth_data_block;
};
struct doubly_indirect_data_block {
struct data_block* first_indirect_data_block;
struct data_block* second_indirect_data_block;
struct data_block* third_indirect_data_block;
struct data_block* fourth_indirect_data_block;
struct data_block* fifth_indirect_data_block;
struct data_block* sixth_indirect_data_block;
struct data_block* seventh_indirect_data_block;
struct data_block* eighth_indirect_data_block;
struct data_block* nineth_indirect_data_block;
struct data_block* tenth_indirect_data_block;
struct data_block* eleventh_indirect_data_block;
struct data_block* twelveth_indirect_data_block;
};
struct trebly_indirect_data_block {
struct data_block* first_doubly_indirect_data_block;
struct data_block* second_doubly_indirect_data_block;
struct data_block* third_doubly_indirect_data_block;
struct data_block* fourth_doubly_indirect_data_block;
struct data_block* fifth_doubly_indirect_data_block;
struct data_block* sixth_doubly_indirect_data_block;
struct data_block* seventh_doubly_indirect_data_block;
struct data_block* eighth_doubly_indirect_data_block;
struct data_block* nineth_doubly_indirect_data_block;
struct data_block* tenth_doubly_indirect_data_block;
struct data_block* eleventh_doubly_indirect_data_block;
struct data_block* twelveth_doubly_indirect_data_block;
};
struct tm *local_time;
// Global Variables