emmafs/util.h

35 lines
722 B
C
Raw Normal View History

2024-10-08 23:01:29 +02:00
#ifndef BLOCK_H_
#define BLOCK_H_
#include <stdint.h>
2024-10-19 19:52:24 +02:00
#include <time.h>
2024-10-08 23:01:29 +02:00
#define BLOCKSIZE 4096
2024-10-19 19:52:24 +02:00
// NOTE: This is about how many inode get reserved per bit at fs creation. TODO: Come up witha better name.
2024-10-08 23:01:29 +02:00
#define BITS_PER_INODE 16384
2024-10-19 19:52:24 +02:00
typedef struct tm tm;
2024-10-08 23:01:29 +02:00
typedef struct block block;
struct block {
char data[BLOCKSIZE];
};
2024-10-19 19:52:24 +02:00
struct tm *local_time;
// Global Variables
time_t current_time;
2024-10-08 23:01:29 +02:00
// Provide fs size in bytes
int find_number_of_inodes(uint64_t fs_size);
2024-10-19 19:52:24 +02:00
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);
2024-10-08 23:01:29 +02:00
#endif // BLOCK_H_