rulimine/common/fs/fat32.h

40 lines
991 B
C
Raw Normal View History

2020-05-01 18:19:29 +03:00
#ifndef __FS__FAT32_H__
#define __FS__FAT32_H__
#include <stdint.h>
#include <lib/part.h>
struct fat32_context {
2021-03-04 11:15:10 +03:00
struct volume *part;
2021-03-13 07:07:18 +03:00
int type;
2021-12-20 09:49:39 +03:00
uint16_t bytes_per_sector;
2020-05-01 18:19:29 +03:00
uint8_t sectors_per_cluster;
uint16_t reserved_sectors;
uint8_t number_of_fats;
uint32_t hidden_sectors;
uint32_t sectors_per_fat;
uint32_t fat_start_lba;
uint32_t data_start_lba;
2021-03-13 07:07:18 +03:00
uint32_t root_directory_cluster;
uint16_t root_entries;
uint32_t root_start;
uint32_t root_size;
2020-05-01 18:19:29 +03:00
};
struct fat32_file_handle {
struct fat32_context context;
uint32_t first_cluster;
uint32_t size_bytes;
uint32_t size_clusters;
uint32_t *cluster_chain;
2021-10-21 02:27:05 +03:00
size_t chain_len;
2020-05-01 18:19:29 +03:00
};
int fat32_check_signature(struct volume *part);
2020-05-01 18:19:29 +03:00
2021-10-21 02:27:05 +03:00
bool fat32_open(struct fat32_file_handle *ret, struct volume *part, const char *path);
void fat32_read(struct fat32_file_handle *file, void *buf, uint64_t loc, uint64_t count);
void fat32_close(struct fat32_file_handle *file);
2020-05-01 18:19:29 +03:00
#endif