W.I.P AROS port of SDI examples
[AROS.git] / rom / filesys / fat / fat_struct.h
blob7561e24bae89fcfd7dbcae910eb35736ceb063c3
1 /*
2 * fat.handler - FAT12/16/32 filesystem handler
4 * Copyright © 2006 Marek Szyprowski
5 * Copyright © 2007-2011 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 struct FATBootSector {
14 UBYTE bs_jmp_boot[3];
15 UBYTE bs_oem_name[8];
16 UWORD bpb_bytes_per_sect;
17 UBYTE bpb_sect_per_clust;
18 UWORD bpb_rsvd_sect_count;
19 UBYTE bpb_num_fats;
20 UWORD bpb_root_entries_count;
21 UWORD bpb_total_sectors_16;
22 UBYTE bpb_media;
23 UWORD bpb_fat_size_16;
24 UWORD bpb_sect_per_track;
25 UWORD bpb_num_heads;
26 ULONG bpb_hidden_sect;
27 ULONG bpb_total_sectors_32;
29 union {
30 struct {
31 UBYTE bs_drvnum;
32 UBYTE bs_reserved1;
33 UBYTE bs_bootsig;
34 ULONG bs_volid;
35 UBYTE bs_vollab[11];
36 UBYTE bs_filsystype[8];
37 } __attribute__ ((__packed__)) fat16;
39 struct {
40 ULONG bpb_fat_size_32;
41 UWORD bpb_extflags;
42 UWORD bpb_fs_verion;
43 ULONG bpb_root_cluster;
44 UWORD bpb_fs_info;
45 UWORD bpb_back_bootsec;
46 UBYTE bpb_reserved[12];
47 UBYTE bs_drvnum;
48 UBYTE bs_reserved1;
49 UBYTE bs_bootsig;
50 ULONG bs_volid;
51 UBYTE bs_vollab[11];
52 UBYTE bs_filsystype[8];
53 } __attribute__ ((__packed__)) fat32;
54 } type;
55 UBYTE pad[420];
56 UBYTE bpb_signature[2];
57 } __attribute__ ((__packed__));
59 struct FATFSInfo {
60 ULONG lead_sig;
61 UBYTE reserved1[480];
62 ULONG struct_sig;
63 ULONG free_count;
64 ULONG next_free;
65 UBYTE reserved2[12];
66 ULONG trail_sig;
67 } __attribute__ ((__packed__));
69 #define FSI_LEAD_SIG 0x41615252
70 #define FSI_STRUCT_SIG 0x61417272
71 #define FSI_TRAIL_SIG 0xaa550000
73 struct FATDirEntry {
74 UBYTE name[11];
75 UBYTE attr;
76 UBYTE nt_res;
77 UBYTE create_time_tenth;
78 UWORD create_time;
79 UWORD create_date;
80 UWORD last_access_date;
81 UWORD first_cluster_hi;
82 UWORD write_time;
83 UWORD write_date;
84 UWORD first_cluster_lo;
85 ULONG file_size;
86 } __attribute__ ((__packed__));
88 #define ATTR_READ_ONLY 0x01
89 #define ATTR_HIDDEN 0x02
90 #define ATTR_SYSTEM 0x04
91 #define ATTR_VOLUME_ID 0x08
92 #define ATTR_DIRECTORY 0x10
93 #define ATTR_ARCHIVE 0x20
95 #define ATTR_LONG_NAME (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID)
96 #define ATTR_LONG_NAME_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY | ATTR_ARCHIVE)
97 #define ATTR_VOLUME_ID_MASK (ATTR_READ_ONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_VOLUME_ID | ATTR_DIRECTORY)
99 struct FATLongDirEntry {
100 UBYTE order;
101 UWORD name1[5];
102 UBYTE attr;
103 UBYTE type;
104 UBYTE checksum;
105 UWORD name2[6];
106 UWORD first_cluster_lo;
107 UWORD name3[2];
108 } __attribute__ ((__packed__));
110 #define FAT_MAX_LONG_FILENAME 0xff