r25568@plastic: rob | 2007-03-14 16:45:08 +1100
[cake.git] / workbench / fs / fat / fat_fs.h
blob7e78d60b32960237af66f9fd07886fecd4710a41
1 /*
2 * fat.handler - FAT12/16/32 filesystem handler
4 * Copyright © 2006 Marek Szyprowski
5 * Copyright © 2007 The AROS Development Team
7 * This program is free software; you can redistribute it and/or modify it
8 * under the same terms as AROS itself.
10 * $Id$
13 #ifndef FAT_HANDLER_H
14 #define FAT_HANDLER_H
16 #define __DEBUG__ 1
18 #include <aros/libcall.h>
19 #include <devices/trackdisk.h>
21 #include "fat_struct.h"
23 /* filesystem structures */
25 #define ID_FAT_DISK 0x46415400UL
27 #define ID_FAT12_DISK 0x46415400UL
28 #define ID_FAT16_DISK 0x46415401UL
29 #define ID_FAT32_DISK 0x46415402UL
31 #define ACTION_VOLUME_ADD 16000
32 #define ACTION_VOLUME_REMOVE 16001
34 extern struct Globals *glob;
36 #define DEF_POOL_SIZE 65536
37 #define DEF_POOL_TRESHOLD DEF_POOL_SIZE
38 #define DEF_BUFF_LINES 128
39 #define DEF_READ_AHEAD 16*1024
41 struct CacheBuffer {
42 struct CacheBuffer *next;
43 ULONG count;
44 ULONG block;
45 void *data;
46 ULONG magic;
49 struct Extent
51 ULONG sector;
52 ULONG count;
53 ULONG offset;
54 ULONG cur_cluster;
55 ULONG next_cluster;
56 ULONG start_cluster;
57 ULONG last_cluster;
60 struct DirCache
62 struct Extent *e;
63 void *buffer;
64 ULONG cur_sector;
67 #define fl_Key entry
69 #define FAT_ROOTDIR_MARK 0xFFFFFFFFlu
71 struct ExtFileLock
73 /* struct FileLock */
74 BPTR fl_Link;
75 ULONG entry;
76 LONG fl_Access;
77 struct MsgPort *fl_Task;
78 BPTR fl_Volume;
80 /* coinsistency check */
81 ULONG magic;
83 /* my directory start cluster */
84 ULONG cluster;
86 ULONG attr;
87 ULONG size;
88 ULONG first_cluster;
90 struct Extent data_ext[1];
92 /* dir entry cache for easy and quick management of long files */
94 /* used in directory scanning and file reading */
95 ULONG pos;
97 UBYTE name[108];
99 BOOL dircache_active;
100 struct DirCache dircache[1];
103 struct VolumeInfo {
104 UBYTE name[32]; /* BCPL string */
105 struct DateStamp create_time;
108 struct FSSuper {
109 struct FSSuper *next;
110 struct DosList *doslist;
112 ULONG sectorsize;
113 ULONG sectorsize_bits;
115 ULONG clustersize;
116 ULONG clustersize_bits;
117 ULONG cluster_sectors_bits;
119 ULONG first_fat_sector;
120 ULONG first_data_sector;
121 ULONG first_rootdir_sector;
123 ULONG rootdir_sectors;
124 ULONG total_sectors;
125 ULONG data_sectors;
126 ULONG clusters_count;
127 ULONG fat_size;
129 ULONG free_clusters;
131 ULONG volume_id;
132 ULONG type;
133 ULONG eoc_mark;
135 UBYTE *fat;
136 ULONG fat32_cachesize;
137 ULONG fat32_cachesize_bits;
138 ULONG fat32_cache_block;
140 struct Extent first_rootdir_extent[1];
142 struct VolumeInfo volume;
144 /* function table */
145 ULONG (*func_get_fat_entry)(struct FSSuper *sb, ULONG n);
146 /* ... */
150 struct Globals {
151 /* mem/task */
152 struct Task *ourtask;
153 struct MsgPort *ourport;
154 APTR mempool;
156 /* fs */
157 struct DosList *devnode;
158 struct FileSysStartupMsg *fssm;
159 LONG quit;
160 BOOL autodetect;
162 /* io */
163 struct IOExtTD *diskioreq;
164 struct IOExtTD *diskchgreq;
165 struct MsgPort *diskport;
166 LONG blocksize;
168 /* volumes */
169 struct FSSuper *sb; /* current sb */
170 struct FSSuper *sblist; /* list of sbs with outstanding locks */
172 /* disk status */
173 LONG disk_inserted;
174 LONG disk_inhibited;
177 #include "support.h"
179 #endif