grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / filesys / fat / fat_struct.h
blob1ffe921b7f4608d79f242d2c589a463d41dd57de
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];
25 __attribute__ ((__packed__));
27 struct FATBootSector
29 UBYTE bs_jmp_boot[3];
30 UBYTE bs_oem_name[8];
31 UWORD bpb_bytes_per_sect;
32 UBYTE bpb_sect_per_clust;
33 UWORD bpb_rsvd_sect_count;
34 UBYTE bpb_num_fats;
35 UWORD bpb_root_entries_count;
36 UWORD bpb_total_sectors_16;
37 UBYTE bpb_media;
38 UWORD bpb_fat_size_16;
39 UWORD bpb_sect_per_track;
40 UWORD bpb_num_heads;
41 ULONG bpb_hidden_sect;
42 ULONG bpb_total_sectors_32;
44 union
46 struct FATEBPB ebpb;
47 struct
49 ULONG bpb_fat_size_32;
50 UWORD bpb_extflags;
51 UWORD bpb_fs_verion;
52 ULONG bpb_root_cluster;
53 UWORD bpb_fs_info;
54 UWORD bpb_back_bootsec;
55 UBYTE bpb_reserved[12];
56 struct FATEBPB ebpb;
58 __attribute__ ((__packed__)) ebpb32;
60 ebpbs;
61 UBYTE pad[420];
62 UBYTE bpb_signature[2];
64 __attribute__ ((__packed__));
66 struct FATFSInfo
68 ULONG lead_sig;
69 UBYTE reserved1[480];
70 ULONG struct_sig;
71 ULONG free_count;
72 ULONG next_free;
73 UBYTE reserved2[12];
74 ULONG trail_sig;
76 __attribute__ ((__packed__));
78 #define FSI_LEAD_SIG 0x41615252
79 #define FSI_STRUCT_SIG 0x61417272
80 #define FSI_TRAIL_SIG 0xaa550000
82 struct FATDirEntry
84 UBYTE name[FAT_MAX_SHORT_NAME];
85 UBYTE attr;
86 UBYTE nt_res;
87 UBYTE create_time_tenth;
88 UWORD create_time;
89 UWORD create_date;
90 UWORD last_access_date;
91 UWORD first_cluster_hi;
92 UWORD write_time;
93 UWORD write_date;
94 UWORD first_cluster_lo;
95 ULONG file_size;
97 __attribute__ ((__packed__));
99 #define ATTR_READ_ONLY 0x01
100 #define ATTR_HIDDEN 0x02
101 #define ATTR_SYSTEM 0x04
102 #define ATTR_VOLUME_ID 0x08
103 #define ATTR_DIRECTORY 0x10
104 #define ATTR_ARCHIVE 0x20
106 #define ATTR_LONG_NAME (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID)
107 #define ATTR_LONG_NAME_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY | ATTR_ARCHIVE)
108 #define ATTR_VOLUME_ID_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY)
110 struct FATLongDirEntry
112 UBYTE order;
113 UWORD name1[5];
114 UBYTE attr;
115 UBYTE type;
116 UBYTE checksum;
117 UWORD name2[6];
118 UWORD first_cluster_lo;
119 UWORD name3[2];
121 __attribute__ ((__packed__));