#ifndef UTIL_H_ #define UTIL_H_ #include "emmafs.h" #define BLOCKSIZE 4096 // NOTE: This is about how many inode get reserved per bit at fs creation. TODO: Come up witha better name. #define BITS_PER_INODE 16384 typedef struct tm tm; 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 time_t current_time; // Provide fs size in bytes <<<<<<< HEAD int find_number_of_inodes(size_t fs_size); tm* get_local_time(); size_t get_file_size(uint16_t block_count); // DEPRECATED? Probably unneeded and will soon be removed. This should not be handled on the fs level. ======= int find_number_of_inodes(uint64_t fs_size); tm get_local_time(); uint32_t get_file_size(uint16_t block_count); >>>>>>> 18f1037e030fa451566018dfcb8dbdb250787c70 uint16_t bytes_to_kb(uint32_t bytes); uint16_t kb_to_mb(uint16_t kb); uint16_t mb_to_gb(uint16_t mb); uint16_t gb_to_tb(uint16_t gb); uint8_t tb_to_pb(uint16_t tb); #endif // UTIL_H_