Rev 3536 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3536 | Rev 3597 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | #ifndef FAT_FAT_FAT_H_ |
33 | #ifndef FAT_FAT_FAT_H_ |
34 | #define FAT_FAT_FAT_H_ |
34 | #define FAT_FAT_FAT_H_ |
35 | 35 | ||
36 | #include "../../vfs/vfs.h" |
36 | #include "../../vfs/vfs.h" |
37 | #include <stdint.h> |
37 | #include <stdint.h> |
- | 38 | #include <libblock.h> |
|
38 | 39 | ||
39 | #define FAT1 0 |
40 | #define FAT1 0 |
40 | 41 | ||
41 | #define FAT_CLST_RES0 0x0000 |
42 | #define FAT_CLST_RES0 0x0000 |
42 | #define FAT_CLST_RES1 0x0001 |
43 | #define FAT_CLST_RES1 0x0001 |
Line 55... | Line 56... | ||
55 | struct fat_node; |
56 | struct fat_node; |
56 | struct fat_bs; |
57 | struct fat_bs; |
57 | 58 | ||
58 | typedef uint16_t fat_cluster_t; |
59 | typedef uint16_t fat_cluster_t; |
59 | 60 | ||
- | 61 | #define fat_clusters_get(bs, dh, fc) \ |
|
- | 62 | fat_cluster_walk((bs), (dh), (fc), NULL, (uint16_t) -1) |
|
- | 63 | extern uint16_t fat_cluster_walk(struct fat_bs *, dev_handle_t, fat_cluster_t, |
|
- | 64 | fat_cluster_t *, uint16_t); |
|
- | 65 | ||
60 | #define fat_block_get(bs, np, off) \ |
66 | #define fat_block_get(bs, np, bn, flags) \ |
61 | _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (off)) |
67 | _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (bn), (flags)) |
62 | 68 | ||
63 | extern struct block *_fat_block_get(struct fat_bs *, dev_handle_t, |
69 | extern struct block *_fat_block_get(struct fat_bs *, dev_handle_t, |
64 | fat_cluster_t, off_t); |
70 | fat_cluster_t, bn_t, int); |
65 | extern uint16_t _fat_blcks_get(struct fat_bs *, dev_handle_t, fat_cluster_t, |
- | |
66 | fat_cluster_t *); |
- | |
67 | 71 | ||
68 | extern void fat_append_clusters(struct fat_bs *, struct fat_node *, |
72 | extern void fat_append_clusters(struct fat_bs *, struct fat_node *, |
69 | fat_cluster_t); |
73 | fat_cluster_t); |
- | 74 | extern void fat_chop_clusters(struct fat_bs *, struct fat_node *, |
|
- | 75 | fat_cluster_t); |
|
70 | extern int fat_alloc_clusters(struct fat_bs *, dev_handle_t, unsigned, |
76 | extern int fat_alloc_clusters(struct fat_bs *, dev_handle_t, unsigned, |
71 | fat_cluster_t *, fat_cluster_t *); |
77 | fat_cluster_t *, fat_cluster_t *); |
- | 78 | extern void fat_free_clusters(struct fat_bs *, dev_handle_t, fat_cluster_t); |
|
72 | extern void fat_alloc_shadow_clusters(struct fat_bs *, dev_handle_t, |
79 | extern void fat_alloc_shadow_clusters(struct fat_bs *, dev_handle_t, |
73 | fat_cluster_t *, unsigned); |
80 | fat_cluster_t *, unsigned); |
- | 81 | extern fat_cluster_t fat_get_cluster(struct fat_bs *, dev_handle_t, fat_cluster_t); |
|
74 | extern void fat_mark_cluster(struct fat_bs *, dev_handle_t, unsigned, |
82 | extern void fat_set_cluster(struct fat_bs *, dev_handle_t, unsigned, |
75 | fat_cluster_t, fat_cluster_t); |
83 | fat_cluster_t, fat_cluster_t); |
76 | extern void fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t, |
84 | extern void fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t, |
77 | off_t); |
85 | off_t); |
78 | 86 | ||
79 | #endif |
87 | #endif |