aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9660srv/iso9660.h
blob: 6e3328f204281b5095eb0abbf59daee9493e313c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#define	VOLDESC	16	/* sector number */

/*
 * L means little-endian, M means big-endian, and LM means little-endian
 * then again big-endian.
 */
typedef uchar		Byte2L[2];
typedef uchar		Byte2M[2];
typedef uchar		Byte4LM[4];
typedef uchar		Byte4L[4];
typedef uchar		Byte4M[4];
typedef uchar		Byte8LM[8];
typedef union Drec	Drec;
typedef union Voldesc	Voldesc;

enum
{
	Boot		= 0,
	Primary		= 1,
	Supplementary	= 2,
	Partition	= 3,
	Terminator	= 255
};

union	Voldesc
{			/* volume descriptor */
	uchar	byte[Sectorsize];
	union {			/* for CD001, the ECMA standard */
		struct
		{
			uchar	type;
			uchar	stdid[5];
			uchar	version;
			uchar	unused;
			uchar	sysid[32];
			uchar	bootid[32];
			uchar	data[1977];
		} boot;
		struct
		{
			uchar	type;
			uchar	stdid[5];
			uchar	version;
			uchar	flags;
			uchar	sysid[32];
			uchar	volid[32];
			Byte8LM	partloc;
			Byte8LM	size;
			uchar	escapes[32];
			Byte4LM	vsetsize;
			Byte4LM	vseqno;
			Byte4LM	blksize;
			Byte8LM	ptabsize;
			Byte4L	lptable;
			Byte4L	optlptable;
			Byte4M	mptable;
			Byte4M	optmptable;
			uchar	rootdir[34];
			uchar	volsetid[128];
			uchar	pubid[128];
			uchar	prepid[128];
			uchar	appid[128];
			uchar	copyright[37];
			uchar	abstract[37];
			uchar	bibliography[37];
			uchar	cdate[17];
			uchar	mdate[17];
			uchar	expdate[17];
			uchar	effdate[17];
			uchar	fsversion;
			uchar	unused3[1];
			uchar	appuse[512];
			uchar	unused4[653];
		} desc;
	} z;
	union
	{			/* for CDROM, the `High Sierra' standard */
		struct
		{
			Byte8LM	number;
			uchar	type;
			uchar	stdid[5];
			uchar	version;
			uchar	flags;
			uchar	sysid[32];
			uchar	volid[32];
			Byte8LM	partloc;
			Byte8LM	size;
			uchar	escapes[32];
			Byte4LM	vsetsize;
			Byte4LM	vseqno;
			Byte4LM	blksize;
			uchar	quux[40];
			uchar	rootdir[34];
			uchar	volsetid[128];
			uchar	pubid[128];
			uchar	prepid[128];
			uchar	appid[128];
			uchar	copyright[32];
			uchar	abstract[32];
			uchar	cdate[16];
			uchar	mdate[16];
			uchar	expdate[16];
			uchar	effdate[16];
			uchar	fsversion;
		} desc;
	} r;
};

union	Drec
{
	struct
	{
		uchar	reclen;
		uchar	attrlen;
		Byte8LM	addr;
		Byte8LM	size;
		uchar	date[6];
		uchar	tzone;		/* flags in high sierra */
		uchar	flags;		/* ? in high sierra */
		uchar	unitsize;	/* ? in high sierra */
		uchar	gapsize;	/* ? in high sierra */
		Byte4LM	vseqno;		/* ? in high sierra */
		uchar	namelen;
		uchar	name[1];
	} z;
	struct
	{
		uchar	pad[24];
		uchar	flags;
	} r;
};

struct	Isofile
{
	short	fmt;		/* 'z' if iso, 'r' if high sierra */
	short	blksize;
	long	offset;		/* true offset when reading directory */
	long odelta;	/* true size of directory just read */
	long	doffset;	/* plan9 offset when reading directory */
	Drec	d;
};