revert between 56095 -> 55830 in arch
[AROS.git] / rom / filesys / CDVDFS / src / hfs.h
blobee795da9372e4a67eb0fb6becf9def505cb1d200
1 #ifndef HFS_H
2 #define HFS_H
3 /* hfs.h: */
5 typedef struct ext_descr {
6 t_ushort StABN;
7 t_ushort NumABlks;
8 } t_ext_descr;
10 typedef t_ext_descr t_extdatarec[3];
12 /* Force word alignment for MorphOS on PowerPC.
13 Note that there are a lot of words and longwords in these
14 structures and there are no endianess checking so MacHFS
15 support is probably broken in AROS on little-endian architectures.
16 Also note that all structures on MacHFS CD are word-aligned as required
17 by Motorola m68000 CPU.
18 All this needs to be fixed - Pavel Fedin <sonic_amiga@rambler.ru> */
19 #ifdef __MORPHOS__
20 #pragma pack(2)
21 #endif
23 typedef struct mdb {
24 t_ushort SigWord;
25 t_ulong CrDate;
26 t_ulong LsMod;
27 t_ushort Atrb;
28 t_ushort NmFls;
29 t_ushort VBMSt;
30 t_ushort AllocPtr;
31 t_ushort NmAlBlks;
32 t_ulong AlBlkSiz;
33 t_ulong ClpSiz;
34 t_ushort AlBlSt;
35 t_ulong NxtCNID;
36 t_ushort FreeBks;
37 t_uchar VolNameLen;
38 t_uchar VolName[27];
39 t_ulong VolBkUp;
40 t_ushort VSeqNum;
41 t_ulong WrCnt;
42 t_ulong XTClpSiz;
43 t_ulong CTClpSiz;
44 t_ushort NmRtDirs;
45 t_ulong FilCnt;
46 t_ulong DirCnt;
47 t_ulong FndrInfo[8];
48 t_ushort VCSize;
49 t_ushort VBMCSize;
50 t_ushort CtlCSize;
51 t_ulong XTFlSize;
52 t_extdatarec XTExtRec;
53 t_ulong CTFlSize;
54 t_extdatarec CTExtRec;
55 } t_mdb;
57 typedef struct node_descr {
58 t_ulong FLink;
59 t_ulong BLink;
60 t_uchar Type;
61 t_uchar NHeight;
62 t_ushort NRecs;
63 t_ushort Reserved;
64 } t_node_descr;
66 typedef struct hdr_node {
67 t_node_descr node_descr;
68 t_ushort Depth;
69 t_ulong Root;
70 t_ulong NRecs;
71 t_ulong FNode;
72 t_ulong LNode;
73 t_ushort NodeSize;
74 t_ushort KeyLen;
75 t_ulong NNodes;
76 t_ulong Free;
77 } t_hdr_node;
79 typedef struct idx_record {
80 char length; /* always 0x25 */
81 char reserved;
82 t_ulong parent_id;
83 t_uchar name_length;
84 char name[31];
85 t_ulong pointer;
86 } t_idx_record;
88 typedef struct leaf_record {
89 char length;
90 char reserved;
91 t_ulong parent_id;
92 t_uchar name_length;
93 char name[1];
94 } t_leaf_record;
96 typedef struct dir_record {
97 char type;
98 char reserved;
99 t_ushort Flags;
100 t_ushort Val;
101 t_ulong DirID;
102 t_ulong CrDat;
103 t_ulong MdDat;
104 t_ulong BkDat;
105 } t_dir_record;
107 typedef struct file_record {
108 char type;
109 char reserved;
110 char Flags;
111 char Typ;
112 char FInfo[16];
113 t_ulong FlNum;
114 t_ushort StBlk;
115 t_ulong LgLen;
116 t_ulong PyLen;
117 t_ushort RStBlk;
118 t_ulong RLgLen;
119 t_ulong RPyLen;
120 t_ulong CrDat;
121 t_ulong MdDat;
122 t_ulong BkDat;
123 char FXInfo[16];
124 t_ushort ClpSize;
125 t_extdatarec ExtRec;
126 t_extdatarec RExtRec;
127 t_ulong Resrv;
128 } t_file_record;
130 typedef struct dir_thread_record {
131 char type;
132 char reserved;
133 t_ulong Resrv[2];
134 t_ulong ParID;
135 t_uchar CNameLen;
136 t_uchar CName[31];
137 } t_dir_thread_record;
139 typedef struct file_thread_record {
140 char type;
141 char reserved;
142 t_ulong Resrv[2];
143 t_ulong ParID;
144 t_uchar CNameLen;
145 t_uchar CName[31];
146 } t_file_thread_record;
148 typedef union catalog_record {
149 t_dir_record d;
150 t_file_record f;
151 t_dir_thread_record dt;
152 t_file_thread_record ft;
153 } t_catalog_record;
155 typedef struct hfs_vol_info {
156 t_mdb mdb;
157 int start_block;
158 t_ulong root_node;
159 } t_hfs_vol_info;
161 typedef struct hfs_obj_info {
162 t_bool data_fork;
163 t_ulong parent_id;
164 char name[50];
165 t_catalog_record cat_rec;
166 } t_hfs_obj_info;
168 typedef struct leaf_record_pos {
169 t_ulong node;
170 t_ushort record;
171 t_node_descr node_descr;
172 t_catalog_record cat_rec;
173 t_leaf_record leaf_rec;
174 char pad[32]; /* space for name from t_leaf_record */
175 } t_leaf_record_pos;
177 #ifdef __MORPHOS__
178 #pragma pack()
179 #endif
181 int HFS_Find_Master_Directory_Block(CDROM *p_cd, t_mdb *p_mdb);
182 t_bool Uses_HFS_Protocol(CDROM *p_cd, int *p_skip);
183 t_bool HFS_Get_Header_Node
184 (CDROM *p_cd,t_ulong p_mdb_pos,t_mdb *p_mdb,t_hdr_node *p_hdr_node);
185 t_node_descr *HFS_Get_Node
186 (CDROM *p_cd,t_ulong p_mdb_pos,t_mdb *p_mdb,t_ulong p_node);
187 void Convert_Mac_Characters (char *p_buf, int p_buf_len);
189 t_bool HFS_Init_Vol_Info(VOLUME *p_volume, int p_start_block);
190 #endif