33,6 → 33,45 |
#ifndef FAT_FAT_FAT_H_ |
#define FAT_FAT_FAT_H_ |
|
#include "../../vfs/vfs.h" |
#include <stdint.h> |
|
#define FAT1 0 |
|
#define FAT_CLST_RES0 0x0000 |
#define FAT_CLST_RES1 0x0001 |
#define FAT_CLST_FIRST 0x0002 |
#define FAT_CLST_BAD 0xfff7 |
#define FAT_CLST_LAST1 0xfff8 |
#define FAT_CLST_LAST8 0xffff |
|
/* internally used to mark root directory's parent */ |
#define FAT_CLST_ROOTPAR FAT_CLST_RES0 |
/* internally used to mark root directory */ |
#define FAT_CLST_ROOT FAT_CLST_RES1 |
|
|
/* forward declarations */ |
struct block; |
struct fat_node; |
|
typedef uint16_t fat_cluster_t; |
|
#define fat_block_get(np, off) \ |
_fat_block_get((np)->idx->dev_handle, (np)->firstc, (off)) |
|
extern struct block *_fat_block_get(dev_handle_t, fat_cluster_t, off_t); |
extern uint16_t _fat_blcks_get(dev_handle_t, fat_cluster_t); |
extern uint16_t fat_bps_get(dev_handle_t); |
|
extern void fat_append_clusters(struct fat_node *, fat_cluster_t); |
extern int fat_alloc_clusters(dev_handle_t, unsigned, fat_cluster_t *, |
fat_cluster_t *); |
extern void fat_alloc_shadow_clusters(dev_handle_t, fat_cluster_t *, unsigned); |
extern void fat_mark_cluster(dev_handle_t, unsigned, fat_cluster_t, |
fat_cluster_t); |
extern void fat_fill_gap(struct fat_node *, fat_cluster_t, off_t); |
|
#endif |
|
/** |