1 /* $OpenBSD: msdos.h,v 1.2 2000/08/05 22:05:31 niklas Exp $ */
2 /* $NetBSD: msdos.h,v 1.3 1994/10/27 04:16:37 cgd Exp $ */
3
4 /*
5 * msdos common header file
6 * [obtained from mtools -wfj]
7 * how to decipher DOS disk structures in coexisting with DOS
8 */
9
10 #define MSECTOR_SIZE 512 /* MSDOS sector size in bytes */
11 #define MDIR_SIZE 32 /* MSDOS directory size in bytes */
12 #define MAX_CLUSTER 8192 /* largest cluster size */
13 #define MAX_PATH 128 /* largest MSDOS path length */
14 #define MAX_DIR_SECS 64 /* largest directory (in sectors) */
15
16 #define NEW 1
17 #define OLD 0
18
19 struct directory {
20 unsigned char name[8]; /* file name */
21 unsigned char ext[3]; /* file extension */
22 unsigned char attr; /* attribute byte */
23 unsigned char reserved[10]; /* ?? */
24 unsigned char time[2]; /* time stamp */
25 unsigned char date[2]; /* date stamp */
26 unsigned char start[2]; /* starting cluster number */
27 unsigned char size[4]; /* size of the file */
28 };
29
30 struct bootsector {
31 unsigned char jump[3]; /* Jump to boot code */
32 unsigned char banner[8]; /* OEM name & version */
33 unsigned char secsiz[2]; /* Bytes per sector hopefully 512 */
34 unsigned char clsiz; /* Cluster size in sectors */
35 unsigned char nrsvsect[2]; /* Number of reserved (boot) sectors */
36 unsigned char nfat; /* Number of FAT tables hopefully 2 */
37 unsigned char dirents[2]; /* Number of directory slots */
38 unsigned char psect[2]; /* Total sectors on disk */
39 unsigned char descr; /* Media descriptor=first byte of FAT */
40 unsigned char fatlen[2]; /* Sectors in FAT */
41 unsigned char nsect[2]; /* Sectors/track */
42 unsigned char nheads[2]; /* Heads */
43 unsigned char nhs[4]; /* number of hidden sectors */
44 unsigned char bigsect[4]; /* big total sectors */
45 unsigned char junk[476]; /* who cares? */
46 };
47
48 /* DOS partition table -- located in boot block */
49
50 #define DOSBBSECTOR 0 /* DOS boot block relative sector number */
51 #define DOSPARTOFF 446
52 #define NDOSPART 4
53
54 struct dos_partition {
55 unsigned char dp_flag; /* bootstrap flags */
56 unsigned char dp_shd; /* starting head */
57 unsigned char dp_ssect; /* starting sector */
58 unsigned char dp_scyl; /* starting cylinder */
59 unsigned char dp_typ; /* partition type */
60 #define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
61 unsigned char dp_ehd; /* end head */
62 unsigned char dp_esect; /* end sector */
63 unsigned char dp_ecyl; /* end cylinder */
64 unsigned long dp_start; /* absolute starting sector number */
65 unsigned long dp_size; /* partition size in sectors */
66 } dos_partitions[NDOSPART];