]>
Commit | Line | Data |
---|---|---|
2262cfee WD |
1 | /* |
2 | * (C) Copyright 2002 | |
fa82f871 | 3 | * Stäubli Faverges - <www.staubli.com> |
2262cfee WD |
4 | * Pierre AUBERT [email protected] |
5 | * | |
6 | * See file CREDITS for list of people who contributed to this | |
7 | * project. | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU General Public License as | |
11 | * published by the Free Software Foundation; either version 2 of | |
12 | * the License, or (at your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
22 | * MA 02111-1307 USA | |
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 | /* Data structure describing media */ | |
38 | typedef struct fs | |
39 | { | |
40 | unsigned long tot_sectors; | |
41 | ||
42 | int cluster_size; | |
43 | int num_clus; | |
8bde7f77 | 44 | |
2262cfee WD |
45 | int fat_start; |
46 | int fat_len; | |
47 | int nb_fat; | |
48 | int num_fat; | |
8bde7f77 | 49 | |
2262cfee WD |
50 | int dir_start; |
51 | int dir_len; | |
52 | ||
53 | unsigned char *fat_buf; | |
8bde7f77 | 54 | |
2262cfee WD |
55 | } Fs_t; |
56 | ||
57 | /* Data structure describing one file system slot */ | |
58 | typedef struct slot { | |
59 | int (*map) (struct fs *fs, | |
8bde7f77 WD |
60 | struct slot *file, |
61 | int where, | |
62 | int *len); | |
2262cfee WD |
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 | ||
72 | typedef 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 | /* dev.c */ | |
82 | int dev_read (void *buffer, int where, int len); | |
83 | int dev_open (void); | |
84 | int check_dev (BootSector_t *boot, Fs_t *fs); | |
85 | ||
86 | /* fat.c */ | |
87 | unsigned int fat_decode (Fs_t *fs, unsigned int num); | |
88 | int read_fat (BootSector_t *boot, Fs_t *fs); | |
89 | ||
90 | /* vfat.c */ | |
91 | int vfat_lookup (Slot_t *dir, | |
8bde7f77 WD |
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); | |
2262cfee WD |
100 | |
101 | /* subdir.c */ | |
102 | char *basename (char *name); | |
103 | int open_subdir (File_t *desc); | |
104 | int open_file (Slot_t *file, Directory_t *dir); | |
105 | int read_file (Fs_t *fs, | |
8bde7f77 WD |
106 | Slot_t *file, |
107 | char *buf, | |
108 | int where, | |
109 | int len); | |
2262cfee WD |
110 | void init_subdir (void); |
111 | ||
112 | /* fs.c */ | |
113 | int fs_init (Fs_t *fs); | |
114 | ||
115 | ||
116 | #endif |