1 #define	VOLDESC	16	/* sector number */
2 
3 /*
4  * L means little-endian, M means big-endian, and LM means little-endian
5  * then again big-endian.
6  */
7 typedef uchar		Byte2L[2];
8 typedef uchar		Byte2M[2];
9 typedef uchar		Byte4LM[4];
10 typedef uchar		Byte4L[4];
11 typedef uchar		Byte4M[4];
12 typedef uchar		Byte8LM[8];
13 typedef union Drec	Drec;
14 typedef union Voldesc	Voldesc;
15 
16 enum
17 {
18 	Boot		= 0,
19 	Primary		= 1,
20 	Supplementary	= 2,
21 	Partition	= 3,
22 	Terminator	= 255
23 };
24 
25 union	Voldesc
26 {			/* volume descriptor */
27 	uchar	byte[Sectorsize];
28 	union {			/* for CD001, the ECMA standard */
29 		struct
30 		{
31 			uchar	type;
32 			uchar	stdid[5];
33 			uchar	version;
34 			uchar	unused;
35 			uchar	sysid[32];
36 			uchar	bootid[32];
37 			uchar	data[1977];
38 		} boot;
39 		struct
40 		{
41 			uchar	type;
42 			uchar	stdid[5];
43 			uchar	version;
44 			uchar	flags;
45 			uchar	sysid[32];
46 			uchar	volid[32];
47 			Byte8LM	partloc;
48 			Byte8LM	size;
49 			uchar	escapes[32];
50 			Byte4LM	vsetsize;
51 			Byte4LM	vseqno;
52 			Byte4LM	blksize;
53 			Byte8LM	ptabsize;
54 			Byte4L	lptable;
55 			Byte4L	optlptable;
56 			Byte4M	mptable;
57 			Byte4M	optmptable;
58 			uchar	rootdir[34];
59 			uchar	volsetid[128];
60 			uchar	pubid[128];
61 			uchar	prepid[128];
62 			uchar	appid[128];
63 			uchar	copyright[37];
64 			uchar	abstract[37];
65 			uchar	bibliography[37];
66 			uchar	cdate[17];
67 			uchar	mdate[17];
68 			uchar	expdate[17];
69 			uchar	effdate[17];
70 			uchar	fsversion;
71 			uchar	unused3[1];
72 			uchar	appuse[512];
73 			uchar	unused4[653];
74 		} desc;
75 	} z;
76 	union
77 	{			/* for CDROM, the `High Sierra' standard */
78 		struct
79 		{
80 			Byte8LM	number;
81 			uchar	type;
82 			uchar	stdid[5];
83 			uchar	version;
84 			uchar	flags;
85 			uchar	sysid[32];
86 			uchar	volid[32];
87 			Byte8LM	partloc;
88 			Byte8LM	size;
89 			uchar	escapes[32];
90 			Byte4LM	vsetsize;
91 			Byte4LM	vseqno;
92 			Byte4LM	blksize;
93 			uchar	quux[40];
94 			uchar	rootdir[34];
95 			uchar	volsetid[128];
96 			uchar	pubid[128];
97 			uchar	prepid[128];
98 			uchar	appid[128];
99 			uchar	copyright[32];
100 			uchar	abstract[32];
101 			uchar	cdate[16];
102 			uchar	mdate[16];
103 			uchar	expdate[16];
104 			uchar	effdate[16];
105 			uchar	fsversion;
106 		} desc;
107 	} r;
108 };
109 
110 union	Drec
111 {
112 	struct
113 	{
114 		uchar	reclen;
115 		uchar	attrlen;
116 		Byte8LM	addr;
117 		Byte8LM	size;
118 		uchar	date[6];
119 		uchar	tzone;		/* flags in high sierra */
120 		uchar	flags;		/* ? in high sierra */
121 		uchar	unitsize;	/* ? in high sierra */
122 		uchar	gapsize;	/* ? in high sierra */
123 		Byte4LM	vseqno;		/* ? in high sierra */
124 		uchar	namelen;
125 		uchar	name[1];
126 	} z;
127 	struct
128 	{
129 		uchar	pad[24];
130 		uchar	flags;
131 	} r;
132 };
133 
134 struct	Isofile
135 {
136 	short	fmt;		/* 'z' if iso, 'r' if high sierra */
137 	short	blksize;
138 	long	offset;		/* true offset when reading directory */
139 	long odelta;	/* true size of directory just read */
140 	long	doffset;	/* plan9 offset when reading directory */
141 	Drec	d;
142 };
143