Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/i386/libsaio/msdos_private.h

Source at commit 214 created 13 years 5 months ago.
By ifabio, update to chameleon trunk 630, and now the pakage folder is the same as blackosx branch, also add Icon "building" into buildpkg script, and add mint theme info into the English localizable.strings.
1/*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 2.0 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Written by Paul Popelka (paulp@uts.amdahl.com)
24 *
25 * You can do anything you want with this software, just don't say you wrote
26 * it, and don't remove this notice.
27 *
28 * This software is provided "as is".
29 *
30 * The author supplies this software to be publicly redistributed on the
31 * understanding that the author is not responsible for the correct
32 * functioning of this software in any circumstances and is not liable for
33 * any damages caused by this software.
34 *
35 * October 1992
36 */
37
38/*
39 * Format of a boot sector. This is the first sector on a DOS floppy disk
40 * or the fist sector of a partition on a hard disk. But, it is not the
41 * first sector of a partitioned hard disk.
42 */
43struct bootsector33 {
44u_int8_tbsJump[3];/* jump inst E9xxxx or EBxx90 */
45int8_tbsOemName[8];/* OEM name and version */
46int8_tbsBPB[19];/* BIOS parameter block */
47int8_tbsDriveNumber;/* drive number (0x80) */
48int8_tbsBootCode[479];/* pad so struct is 512b */
49u_int8_tbsBootSectSig0;
50u_int8_tbsBootSectSig1;
51#defineBOOTSIG00x55
52#defineBOOTSIG10xaa
53};
54
55struct extboot {
56int8_texDriveNumber;/* drive number (0x80) */
57int8_texReserved1;/* reserved */
58int8_texBootSignature;/* ext. boot signature (0x29) */
59#defineEXBOOTSIG0x29
60int8_texVolumeID[4];/* volume ID number */
61int8_texVolumeLabel[11];/* volume label */
62int8_texFileSysType[8];/* fs type (FAT12 or FAT16) */
63};
64
65struct bootsector50 {
66u_int8_tbsJump[3];/* jump inst E9xxxx or EBxx90 */
67int8_tbsOemName[8];/* OEM name and version */
68int8_tbsBPB[25];/* BIOS parameter block */
69int8_tbsExt[26];/* Bootsector Extension */
70int8_tbsBootCode[448];/* pad so structure is 512b */
71u_int8_tbsBootSectSig0;
72u_int8_tbsBootSectSig1;
73#defineBOOTSIG00x55
74#defineBOOTSIG10xaa
75};
76
77struct bootsector710 {
78u_int8_tbsJump[3];/* jump inst E9xxxx or EBxx90 */
79int8_tbsOEMName[8];/* OEM name and version */
80int8_tbsBPB[53];/* BIOS parameter block */
81int8_tbsExt[26];/* Bootsector Extension */
82int8_tbsBootCode[420];/* pad so structure is 512b */
83u_int8_tbsBootSectSig0;
84u_int8_tbsBootSectSig1;
85#defineBOOTSIG00x55
86#defineBOOTSIG10xaa
87};
88
89union bootsector {
90struct bootsector33 bs33;
91struct bootsector50 bs50;
92struct bootsector710 bs710;
93};
94
95
96/* BPB */
97
98/*
99 * BIOS Parameter Block (BPB) for DOS 3.3
100 */
101struct bpb33 {
102u_int16_tbpbBytesPerSec;/* bytes per sector */
103u_int8_tbpbSecPerClust;/* sectors per cluster */
104u_int16_tbpbResSectors;/* number of reserved sectors */
105u_int8_tbpbFATs;/* number of FATs */
106u_int16_tbpbRootDirEnts;/* number of root directory entries */
107u_int16_tbpbSectors;/* total number of sectors */
108u_int8_tbpbMedia;/* media descriptor */
109u_int16_tbpbFATsecs;/* number of sectors per FAT */
110u_int16_tbpbSecPerTrack;/* sectors per track */
111u_int16_tbpbHeads;/* number of heads */
112u_int16_tbpbHiddenSecs;/* number of hidden sectors */
113} __attribute__((packed));
114
115/*
116 * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
117 * and bpbHugeSectors is not in the 3.3 bpb.
118 */
119struct bpb50 {
120u_int16_tbpbBytesPerSec;/* bytes per sector */
121u_int8_tbpbSecPerClust;/* sectors per cluster */
122u_int16_tbpbResSectors;/* number of reserved sectors */
123u_int8_tbpbFATs;/* number of FATs */
124u_int16_tbpbRootDirEnts;/* number of root directory entries */
125u_int16_tbpbSectors;/* total number of sectors */
126u_int8_tbpbMedia;/* media descriptor */
127u_int16_tbpbFATsecs;/* number of sectors per FAT */
128u_int16_tbpbSecPerTrack;/* sectors per track */
129u_int16_tbpbHeads;/* number of heads */
130u_int32_tbpbHiddenSecs;/* # of hidden sectors */
131u_int32_tbpbHugeSectors;/* # of sectors if bpbSectors == 0 */
132} __attribute__((packed));
133
134/*
135 * BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
136 */
137struct bpb710 {
138u_int16_tbpbBytesPerSec;/* bytes per sector */
139u_int8_tbpbSecPerClust;/* sectors per cluster */
140u_int16_tbpbResSectors;/* number of reserved sectors */
141u_int8_tbpbFATs;/* number of FATs */
142u_int16_tbpbRootDirEnts;/* number of root directory entries */
143u_int16_tbpbSectors;/* total number of sectors */
144u_int8_tbpbMedia;/* media descriptor */
145u_int16_tbpbFATsecs;/* number of sectors per FAT */
146u_int16_tbpbSecPerTrack;/* sectors per track */
147u_int16_tbpbHeads;/* number of heads */
148u_int32_tbpbHiddenSecs;/* # of hidden sectors */
149u_int32_tbpbHugeSectors;/* # of sectors if bpbSectors == 0 */
150u_int32_tbpbBigFATsecs;/* like bpbFATsecs for FAT32 */
151u_int16_tbpbExtFlags;/* extended flags: */
152#defineFATNUM0xf/* mask for numbering active FAT */
153#defineFATMIRROR0x80/* FAT is mirrored (like it always was) */
154u_int16_tbpbFSVers;/* filesystem version */
155#defineFSVERS0/* currently only 0 is understood */
156u_int32_tbpbRootClust;/* start cluster for root directory */
157u_int16_tbpbFSInfo;/* filesystem info structure sector */
158u_int16_tbpbBackup;/* backup boot sector */
159/* There is a 12 byte filler here, but we ignore it */
160} __attribute__((packed));
161
162#if 0
163/*
164 * BIOS Parameter Block (BPB) for DOS 3.3
165 */
166struct byte_bpb33 {
167int8_t bpbBytesPerSec[2];/* bytes per sector */
168int8_t bpbSecPerClust;/* sectors per cluster */
169int8_t bpbResSectors[2];/* number of reserved sectors */
170int8_t bpbFATs;/* number of FATs */
171int8_t bpbRootDirEnts[2];/* number of root directory entries */
172int8_t bpbSectors[2];/* total number of sectors */
173int8_t bpbMedia;/* media descriptor */
174int8_t bpbFATsecs[2];/* number of sectors per FAT */
175int8_t bpbSecPerTrack[2];/* sectors per track */
176int8_t bpbHeads[2];/* number of heads */
177int8_t bpbHiddenSecs[2];/* number of hidden sectors */
178};
179
180/*
181 * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
182 * and bpbHugeSectors is not in the 3.3 bpb.
183 */
184struct byte_bpb50 {
185int8_t bpbBytesPerSec[2];/* bytes per sector */
186int8_t bpbSecPerClust;/* sectors per cluster */
187int8_t bpbResSectors[2];/* number of reserved sectors */
188int8_t bpbFATs;/* number of FATs */
189int8_t bpbRootDirEnts[2];/* number of root directory entries */
190int8_t bpbSectors[2];/* total number of sectors */
191int8_t bpbMedia;/* media descriptor */
192int8_t bpbFATsecs[2];/* number of sectors per FAT */
193int8_t bpbSecPerTrack[2];/* sectors per track */
194int8_t bpbHeads[2];/* number of heads */
195int8_t bpbHiddenSecs[4];/* number of hidden sectors */
196int8_t bpbHugeSectors[4];/* # of sectors if bpbSectors == 0 */
197};
198
199/*
200 * BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
201 */
202struct byte_bpb710 {
203u_int8_t bpbBytesPerSec[2];/* bytes per sector */
204u_int8_t bpbSecPerClust;/* sectors per cluster */
205u_int8_t bpbResSectors[2];/* number of reserved sectors */
206u_int8_t bpbFATs;/* number of FATs */
207u_int8_t bpbRootDirEnts[2];/* number of root directory entries */
208u_int8_t bpbSectors[2];/* total number of sectors */
209u_int8_t bpbMedia;/* media descriptor */
210u_int8_t bpbFATsecs[2];/* number of sectors per FAT */
211u_int8_t bpbSecPerTrack[2];/* sectors per track */
212u_int8_t bpbHeads[2];/* number of heads */
213u_int8_t bpbHiddenSecs[4];/* # of hidden sectors */
214u_int8_t bpbHugeSectors[4];/* # of sectors if bpbSectors == 0 */
215u_int8_t bpbBigFATsecs[4];/* like bpbFATsecs for FAT32 */
216u_int8_t bpbExtFlags[2];/* extended flags: */
217u_int8_t bpbFSVers[2];/* filesystem version */
218u_int8_t bpbRootClust[4];/* start cluster for root directory */
219u_int8_t bpbFSInfo[2];/* filesystem info structure sector */
220u_int8_t bpbBackup[2];/* backup boot sector */
221/* There is a 12 byte filler here, but we ignore it */
222};
223#endif
224
225/*
226 * FAT32 FSInfo block.
227 */
228struct fsinfo {
229u_int8_t fsisig1[4];
230u_int8_t fsifill1[480];
231u_int8_t fsisig2[4];
232u_int8_t fsinfree[4];
233u_int8_t fsinxtfree[4];
234u_int8_t fsifill2[12];
235u_int8_t fsisig3[4];
236};
237
238
239/* direntry */
240
241/*-
242 * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
243 * Copyright (C) 1994, 1995, 1997 TooLs GmbH.
244 * All rights reserved.
245 * Original code by Paul Popelka (paulp@uts.amdahl.com) (see above).
246 *
247 * Redistribution and use in source and binary forms, with or without
248 * modification, are permitted provided that the following conditions
249 * are met:
250 * 1. Redistributions of source code must retain the above copyright
251 * notice, this list of conditions and the following disclaimer.
252 * 2. Redistributions in binary form must reproduce the above copyright
253 * notice, this list of conditions and the following disclaimer in the
254 * documentation and/or other materials provided with the distribution.
255 * 3. All advertising materials mentioning features or use of this software
256 * must display the following acknowledgement:
257 *This product includes software developed by TooLs GmbH.
258 * 4. The name of TooLs GmbH may not be used to endorse or promote products
259 * derived from this software without specific prior written permission.
260 *
261 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
262 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
263 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
264 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
265 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
266 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
267 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
268 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
269 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
270 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271 */
272
273/*
274 * Structure of a dos directory entry.
275 */
276struct direntry {
277u_int8_tdeName[8];/* filename, blank filled */
278#defineSLOT_EMPTY0x00/* slot has never been used */
279#defineSLOT_E50x05/* the real value is 0xe5 */
280#defineSLOT_DELETED0xe5/* file in this slot deleted */
281u_int8_tdeExtension[3];/* extension, blank filled */
282u_int8_tdeAttributes;/* file attributes */
283#defineATTR_NORMAL0x00/* normal file */
284#defineATTR_READONLY0x01/* file is read-only (immutable) */
285#defineATTR_HIDDEN0x02/* file is hidden */
286#defineATTR_SYSTEM0x04/* file is a system file */
287#defineATTR_VOLUME0x08/* entry is a volume label */
288#defineATTR_DIRECTORY0x10/* entry is a directory name */
289#defineATTR_ARCHIVE0x20/* file is new or modified */
290u_int8_tdeLowerCase;/* NT VFAT lower case flags */
291#defineLCASE_BASE0x08/* filename base in lower case */
292#defineLCASE_EXT0x10/* filename extension in lower case */
293u_int8_tdeCHundredth;/* hundredth of seconds in CTime */
294u_int8_tdeCTime[2];/* create time */
295u_int8_tdeCDate[2];/* create date */
296u_int8_tdeADate[2];/* access date */
297u_int8_tdeHighClust[2];/* high bytes of cluster number */
298u_int16_tdeMTime;/* last update time */
299u_int16_tdeMDate;/* last update date */
300u_int8_tdeStartCluster[2]; /* starting cluster of file */
301u_int8_tdeFileSize[4];/* size of file in bytes */
302};
303
304/*
305 * Structure of a Win95 long name directory entry
306 */
307struct winentry {
308u_int8_tweCnt;
309#defineWIN_LAST0x40
310#defineWIN_CNT0x3f
311u_int8_twePart1[10];
312u_int8_tweAttributes;
313#defineATTR_WIN950x0f
314u_int8_tweReserved1;
315u_int8_tweChksum;
316u_int8_twePart2[12];
317u_int16_tweReserved2;
318u_int8_twePart3[4];
319};
320#defineWIN_CHARS13/* Number of chars per winentry */
321
322/*
323 * Maximum filename length in Win95
324 * Note: Must be < sizeof(dirent.d_name)
325 */
326#defineWIN_MAXLEN255
327
328/*
329 * This is the format of the contents of the deTime field in the direntry
330 * structure.
331 * We don't use bitfields because we don't know how compilers for
332 * arbitrary machines will lay them out.
333 */
334#define DT_2SECONDS_MASK0x1F/* seconds divided by 2 */
335#define DT_2SECONDS_SHIFT0
336#define DT_MINUTES_MASK0x7E0/* minutes */
337#define DT_MINUTES_SHIFT5
338#define DT_HOURS_MASK0xF800/* hours */
339#define DT_HOURS_SHIFT11
340
341/*
342 * This is the format of the contents of the deDate field in the direntry
343 * structure.
344 */
345#define DD_DAY_MASK0x1F/* day of month */
346#define DD_DAY_SHIFT0
347#define DD_MONTH_MASK0x1E0/* month */
348#define DD_MONTH_SHIFT5
349#define DD_YEAR_MASK0xFE00/* year - 1980 */
350#define DD_YEAR_SHIFT9
351
352

Archive Download this file

Revision: 214