xref: /illumos-gate/usr/src/boot/sys/fs/cd9660/iso.h (revision 2a6e99a0f1f7d22c0396e8b2ce9b9babbd1056cf)
1*2a6e99a0SToomas Soome /*
2*2a6e99a0SToomas Soome  * SPDX-License-Identifier: BSD-3-Clause
3*2a6e99a0SToomas Soome  *
4*2a6e99a0SToomas Soome  * Copyright (c) 1994
5*2a6e99a0SToomas Soome  *	The Regents of the University of California.  All rights reserved.
6*2a6e99a0SToomas Soome  *
7*2a6e99a0SToomas Soome  * This code is derived from software contributed to Berkeley
8*2a6e99a0SToomas Soome  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
9*2a6e99a0SToomas Soome  * Support code is derived from software contributed to Berkeley
10*2a6e99a0SToomas Soome  * by Atsushi Murai (amurai@spec.co.jp).
11*2a6e99a0SToomas Soome  *
12*2a6e99a0SToomas Soome  * Redistribution and use in source and binary forms, with or without
13*2a6e99a0SToomas Soome  * modification, are permitted provided that the following conditions
14*2a6e99a0SToomas Soome  * are met:
15*2a6e99a0SToomas Soome  * 1. Redistributions of source code must retain the above copyright
16*2a6e99a0SToomas Soome  *    notice, this list of conditions and the following disclaimer.
17*2a6e99a0SToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
18*2a6e99a0SToomas Soome  *    notice, this list of conditions and the following disclaimer in the
19*2a6e99a0SToomas Soome  *    documentation and/or other materials provided with the distribution.
20*2a6e99a0SToomas Soome  * 3. Neither the name of the University nor the names of its contributors
21*2a6e99a0SToomas Soome  *    may be used to endorse or promote products derived from this software
22*2a6e99a0SToomas Soome  *    without specific prior written permission.
23*2a6e99a0SToomas Soome  *
24*2a6e99a0SToomas Soome  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25*2a6e99a0SToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26*2a6e99a0SToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27*2a6e99a0SToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28*2a6e99a0SToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29*2a6e99a0SToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30*2a6e99a0SToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31*2a6e99a0SToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32*2a6e99a0SToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33*2a6e99a0SToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34*2a6e99a0SToomas Soome  * SUCH DAMAGE.
35*2a6e99a0SToomas Soome  *
36*2a6e99a0SToomas Soome  *	@(#)iso.h	8.6 (Berkeley) 5/10/95
37*2a6e99a0SToomas Soome  */
38*2a6e99a0SToomas Soome 
39*2a6e99a0SToomas Soome #ifndef ISO_H
40*2a6e99a0SToomas Soome #define	ISO_H
41*2a6e99a0SToomas Soome 
42*2a6e99a0SToomas Soome #define	ISODCL(from, to) (to - from + 1)
43*2a6e99a0SToomas Soome 
44*2a6e99a0SToomas Soome struct iso_volume_descriptor {
45*2a6e99a0SToomas Soome 	char type[ISODCL(1, 1)]; /* 711 */
46*2a6e99a0SToomas Soome 	char id[ISODCL(2, 6)];
47*2a6e99a0SToomas Soome 	char version[ISODCL(7, 7)];
48*2a6e99a0SToomas Soome 	char unused[ISODCL(8, 8)];
49*2a6e99a0SToomas Soome 	char type_sierra[ISODCL(9, 9)]; /* 711 */
50*2a6e99a0SToomas Soome 	char id_sierra[ISODCL(10, 14)];
51*2a6e99a0SToomas Soome 	char version_sierra[ISODCL(15, 15)];
52*2a6e99a0SToomas Soome 	char data[ISODCL(16, 2048)];
53*2a6e99a0SToomas Soome };
54*2a6e99a0SToomas Soome 
55*2a6e99a0SToomas Soome /* volume descriptor types */
56*2a6e99a0SToomas Soome #define	ISO_VD_PRIMARY 1
57*2a6e99a0SToomas Soome #define	ISO_VD_SUPPLEMENTARY 2
58*2a6e99a0SToomas Soome #define	ISO_VD_END 255
59*2a6e99a0SToomas Soome 
60*2a6e99a0SToomas Soome #define	ISO_STANDARD_ID "CD001"
61*2a6e99a0SToomas Soome #define	ISO_ECMA_ID	"CDW01"
62*2a6e99a0SToomas Soome 
63*2a6e99a0SToomas Soome #define	ISO_SIERRA_ID	"CDROM"
64*2a6e99a0SToomas Soome 
65*2a6e99a0SToomas Soome struct iso_primary_descriptor {
66*2a6e99a0SToomas Soome 	uchar_t type			[ISODCL(1,	1)]; /* 711 */
67*2a6e99a0SToomas Soome 	char id				[ISODCL(2,	6)];
68*2a6e99a0SToomas Soome 	char version			[ISODCL(7,	7)]; /* 711 */
69*2a6e99a0SToomas Soome 	char unused1			[ISODCL(8,	8)];
70*2a6e99a0SToomas Soome 	char system_id			[ISODCL(9,  40)]; /* achars */
71*2a6e99a0SToomas Soome 	char volume_id			[ISODCL(41,  72)]; /* dchars */
72*2a6e99a0SToomas Soome 	char unused2			[ISODCL(73,  80)];
73*2a6e99a0SToomas Soome 	char volume_space_size		[ISODCL(81,  88)]; /* 733 */
74*2a6e99a0SToomas Soome 	char unused3			[ISODCL(89, 120)];
75*2a6e99a0SToomas Soome 	char volume_set_size		[ISODCL(121, 124)]; /* 723 */
76*2a6e99a0SToomas Soome 	char volume_sequence_number	[ISODCL(125, 128)]; /* 723 */
77*2a6e99a0SToomas Soome 	uchar_t logical_block_size	[ISODCL(129, 132)]; /* 723 */
78*2a6e99a0SToomas Soome 	char path_table_size		[ISODCL(133, 140)]; /* 733 */
79*2a6e99a0SToomas Soome 	char type_l_path_table		[ISODCL(141, 144)]; /* 731 */
80*2a6e99a0SToomas Soome 	char opt_type_l_path_table	[ISODCL(145, 148)]; /* 731 */
81*2a6e99a0SToomas Soome 	char type_m_path_table		[ISODCL(149, 152)]; /* 732 */
82*2a6e99a0SToomas Soome 	char opt_type_m_path_table	[ISODCL(153, 156)]; /* 732 */
83*2a6e99a0SToomas Soome 	char root_directory_record	[ISODCL(157, 190)]; /* 9.1 */
84*2a6e99a0SToomas Soome 	char volume_set_id		[ISODCL(191, 318)]; /* dchars */
85*2a6e99a0SToomas Soome 	char publisher_id		[ISODCL(319, 446)]; /* achars */
86*2a6e99a0SToomas Soome 	char preparer_id		[ISODCL(447, 574)]; /* achars */
87*2a6e99a0SToomas Soome 	char application_id		[ISODCL(575, 702)]; /* achars */
88*2a6e99a0SToomas Soome 	char copyright_file_id		[ISODCL(703, 739)]; /* 7.5 dchars */
89*2a6e99a0SToomas Soome 	char abstract_file_id		[ISODCL(740, 776)]; /* 7.5 dchars */
90*2a6e99a0SToomas Soome 	char bibliographic_file_id	[ISODCL(777, 813)]; /* 7.5 dchars */
91*2a6e99a0SToomas Soome 	char creation_date		[ISODCL(814, 830)]; /* 8.4.26.1 */
92*2a6e99a0SToomas Soome 	char modification_date		[ISODCL(831, 847)]; /* 8.4.26.1 */
93*2a6e99a0SToomas Soome 	char expiration_date		[ISODCL(848, 864)]; /* 8.4.26.1 */
94*2a6e99a0SToomas Soome 	char effective_date		[ISODCL(865, 881)]; /* 8.4.26.1 */
95*2a6e99a0SToomas Soome 	char file_structure_version	[ISODCL(882, 882)]; /* 711 */
96*2a6e99a0SToomas Soome 	char unused4			[ISODCL(883, 883)];
97*2a6e99a0SToomas Soome 	char application_data		[ISODCL(884, 1395)];
98*2a6e99a0SToomas Soome 	char unused5			[ISODCL(1396, 2048)];
99*2a6e99a0SToomas Soome } __packed;
100*2a6e99a0SToomas Soome #define ISO_DEFAULT_BLOCK_SHIFT		11
101*2a6e99a0SToomas Soome #define ISO_DEFAULT_BLOCK_SIZE		(1 << ISO_DEFAULT_BLOCK_SHIFT)
102*2a6e99a0SToomas Soome 
103*2a6e99a0SToomas Soome /*
104*2a6e99a0SToomas Soome  * Used by Microsoft Joliet extension to ISO9660. Almost the same
105*2a6e99a0SToomas Soome  * as PVD, but byte position 8 is a flag, and 89-120 is for escape.
106*2a6e99a0SToomas Soome  */
107*2a6e99a0SToomas Soome 
108*2a6e99a0SToomas Soome struct iso_supplementary_descriptor {
109*2a6e99a0SToomas Soome 	char type				[ISODCL(1,   1)]; /* 711 */
110*2a6e99a0SToomas Soome 	char id				[ISODCL(2,   6)];
111*2a6e99a0SToomas Soome 	char version			[ISODCL(7,   7)]; /* 711 */
112*2a6e99a0SToomas Soome 	char flags			[ISODCL(8,   8)]; /* 711? */
113*2a6e99a0SToomas Soome 	char system_id			[ISODCL(9,  40)]; /* achars */
114*2a6e99a0SToomas Soome 	char volume_id			[ISODCL(41,  72)]; /* dchars */
115*2a6e99a0SToomas Soome 	char unused2			[ISODCL(73,  80)];
116*2a6e99a0SToomas Soome 	char volume_space_size		[ISODCL(81,  88)]; /* 733 */
117*2a6e99a0SToomas Soome 	char escape			[ISODCL(89, 120)];
118*2a6e99a0SToomas Soome 	char volume_set_size		[ISODCL(121, 124)]; /* 723 */
119*2a6e99a0SToomas Soome 	char volume_sequence_number	[ISODCL(125, 128)]; /* 723 */
120*2a6e99a0SToomas Soome 	char logical_block_size		[ISODCL(129, 132)]; /* 723 */
121*2a6e99a0SToomas Soome 	char path_table_size		[ISODCL(133, 140)]; /* 733 */
122*2a6e99a0SToomas Soome 	char type_l_path_table		[ISODCL(141, 144)]; /* 731 */
123*2a6e99a0SToomas Soome 	char opt_type_l_path_table	[ISODCL(145, 148)]; /* 731 */
124*2a6e99a0SToomas Soome 	char type_m_path_table		[ISODCL(149, 152)]; /* 732 */
125*2a6e99a0SToomas Soome 	char opt_type_m_path_table	[ISODCL(153, 156)]; /* 732 */
126*2a6e99a0SToomas Soome 	char root_directory_record	[ISODCL(157, 190)]; /* 9.1 */
127*2a6e99a0SToomas Soome 	char volume_set_id		[ISODCL(191, 318)]; /* dchars */
128*2a6e99a0SToomas Soome 	char publisher_id			[ISODCL(319, 446)]; /* achars */
129*2a6e99a0SToomas Soome 	char preparer_id			[ISODCL(447, 574)]; /* achars */
130*2a6e99a0SToomas Soome 	char application_id		[ISODCL(575, 702)]; /* achars */
131*2a6e99a0SToomas Soome 	char copyright_file_id		[ISODCL(703, 739)]; /* 7.5 dchars */
132*2a6e99a0SToomas Soome 	char abstract_file_id		[ISODCL(740, 776)]; /* 7.5 dchars */
133*2a6e99a0SToomas Soome 	char bibliographic_file_id	[ISODCL(777, 813)]; /* 7.5 dchars */
134*2a6e99a0SToomas Soome 	char creation_date		[ISODCL(814, 830)]; /* 8.4.26.1 */
135*2a6e99a0SToomas Soome 	char modification_date		[ISODCL(831, 847)]; /* 8.4.26.1 */
136*2a6e99a0SToomas Soome 	char expiration_date		[ISODCL(848, 864)]; /* 8.4.26.1 */
137*2a6e99a0SToomas Soome 	char effective_date		[ISODCL(865, 881)]; /* 8.4.26.1 */
138*2a6e99a0SToomas Soome 	char file_structure_version	[ISODCL(882, 882)]; /* 711 */
139*2a6e99a0SToomas Soome 	char unused4			[ISODCL(883, 883)];
140*2a6e99a0SToomas Soome 	char application_data		[ISODCL(884, 1395)];
141*2a6e99a0SToomas Soome 	char unused5			[ISODCL(1396, 2048)];
142*2a6e99a0SToomas Soome };
143*2a6e99a0SToomas Soome 
144*2a6e99a0SToomas Soome struct iso_sierra_primary_descriptor {
145*2a6e99a0SToomas Soome 	char unknown1			[ISODCL(1,	8)]; /* 733 */
146*2a6e99a0SToomas Soome 	char type			[ISODCL(9,	9)]; /* 711 */
147*2a6e99a0SToomas Soome 	char id				[ISODCL(10,  14)];
148*2a6e99a0SToomas Soome 	char version			[ISODCL(15,  15)]; /* 711 */
149*2a6e99a0SToomas Soome 	char unused1			[ISODCL(16,  16)];
150*2a6e99a0SToomas Soome 	char system_id			[ISODCL(17,  48)]; /* achars */
151*2a6e99a0SToomas Soome 	char volume_id			[ISODCL(49,  80)]; /* dchars */
152*2a6e99a0SToomas Soome 	char unused2			[ISODCL(81,  88)];
153*2a6e99a0SToomas Soome 	char volume_space_size		[ISODCL(89,  96)]; /* 733 */
154*2a6e99a0SToomas Soome 	char unused3			[ISODCL(97, 128)];
155*2a6e99a0SToomas Soome 	char volume_set_size		[ISODCL(129, 132)]; /* 723 */
156*2a6e99a0SToomas Soome 	char volume_sequence_number	[ISODCL(133, 136)]; /* 723 */
157*2a6e99a0SToomas Soome 	char logical_block_size		[ISODCL(137, 140)]; /* 723 */
158*2a6e99a0SToomas Soome 	char path_table_size		[ISODCL(141, 148)]; /* 733 */
159*2a6e99a0SToomas Soome 	char type_l_path_table		[ISODCL(149, 152)]; /* 731 */
160*2a6e99a0SToomas Soome 	char opt_type_l_path_table	[ISODCL(153, 156)]; /* 731 */
161*2a6e99a0SToomas Soome 	char unknown2			[ISODCL(157, 160)]; /* 731 */
162*2a6e99a0SToomas Soome 	char unknown3			[ISODCL(161, 164)]; /* 731 */
163*2a6e99a0SToomas Soome 	char type_m_path_table		[ISODCL(165, 168)]; /* 732 */
164*2a6e99a0SToomas Soome 	char opt_type_m_path_table	[ISODCL(169, 172)]; /* 732 */
165*2a6e99a0SToomas Soome 	char unknown4			[ISODCL(173, 176)]; /* 732 */
166*2a6e99a0SToomas Soome 	char unknown5			[ISODCL(177, 180)]; /* 732 */
167*2a6e99a0SToomas Soome 	char root_directory_record	[ISODCL(181, 214)]; /* 9.1 */
168*2a6e99a0SToomas Soome 	char volume_set_id		[ISODCL(215, 342)]; /* dchars */
169*2a6e99a0SToomas Soome 	char publisher_id		[ISODCL(343, 470)]; /* achars */
170*2a6e99a0SToomas Soome 	char preparer_id		[ISODCL(471, 598)]; /* achars */
171*2a6e99a0SToomas Soome 	char application_id		[ISODCL(599, 726)]; /* achars */
172*2a6e99a0SToomas Soome 	char copyright_id		[ISODCL(727, 790)]; /* achars */
173*2a6e99a0SToomas Soome 	char creation_date		[ISODCL(791, 806)]; /* ? */
174*2a6e99a0SToomas Soome 	char modification_date		[ISODCL(807, 822)]; /* ? */
175*2a6e99a0SToomas Soome 	char expiration_date		[ISODCL(823, 838)]; /* ? */
176*2a6e99a0SToomas Soome 	char effective_date		[ISODCL(839, 854)]; /* ? */
177*2a6e99a0SToomas Soome 	char file_structure_version	[ISODCL(855, 855)]; /* 711 */
178*2a6e99a0SToomas Soome 	char unused4			[ISODCL(856, 2048)];
179*2a6e99a0SToomas Soome };
180*2a6e99a0SToomas Soome 
181*2a6e99a0SToomas Soome struct iso_directory_record {
182*2a6e99a0SToomas Soome 	uchar_t length			[ISODCL(1, 1)]; /* 711 */
183*2a6e99a0SToomas Soome 	uchar_t ext_attr_length		[ISODCL(2, 2)]; /* 711 */
184*2a6e99a0SToomas Soome 	uchar_t extent			[ISODCL(3, 10)]; /* 733 */
185*2a6e99a0SToomas Soome 	uchar_t size			[ISODCL(11, 18)]; /* 733 */
186*2a6e99a0SToomas Soome 	char date			[ISODCL(19, 25)]; /* 7 by 711 */
187*2a6e99a0SToomas Soome 	uchar_t flags			[ISODCL(26, 26)];
188*2a6e99a0SToomas Soome 	char file_unit_size		[ISODCL(27, 27)]; /* 711 */
189*2a6e99a0SToomas Soome 	char interleave			[ISODCL(28, 28)]; /* 711 */
190*2a6e99a0SToomas Soome 	char volume_sequence_number	[ISODCL(29, 32)]; /* 723 */
191*2a6e99a0SToomas Soome 	uchar_t name_len			[ISODCL(33, 33)]; /* 711 */
192*2a6e99a0SToomas Soome 	char name			[1];			/* XXX */
193*2a6e99a0SToomas Soome } __packed;
194*2a6e99a0SToomas Soome /*
195*2a6e99a0SToomas Soome  * can't take sizeof(iso_directory_record), because of possible alignment
196*2a6e99a0SToomas Soome  * of the last entry (34 instead of 33)
197*2a6e99a0SToomas Soome  */
198*2a6e99a0SToomas Soome #define	ISO_DIRECTORY_RECORD_SIZE	33
199*2a6e99a0SToomas Soome 
200*2a6e99a0SToomas Soome struct iso_extended_attributes {
201*2a6e99a0SToomas Soome 	uchar_t owner			[ISODCL(1, 4)]; /* 723 */
202*2a6e99a0SToomas Soome 	uchar_t group			[ISODCL(5, 8)]; /* 723 */
203*2a6e99a0SToomas Soome 	uchar_t perm			[ISODCL(9, 10)]; /* 9.5.3 */
204*2a6e99a0SToomas Soome 	char ctime			[ISODCL(11, 27)]; /* 8.4.26.1 */
205*2a6e99a0SToomas Soome 	char mtime			[ISODCL(28, 44)]; /* 8.4.26.1 */
206*2a6e99a0SToomas Soome 	char xtime			[ISODCL(45, 61)]; /* 8.4.26.1 */
207*2a6e99a0SToomas Soome 	char ftime			[ISODCL(62, 78)]; /* 8.4.26.1 */
208*2a6e99a0SToomas Soome 	char recfmt			[ISODCL(79, 79)]; /* 711 */
209*2a6e99a0SToomas Soome 	char recattr			[ISODCL(80, 80)]; /* 711 */
210*2a6e99a0SToomas Soome 	uchar_t reclen			[ISODCL(81, 84)]; /* 723 */
211*2a6e99a0SToomas Soome 	char system_id			[ISODCL(85, 116)]; /* achars */
212*2a6e99a0SToomas Soome 	char system_use			[ISODCL(117, 180)];
213*2a6e99a0SToomas Soome 	char version			[ISODCL(181, 181)]; /* 711 */
214*2a6e99a0SToomas Soome 	char len_esc			[ISODCL(182, 182)]; /* 711 */
215*2a6e99a0SToomas Soome 	char reserved			[ISODCL(183, 246)];
216*2a6e99a0SToomas Soome 	uchar_t len_au			[ISODCL(247, 250)]; /* 723 */
217*2a6e99a0SToomas Soome };
218*2a6e99a0SToomas Soome 
219*2a6e99a0SToomas Soome #ifdef _KERNEL
220*2a6e99a0SToomas Soome 
221*2a6e99a0SToomas Soome /* CD-ROM Format type */
222*2a6e99a0SToomas Soome enum ISO_FTYPE	{
223*2a6e99a0SToomas Soome 	ISO_FTYPE_DEFAULT,
224*2a6e99a0SToomas Soome 	ISO_FTYPE_9660,
225*2a6e99a0SToomas Soome 	ISO_FTYPE_RRIP,
226*2a6e99a0SToomas Soome 	ISO_FTYPE_JOLIET,
227*2a6e99a0SToomas Soome 	ISO_FTYPE_ECMA,
228*2a6e99a0SToomas Soome 	ISO_FTYPE_HIGH_SIERRA
229*2a6e99a0SToomas Soome };
230*2a6e99a0SToomas Soome 
231*2a6e99a0SToomas Soome #ifndef	ISOFSMNT_ROOT
232*2a6e99a0SToomas Soome #define	ISOFSMNT_ROOT	0
233*2a6e99a0SToomas Soome #endif
234*2a6e99a0SToomas Soome 
235*2a6e99a0SToomas Soome /*
236*2a6e99a0SToomas Soome  * When ino_t becomes 64-bit, we can remove this definition in favor of ino_t.
237*2a6e99a0SToomas Soome  */
238*2a6e99a0SToomas Soome typedef __uint64_t cd_ino_t;
239*2a6e99a0SToomas Soome 
240*2a6e99a0SToomas Soome struct iso_mnt {
241*2a6e99a0SToomas Soome 	uint64_t im_flags;
242*2a6e99a0SToomas Soome 
243*2a6e99a0SToomas Soome 	struct mount *im_mountp;
244*2a6e99a0SToomas Soome 	struct cdev *im_dev;
245*2a6e99a0SToomas Soome 	struct vnode *im_devvp;
246*2a6e99a0SToomas Soome 
247*2a6e99a0SToomas Soome 	struct g_consumer *im_cp;
248*2a6e99a0SToomas Soome 	struct bufobj *im_bo;
249*2a6e99a0SToomas Soome 
250*2a6e99a0SToomas Soome 	int logical_block_size;
251*2a6e99a0SToomas Soome 	int im_bshift;
252*2a6e99a0SToomas Soome 	int im_bmask;
253*2a6e99a0SToomas Soome 
254*2a6e99a0SToomas Soome 	int volume_space_size;
255*2a6e99a0SToomas Soome 
256*2a6e99a0SToomas Soome 	char root[ISODCL(157, 190)];
257*2a6e99a0SToomas Soome 	int root_extent;
258*2a6e99a0SToomas Soome 	int root_size;
259*2a6e99a0SToomas Soome 	enum ISO_FTYPE	iso_ftype;
260*2a6e99a0SToomas Soome 
261*2a6e99a0SToomas Soome 	int rr_skip;
262*2a6e99a0SToomas Soome 	int rr_skip0;
263*2a6e99a0SToomas Soome 
264*2a6e99a0SToomas Soome 	int joliet_level;
265*2a6e99a0SToomas Soome 
266*2a6e99a0SToomas Soome 	void *im_d2l;
267*2a6e99a0SToomas Soome 	void *im_l2d;
268*2a6e99a0SToomas Soome };
269*2a6e99a0SToomas Soome 
270*2a6e99a0SToomas Soome struct ifid {
271*2a6e99a0SToomas Soome 	ushort_t	ifid_len;
272*2a6e99a0SToomas Soome 	ushort_t	ifid_pad;
273*2a6e99a0SToomas Soome 	cd_ino_t	ifid_ino;
274*2a6e99a0SToomas Soome 	long		ifid_start;
275*2a6e99a0SToomas Soome };
276*2a6e99a0SToomas Soome 
277*2a6e99a0SToomas Soome #define	VFSTOISOFS(mp)	((struct iso_mnt *)((mp)->mnt_data))
278*2a6e99a0SToomas Soome 
279*2a6e99a0SToomas Soome #define	blkoff(imp, loc)	((loc) & (imp)->im_bmask)
280*2a6e99a0SToomas Soome #define	lblktosize(imp, blk)	((blk) << (imp)->im_bshift)
281*2a6e99a0SToomas Soome #define	lblkno(imp, loc)	((loc) >> (imp)->im_bshift)
282*2a6e99a0SToomas Soome #define	blksize(imp, ip, lbn)	((imp)->logical_block_size)
283*2a6e99a0SToomas Soome 
284*2a6e99a0SToomas Soome int cd9660_vget_internal(struct mount *, cd_ino_t, int, struct vnode **, int,
285*2a6e99a0SToomas Soome     struct iso_directory_record *);
286*2a6e99a0SToomas Soome #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \
287*2a6e99a0SToomas Soome 				size_t, struct proc *))eopnotsupp)
288*2a6e99a0SToomas Soome 
289*2a6e99a0SToomas Soome extern struct vop_vector cd9660_vnodeops;
290*2a6e99a0SToomas Soome extern struct vop_vector cd9660_fifoops;
291*2a6e99a0SToomas Soome 
292*2a6e99a0SToomas Soome int isochar(uchar_t *, uchar_t *, int, ushort_t *, int *, int, void *);
293*2a6e99a0SToomas Soome int isofncmp(uchar_t *, int, uchar_t *, int, int, int, void *, void *);
294*2a6e99a0SToomas Soome void isofntrans(uchar_t *, int, uchar_t *, ushort_t *, int, int, int, int, void *);
295*2a6e99a0SToomas Soome cd_ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
296*2a6e99a0SToomas Soome ushort_t sgetrune(const char *, size_t, char const **, int, void *);
297*2a6e99a0SToomas Soome 
298*2a6e99a0SToomas Soome #endif /* _KERNEL */
299*2a6e99a0SToomas Soome 
300*2a6e99a0SToomas Soome /*
301*2a6e99a0SToomas Soome  * The isonum_xxx functions are inlined anyway, and could come handy even
302*2a6e99a0SToomas Soome  * outside the kernel.  Thus we don't hide them here.
303*2a6e99a0SToomas Soome  */
304*2a6e99a0SToomas Soome 
305*2a6e99a0SToomas Soome /*
306*2a6e99a0SToomas Soome  * 7xy
307*2a6e99a0SToomas Soome  *  x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits
308*2a6e99a0SToomas Soome  *   y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)
309*2a6e99a0SToomas Soome  */
310*2a6e99a0SToomas Soome 
311*2a6e99a0SToomas Soome static __inline uint8_t
isonum_711(const unsigned char * p)312*2a6e99a0SToomas Soome isonum_711(const unsigned char *p)
313*2a6e99a0SToomas Soome {
314*2a6e99a0SToomas Soome 
315*2a6e99a0SToomas Soome 	return (p[0]);
316*2a6e99a0SToomas Soome }
317*2a6e99a0SToomas Soome 
318*2a6e99a0SToomas Soome static __inline int8_t
isonum_712(const unsigned char * p)319*2a6e99a0SToomas Soome isonum_712(const unsigned char *p)
320*2a6e99a0SToomas Soome {
321*2a6e99a0SToomas Soome 
322*2a6e99a0SToomas Soome 	return ((signed char)p[0]);
323*2a6e99a0SToomas Soome }
324*2a6e99a0SToomas Soome 
325*2a6e99a0SToomas Soome static __inline uint8_t
isonum_713(const unsigned char * p)326*2a6e99a0SToomas Soome isonum_713(const unsigned char *p)
327*2a6e99a0SToomas Soome {
328*2a6e99a0SToomas Soome 
329*2a6e99a0SToomas Soome 	return (p[0]);
330*2a6e99a0SToomas Soome }
331*2a6e99a0SToomas Soome 
332*2a6e99a0SToomas Soome static __inline uint16_t
isonum_721(const unsigned char * p)333*2a6e99a0SToomas Soome isonum_721(const unsigned char *p)
334*2a6e99a0SToomas Soome {
335*2a6e99a0SToomas Soome 
336*2a6e99a0SToomas Soome 	return (p[0] | p[1] << 8);
337*2a6e99a0SToomas Soome }
338*2a6e99a0SToomas Soome 
339*2a6e99a0SToomas Soome static __inline uint16_t
isonum_722(const unsigned char * p)340*2a6e99a0SToomas Soome isonum_722(const unsigned char *p)
341*2a6e99a0SToomas Soome {
342*2a6e99a0SToomas Soome 
343*2a6e99a0SToomas Soome 	return (p[1] | p[0] << 8);
344*2a6e99a0SToomas Soome }
345*2a6e99a0SToomas Soome 
346*2a6e99a0SToomas Soome static __inline uint16_t
isonum_723(const unsigned char * p)347*2a6e99a0SToomas Soome isonum_723(const unsigned char *p)
348*2a6e99a0SToomas Soome {
349*2a6e99a0SToomas Soome 
350*2a6e99a0SToomas Soome 	return (p[0] | p[1] << 8);
351*2a6e99a0SToomas Soome }
352*2a6e99a0SToomas Soome 
353*2a6e99a0SToomas Soome static __inline uint32_t
isonum_731(const unsigned char * p)354*2a6e99a0SToomas Soome isonum_731(const unsigned char *p)
355*2a6e99a0SToomas Soome {
356*2a6e99a0SToomas Soome 
357*2a6e99a0SToomas Soome 	return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
358*2a6e99a0SToomas Soome }
359*2a6e99a0SToomas Soome 
360*2a6e99a0SToomas Soome static __inline uint32_t
isonum_732(const unsigned char * p)361*2a6e99a0SToomas Soome isonum_732(const unsigned char *p)
362*2a6e99a0SToomas Soome {
363*2a6e99a0SToomas Soome 
364*2a6e99a0SToomas Soome 	return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);
365*2a6e99a0SToomas Soome }
366*2a6e99a0SToomas Soome 
367*2a6e99a0SToomas Soome static __inline uint32_t
isonum_733(const unsigned char * p)368*2a6e99a0SToomas Soome isonum_733(const unsigned char *p)
369*2a6e99a0SToomas Soome {
370*2a6e99a0SToomas Soome 
371*2a6e99a0SToomas Soome 	return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
372*2a6e99a0SToomas Soome }
373*2a6e99a0SToomas Soome 
374*2a6e99a0SToomas Soome /*
375*2a6e99a0SToomas Soome  * Associated files have a leading '='.
376*2a6e99a0SToomas Soome  */
377*2a6e99a0SToomas Soome #define	ASSOCCHAR	'='
378*2a6e99a0SToomas Soome 
379*2a6e99a0SToomas Soome #endif	/* ISO_H */
380