2 * fat.handler - FAT12/16/32 filesystem handler
4 * Copyright © 2006 Marek Szyprowski
5 * Copyright © 2007-2008 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.
13 struct FATBootSector
{
16 UWORD bpb_bytes_per_sect
;
17 UBYTE bpb_sect_per_clust
;
18 UWORD bpb_rsvd_sect_count
;
20 UWORD bpb_root_entries_count
;
21 UWORD bpb_total_sectors_16
;
23 UWORD bpb_fat_size_16
;
24 UWORD bpb_sect_per_track
;
26 ULONG bpb_hidden_sect
;
27 ULONG bpb_total_sectors_32
;
36 UBYTE bs_filsystype
[8];
37 } __attribute__ ((__packed__
)) fat16
;
40 ULONG bpb_fat_size_32
;
43 ULONG bpb_root_cluster
;
45 UWORD bpb_back_bootsec
;
46 UBYTE bpb_reserved
[12];
52 UBYTE bs_filsystype
[8];
53 } __attribute__ ((__packed__
)) fat32
;
56 UBYTE bpb_signature
[2];
57 } __attribute__ ((__packed__
));
73 UBYTE create_time_tenth
;
76 UWORD last_access_date
;
77 UWORD first_cluster_hi
;
80 UWORD first_cluster_lo
;
82 } __attribute__ ((__packed__
));
84 #define ATTR_READ_ONLY 0x01
85 #define ATTR_HIDDEN 0x02
86 #define ATTR_SYSTEM 0x04
87 #define ATTR_VOLUME_ID 0x08
88 #define ATTR_DIRECTORY 0x10
89 #define ATTR_ARCHIVE 0x20
91 #define ATTR_LONG_NAME (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID)
92 #define ATTR_LONG_NAME_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY | ATTR_ARCHIVE)
93 #define ATTR_VOLUME_ID_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY)
95 struct FATLongDirEntry
{
102 UWORD first_cluster_lo
;
104 } __attribute__ ((__packed__
));
106 #define FAT_MAX_LONG_FILENAME 0xff