pang-o-lin/include/fat12.h

35 lines
1.1 KiB
C
Raw Normal View History

#ifndef PANG_O_LIN_FAT12_H__
#define PANG_O_LIN_FAT12_H__
#include <stdint.h>
struct fat12_partition;
struct fat12_dirent {
char filename[256];
uint32_t first_cluster;
uint32_t size;
uint32_t file_attributes;
uint32_t ctime;
uint32_t mtime;
};
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);
int fat12_ls_foreach(struct fat12_partition *part, uint32_t dir_cluster, void *data, int (*callback)(void *data, const struct fat12_dirent *dirent));
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_write_u32(void *ptr, uint32_t val);
uint32_t fat12_read_u32(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);
#endif /* PANG_O_LIN_FAT12_H__ */