emmafs/util.h

34 lines
722 B
C

#ifndef BLOCK_H_
#define BLOCK_H_
#include <stdint.h>
#include <time.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;
typedef struct block block;
struct block {
char data[BLOCKSIZE];
};
struct tm *local_time;
// Global Variables
time_t current_time;
// Provide fs size in bytes
int find_number_of_inodes(uint64_t fs_size);
tm* get_local_time();
uint32_t get_file_size(uint16_t block_count);
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 // BLOCK_H_