Subversion Repositories HelenOS

Rev

Rev 3561 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3561 Rev 3588
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 56... Line 57...
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
 
60
#define fat_clusters_get(bs, dh, fc) \
61
#define fat_clusters_get(bs, dh, fc) \
61
    fat_cluster_walk((bs), (dh), (fc), NULL, NULL, (uint16_t) -1)
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
 
62
#define fat_block_get(bs, np, off) \
66
#define fat_block_get(bs, np, bn) \
63
    _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (off))
67
    _fat_block_get((bs), (np)->idx->dev_handle, (np)->firstc, (bn))
64
 
68
 
65
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,
66
    fat_cluster_t, off_t);
70
    fat_cluster_t, bn_t);
67
extern uint16_t fat_cluster_walk(struct fat_bs *, dev_handle_t, fat_cluster_t,
-
 
68
    fat_cluster_t *, fat_cluster_t *, uint16_t);
-
 
69
 
71
 
70
extern void fat_append_clusters(struct fat_bs *, struct fat_node *,
72
extern void fat_append_clusters(struct fat_bs *, struct fat_node *,
71
    fat_cluster_t);
73
    fat_cluster_t);
-
 
74
extern void fat_chop_clusters(struct fat_bs *, struct fat_node *,
-
 
75
    fat_cluster_t);
72
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,
73
    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);
74
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,
75
    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);
76
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,
77
    fat_cluster_t, fat_cluster_t);
83
    fat_cluster_t, fat_cluster_t);
78
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,
79
    off_t);
85
    off_t);
80
 
86
 
81
#endif
87
#endif