2019-06-03 01:57:25 +00:00
|
|
|
#ifndef PANG_O_LIN_FAT12_H__
|
|
|
|
#define PANG_O_LIN_FAT12_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-06-12 10:22:12 +00:00
|
|
|
struct pang_io;
|
2019-06-09 12:32:53 +00:00
|
|
|
struct fat12_partition;
|
2019-06-10 14:29:21 +00:00
|
|
|
struct fat12_dirent {
|
|
|
|
char filename[256];
|
|
|
|
uint32_t first_cluster;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t file_attributes;
|
|
|
|
uint32_t ctime;
|
|
|
|
uint32_t mtime;
|
|
|
|
};
|
2019-06-09 12:32:53 +00:00
|
|
|
|
|
|
|
struct fat12_partition * fat12_alloc(void);
|
|
|
|
int fat12_open(struct fat12_partition *part, const char *filename);
|
|
|
|
int fat12_close(struct fat12_partition *part);
|
|
|
|
void fat12_free(struct fat12_partition **part);
|
|
|
|
|
2019-06-10 14:29:21 +00:00
|
|
|
int fat12_ls_foreach(struct fat12_partition *part, uint32_t dir_cluster, void *data, int (*callback)(void *data, const struct fat12_dirent *dirent));
|
|
|
|
|
2019-06-09 07:48:07 +00:00
|
|
|
void fat12_write_u8(void *ptr, uint8_t val);
|
|
|
|
uint8_t fat12_read_u8(void *ptr);
|
2019-06-03 01:57:25 +00:00
|
|
|
void fat12_write_u16(void *ptr, uint16_t val);
|
|
|
|
uint16_t fat12_read_u16(void *ptr);
|
2019-06-10 14:29:21 +00:00
|
|
|
void fat12_write_u32(void *ptr, uint32_t val);
|
|
|
|
uint32_t fat12_read_u32(void *ptr);
|
2019-06-03 01:57:25 +00:00
|
|
|
void fat12_set_cluster(void *fat, uint32_t cluster, uint32_t value);
|
|
|
|
uint32_t fat12_get_cluster(void *fat, uint32_t cluster);
|
|
|
|
|
2019-06-12 10:22:12 +00:00
|
|
|
int fat12_defrag(struct pang_io *io);
|
|
|
|
int fat12_mkfs(struct pang_io *io, uint32_t bytes);
|
2019-06-03 01:57:25 +00:00
|
|
|
|
|
|
|
#endif /* PANG_O_LIN_FAT12_H__ */
|