pang-o-lin/include/fat12.h
Sean Cross f68f8215b7 mkfs: first working version
It can create a basic filesystem of arbitrary size.

Signed-off-by: Sean Cross <sean@xobs.io>
2019-06-09 15:48:07 +08:00

32 lines
842 B
C

#ifndef PANG_O_LIN_FAT12_H__
#define PANG_O_LIN_FAT12_H__
#include <stdint.h>
void fat12_write_u8(void *ptr, uint8_t val);
uint8_t fat12_read_u8(void *ptr);
void fat12_write_u16(void *ptr, uint16_t val);
uint16_t fat12_read_u16(void *ptr);
void fat12_set_cluster(void *fat, uint32_t cluster, uint32_t value);
uint32_t fat12_get_cluster(void *fat, uint32_t cluster);
int fat12_defrag(int fd);
int fat12_mkfs(int fd, uint32_t bytes);
struct fat_directory_entry {
uint8_t file_name[8];
uint8_t extension[3];
uint8_t file_attributes;
uint8_t reserved1;
uint8_t ctime_ms;
uint8_t ctime_hms[2];
uint8_t ctime_date[2];
uint8_t atime_date[2];
uint8_t ea_index[2];
uint8_t mtime_hms[2];
uint8_t mtime_date[2];
uint8_t first_cluster[2];
uint8_t file_size[4];
};
#endif /* PANG_O_LIN_FAT12_H__ */