revert between 56095 -> 55830 in arch
[AROS.git] / rom / filesys / fat / fat_struct.h
blob8c22398558a41535474634b6c838c86b6b774f33
1 /*
2 * fat-handler - FAT12/16/32 filesystem handler
4 * Copyright © 2006 Marek Szyprowski
5 * Copyright © 2007-2015 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 #define FAT_MAX_SHORT_NAME 11
14 #define FAT_MAX_LONG_FILENAME 0xff
16 struct FATEBPB
18 UBYTE bs_drvnum;
19 UBYTE bs_reserved1;
20 UBYTE bs_bootsig;
21 ULONG bs_volid;
22 UBYTE bs_vollab[FAT_MAX_SHORT_NAME];
23 UBYTE bs_filsystype[8];
24 } __packed;
26 struct FATBootSector
28 UBYTE bs_jmp_boot[3];
29 UBYTE bs_oem_name[8];
30 UWORD bpb_bytes_per_sect;
31 UBYTE bpb_sect_per_clust;
32 UWORD bpb_rsvd_sect_count;
33 UBYTE bpb_num_fats;
34 UWORD bpb_root_entries_count;
35 UWORD bpb_total_sectors_16;
36 UBYTE bpb_media;
37 UWORD bpb_fat_size_16;
38 UWORD bpb_sect_per_track;
39 UWORD bpb_num_heads;
40 ULONG bpb_hidden_sect;
41 ULONG bpb_total_sectors_32;
43 union
45 struct FATEBPB ebpb;
46 struct
48 ULONG bpb_fat_size_32;
49 UWORD bpb_extflags;
50 UWORD bpb_fs_verion;
51 ULONG bpb_root_cluster;
52 UWORD bpb_fs_info;
53 UWORD bpb_back_bootsec;
54 UBYTE bpb_reserved[12];
55 struct FATEBPB ebpb;
56 } __packed ebpb32;
58 ebpbs;
59 UBYTE pad[420];
60 UBYTE bpb_signature[2];
61 } __packed;
63 struct FATFSInfo
65 ULONG lead_sig;
66 UBYTE reserved1[480];
67 ULONG struct_sig;
68 ULONG free_count;
69 ULONG next_free;
70 UBYTE reserved2[12];
71 ULONG trail_sig;
72 } __packed;
74 #define FSI_LEAD_SIG 0x41615252
75 #define FSI_STRUCT_SIG 0x61417272
76 #define FSI_TRAIL_SIG 0xaa550000
78 struct FATDirEntry
80 UBYTE name[FAT_MAX_SHORT_NAME];
81 UBYTE attr;
82 UBYTE nt_res;
83 UBYTE create_time_tenth;
84 UWORD create_time;
85 UWORD create_date;
86 UWORD last_access_date;
87 UWORD first_cluster_hi;
88 UWORD write_time;
89 UWORD write_date;
90 UWORD first_cluster_lo;
91 ULONG file_size;
92 } __packed;
94 #define ATTR_READ_ONLY 0x01
95 #define ATTR_HIDDEN 0x02
96 #define ATTR_SYSTEM 0x04
97 #define ATTR_VOLUME_ID 0x08
98 #define ATTR_DIRECTORY 0x10
99 #define ATTR_ARCHIVE 0x20
101 #define ATTR_LONG_NAME (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID)
102 #define ATTR_LONG_NAME_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY | ATTR_ARCHIVE)
103 #define ATTR_VOLUME_ID_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY)
105 struct FATLongDirEntry
107 UBYTE order;
108 UWORD name1[5];
109 UBYTE attr;
110 UBYTE type;
111 UBYTE checksum;
112 UWORD name2[6];
113 UWORD first_cluster_lo;
114 UWORD name3[2];
115 } __packed;