1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef _FDOS_H_
26#define _FDOS_H_
27
28
29#undef FDOS_DEBUG
30
31#ifdef FDOS_DEBUG
32#define PRINTF(fmt,args...) printf (fmt ,##args)
33#else
34#define PRINTF(fmt,args...)
35#endif
36
37
38typedef struct fs
39{
40 unsigned long tot_sectors;
41
42 int cluster_size;
43 int num_clus;
44
45 int fat_start;
46 int fat_len;
47 int nb_fat;
48 int num_fat;
49
50 int dir_start;
51 int dir_len;
52
53 unsigned char *fat_buf;
54
55} Fs_t;
56
57
58typedef struct slot {
59 int (*map) (struct fs *fs,
60 struct slot *file,
61 int where,
62 int *len);
63 unsigned long FileSize;
64
65 unsigned short int FirstAbsCluNr;
66 unsigned short int PreviousAbsCluNr;
67 unsigned short int PreviousRelCluNr;
68
69 Directory_t dir;
70} Slot_t;
71
72typedef struct file {
73 char *name;
74 int Case;
75 Fs_t *fs;
76 Slot_t subdir;
77 Slot_t file;
78} File_t;
79
80
81
82int dev_read (void *buffer, int where, int len);
83int dev_open (void);
84int check_dev (BootSector_t *boot, Fs_t *fs);
85
86
87unsigned int fat_decode (Fs_t *fs, unsigned int num);
88int read_fat (BootSector_t *boot, Fs_t *fs);
89
90
91int vfat_lookup (Slot_t *dir,
92 Fs_t *fs,
93 Directory_t *dirent,
94 int *entry,
95 int *vfat_start,
96 char *filename,
97 int flags,
98 char *outname,
99 Slot_t *file);
100
101
102char *basename (char *name);
103int open_subdir (File_t *desc);
104int open_file (Slot_t *file, Directory_t *dir);
105int read_file (Fs_t *fs,
106 Slot_t *file,
107 char *buf,
108 int where,
109 int len);
110void init_subdir (void);
111
112
113int fs_init (Fs_t *fs);
114
115
116#endif
117