Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / fs / fat / fat_struct.h
blob633d0dfb72a37bab290c0b53db39e0c2d69fd9a5
1 /*
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.
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 trial_sig;
69 struct FATDirEntry {
70 UBYTE name[11];
71 UBYTE attr;
72 UBYTE nt_res;
73 UBYTE create_time_tenth;
74 UWORD create_time;
75 UWORD create_date;
76 UWORD last_access_date;
77 UWORD first_cluster_hi;
78 UWORD write_time;
79 UWORD write_date;
80 UWORD first_cluster_lo;
81 ULONG file_size;
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 {
96 UBYTE order;
97 UWORD name1[5];
98 UBYTE attr;
99 UBYTE type;
100 UBYTE checksum;
101 UWORD name2[6];
102 UWORD first_cluster_lo;
103 UWORD name3[2];
104 } __attribute__ ((__packed__));
106 #define FAT_MAX_LONG_FILENAME 0xff