xref: /freebsd/sys/fs/cd9660/iso.h (revision 68c3cec90a87d0d833a34f58135be9a1b063087a)
1df8bae1dSRodney W. Grimes /*-
251369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
351369649SPedro F. Giffuni  *
4df8bae1dSRodney W. Grimes  * Copyright (c) 1994
5df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
6df8bae1dSRodney W. Grimes  *
7df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley
8df8bae1dSRodney W. Grimes  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
9df8bae1dSRodney W. Grimes  * Support code is derived from software contributed to Berkeley
10df8bae1dSRodney W. Grimes  * by Atsushi Murai (amurai@spec.co.jp).
11df8bae1dSRodney W. Grimes  *
12df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
13df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
14df8bae1dSRodney W. Grimes  * are met:
15df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
16df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
17df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
18df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
19df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
20fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
21df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
22df8bae1dSRodney W. Grimes  *    without specific prior written permission.
23df8bae1dSRodney W. Grimes  *
24df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
35df8bae1dSRodney W. Grimes  */
36df8bae1dSRodney W. Grimes 
37d33cdf16SEd Maste #ifndef _ISOFS_CD9660_ISO_H_
38d33cdf16SEd Maste #define _ISOFS_CD9660_ISO_H_
39d33cdf16SEd Maste 
40df8bae1dSRodney W. Grimes #define ISODCL(from, to) (to - from + 1)
41df8bae1dSRodney W. Grimes 
42df8bae1dSRodney W. Grimes struct iso_volume_descriptor {
43df8bae1dSRodney W. Grimes 	char type[ISODCL(1,1)]; /* 711 */
44df8bae1dSRodney W. Grimes 	char id[ISODCL(2,6)];
45df8bae1dSRodney W. Grimes 	char version[ISODCL(7,7)];
46988fa8efSJoerg Wunsch 	char unused[ISODCL(8,8)];
47988fa8efSJoerg Wunsch 	char type_sierra[ISODCL(9,9)]; /* 711 */
48988fa8efSJoerg Wunsch 	char id_sierra[ISODCL(10,14)];
49988fa8efSJoerg Wunsch 	char version_sierra[ISODCL(15,15)];
50988fa8efSJoerg Wunsch 	char data[ISODCL(16,2048)];
51df8bae1dSRodney W. Grimes };
52df8bae1dSRodney W. Grimes 
53df8bae1dSRodney W. Grimes /* volume descriptor types */
54df8bae1dSRodney W. Grimes #define ISO_VD_PRIMARY 1
5544e568e2SDaniel C. Sobral #define ISO_VD_SUPPLEMENTARY 2
56df8bae1dSRodney W. Grimes #define ISO_VD_END 255
57df8bae1dSRodney W. Grimes 
58df8bae1dSRodney W. Grimes #define ISO_STANDARD_ID "CD001"
59df8bae1dSRodney W. Grimes #define ISO_ECMA_ID	"CDW01"
60df8bae1dSRodney W. Grimes 
61988fa8efSJoerg Wunsch #define ISO_SIERRA_ID	"CDROM"
62988fa8efSJoerg Wunsch 
63df8bae1dSRodney W. Grimes struct iso_primary_descriptor {
64527d337fSToomas Soome 	u_char type			[ISODCL (  1,	1)]; /* 711 */
65df8bae1dSRodney W. Grimes 	char id				[ISODCL (  2,	6)];
66df8bae1dSRodney W. Grimes 	char version			[ISODCL (  7,	7)]; /* 711 */
67df8bae1dSRodney W. Grimes 	char unused1			[ISODCL (  8,	8)];
68df8bae1dSRodney W. Grimes 	char system_id			[ISODCL (  9,  40)]; /* achars */
69df8bae1dSRodney W. Grimes 	char volume_id			[ISODCL ( 41,  72)]; /* dchars */
70df8bae1dSRodney W. Grimes 	char unused2			[ISODCL ( 73,  80)];
71df8bae1dSRodney W. Grimes 	char volume_space_size		[ISODCL ( 81,  88)]; /* 733 */
72df8bae1dSRodney W. Grimes 	char unused3			[ISODCL ( 89, 120)];
73df8bae1dSRodney W. Grimes 	char volume_set_size		[ISODCL (121, 124)]; /* 723 */
74df8bae1dSRodney W. Grimes 	char volume_sequence_number	[ISODCL (125, 128)]; /* 723 */
75527d337fSToomas Soome 	u_char logical_block_size	[ISODCL (129, 132)]; /* 723 */
76df8bae1dSRodney W. Grimes 	char path_table_size		[ISODCL (133, 140)]; /* 733 */
77df8bae1dSRodney W. Grimes 	char type_l_path_table		[ISODCL (141, 144)]; /* 731 */
78df8bae1dSRodney W. Grimes 	char opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */
79df8bae1dSRodney W. Grimes 	char type_m_path_table		[ISODCL (149, 152)]; /* 732 */
80df8bae1dSRodney W. Grimes 	char opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */
81df8bae1dSRodney W. Grimes 	char root_directory_record	[ISODCL (157, 190)]; /* 9.1 */
82df8bae1dSRodney W. Grimes 	char volume_set_id		[ISODCL (191, 318)]; /* dchars */
83df8bae1dSRodney W. Grimes 	char publisher_id		[ISODCL (319, 446)]; /* achars */
84df8bae1dSRodney W. Grimes 	char preparer_id		[ISODCL (447, 574)]; /* achars */
85df8bae1dSRodney W. Grimes 	char application_id		[ISODCL (575, 702)]; /* achars */
86df8bae1dSRodney W. Grimes 	char copyright_file_id		[ISODCL (703, 739)]; /* 7.5 dchars */
87df8bae1dSRodney W. Grimes 	char abstract_file_id		[ISODCL (740, 776)]; /* 7.5 dchars */
88df8bae1dSRodney W. Grimes 	char bibliographic_file_id	[ISODCL (777, 813)]; /* 7.5 dchars */
89df8bae1dSRodney W. Grimes 	char creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */
90df8bae1dSRodney W. Grimes 	char modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */
91df8bae1dSRodney W. Grimes 	char expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */
92df8bae1dSRodney W. Grimes 	char effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */
93df8bae1dSRodney W. Grimes 	char file_structure_version	[ISODCL (882, 882)]; /* 711 */
94df8bae1dSRodney W. Grimes 	char unused4			[ISODCL (883, 883)];
95df8bae1dSRodney W. Grimes 	char application_data		[ISODCL (884, 1395)];
96df8bae1dSRodney W. Grimes 	char unused5			[ISODCL (1396, 2048)];
97527d337fSToomas Soome } __packed;
987acb51f6SBenno Rice #define ISO_DEFAULT_BLOCK_SHIFT		11
997acb51f6SBenno Rice #define ISO_DEFAULT_BLOCK_SIZE		(1 << ISO_DEFAULT_BLOCK_SHIFT)
100df8bae1dSRodney W. Grimes 
10144e568e2SDaniel C. Sobral /*
10244e568e2SDaniel C. Sobral  * Used by Microsoft Joliet extension to ISO9660. Almost the same
10344e568e2SDaniel C. Sobral  * as PVD, but byte position 8 is a flag, and 89-120 is for escape.
10444e568e2SDaniel C. Sobral  */
10544e568e2SDaniel C. Sobral 
10644e568e2SDaniel C. Sobral struct iso_supplementary_descriptor {
10744e568e2SDaniel C. Sobral       char type                       [ISODCL (  1,   1)]; /* 711 */
10844e568e2SDaniel C. Sobral       char id                         [ISODCL (  2,   6)];
10944e568e2SDaniel C. Sobral       char version                    [ISODCL (  7,   7)]; /* 711 */
11044e568e2SDaniel C. Sobral       char flags                      [ISODCL (  8,   8)]; /* 711? */
11144e568e2SDaniel C. Sobral       char system_id                  [ISODCL (  9,  40)]; /* achars */
11244e568e2SDaniel C. Sobral       char volume_id                  [ISODCL ( 41,  72)]; /* dchars */
11344e568e2SDaniel C. Sobral       char unused2                    [ISODCL ( 73,  80)];
11444e568e2SDaniel C. Sobral       char volume_space_size          [ISODCL ( 81,  88)]; /* 733 */
11544e568e2SDaniel C. Sobral       char escape                     [ISODCL ( 89, 120)];
11644e568e2SDaniel C. Sobral       char volume_set_size            [ISODCL (121, 124)]; /* 723 */
11744e568e2SDaniel C. Sobral       char volume_sequence_number     [ISODCL (125, 128)]; /* 723 */
118527d337fSToomas Soome       u_char logical_block_size         [ISODCL (129, 132)]; /* 723 */
11944e568e2SDaniel C. Sobral       char path_table_size            [ISODCL (133, 140)]; /* 733 */
12044e568e2SDaniel C. Sobral       char type_l_path_table          [ISODCL (141, 144)]; /* 731 */
12144e568e2SDaniel C. Sobral       char opt_type_l_path_table      [ISODCL (145, 148)]; /* 731 */
12244e568e2SDaniel C. Sobral       char type_m_path_table          [ISODCL (149, 152)]; /* 732 */
12344e568e2SDaniel C. Sobral       char opt_type_m_path_table      [ISODCL (153, 156)]; /* 732 */
12444e568e2SDaniel C. Sobral       char root_directory_record      [ISODCL (157, 190)]; /* 9.1 */
12544e568e2SDaniel C. Sobral       char volume_set_id              [ISODCL (191, 318)]; /* dchars */
12644e568e2SDaniel C. Sobral       char publisher_id               [ISODCL (319, 446)]; /* achars */
12744e568e2SDaniel C. Sobral       char preparer_id                [ISODCL (447, 574)]; /* achars */
12844e568e2SDaniel C. Sobral       char application_id             [ISODCL (575, 702)]; /* achars */
12944e568e2SDaniel C. Sobral       char copyright_file_id          [ISODCL (703, 739)]; /* 7.5 dchars */
13044e568e2SDaniel C. Sobral       char abstract_file_id           [ISODCL (740, 776)]; /* 7.5 dchars */
13144e568e2SDaniel C. Sobral       char bibliographic_file_id      [ISODCL (777, 813)]; /* 7.5 dchars */
13244e568e2SDaniel C. Sobral       char creation_date              [ISODCL (814, 830)]; /* 8.4.26.1 */
13344e568e2SDaniel C. Sobral       char modification_date          [ISODCL (831, 847)]; /* 8.4.26.1 */
13444e568e2SDaniel C. Sobral       char expiration_date            [ISODCL (848, 864)]; /* 8.4.26.1 */
13544e568e2SDaniel C. Sobral       char effective_date             [ISODCL (865, 881)]; /* 8.4.26.1 */
13644e568e2SDaniel C. Sobral       char file_structure_version     [ISODCL (882, 882)]; /* 711 */
13744e568e2SDaniel C. Sobral       char unused4                    [ISODCL (883, 883)];
13844e568e2SDaniel C. Sobral       char application_data           [ISODCL (884, 1395)];
13944e568e2SDaniel C. Sobral       char unused5                    [ISODCL (1396, 2048)];
14044e568e2SDaniel C. Sobral };
14144e568e2SDaniel C. Sobral 
142988fa8efSJoerg Wunsch struct iso_sierra_primary_descriptor {
143988fa8efSJoerg Wunsch 	char unknown1			[ISODCL (  1,	8)]; /* 733 */
144988fa8efSJoerg Wunsch 	char type			[ISODCL (  9,	9)]; /* 711 */
145988fa8efSJoerg Wunsch 	char id				[ISODCL ( 10,  14)];
146988fa8efSJoerg Wunsch 	char version			[ISODCL ( 15,  15)]; /* 711 */
147988fa8efSJoerg Wunsch 	char unused1			[ISODCL ( 16,  16)];
148988fa8efSJoerg Wunsch 	char system_id			[ISODCL ( 17,  48)]; /* achars */
149988fa8efSJoerg Wunsch 	char volume_id			[ISODCL ( 49,  80)]; /* dchars */
150988fa8efSJoerg Wunsch 	char unused2			[ISODCL ( 81,  88)];
151988fa8efSJoerg Wunsch 	char volume_space_size		[ISODCL ( 89,  96)]; /* 733 */
152988fa8efSJoerg Wunsch 	char unused3			[ISODCL ( 97, 128)];
153988fa8efSJoerg Wunsch 	char volume_set_size		[ISODCL (129, 132)]; /* 723 */
154988fa8efSJoerg Wunsch 	char volume_sequence_number	[ISODCL (133, 136)]; /* 723 */
155527d337fSToomas Soome 	u_char logical_block_size	[ISODCL (137, 140)]; /* 723 */
156988fa8efSJoerg Wunsch 	char path_table_size		[ISODCL (141, 148)]; /* 733 */
157988fa8efSJoerg Wunsch 	char type_l_path_table		[ISODCL (149, 152)]; /* 731 */
158988fa8efSJoerg Wunsch 	char opt_type_l_path_table	[ISODCL (153, 156)]; /* 731 */
159988fa8efSJoerg Wunsch 	char unknown2			[ISODCL (157, 160)]; /* 731 */
160988fa8efSJoerg Wunsch 	char unknown3			[ISODCL (161, 164)]; /* 731 */
161988fa8efSJoerg Wunsch 	char type_m_path_table		[ISODCL (165, 168)]; /* 732 */
162988fa8efSJoerg Wunsch 	char opt_type_m_path_table	[ISODCL (169, 172)]; /* 732 */
163988fa8efSJoerg Wunsch 	char unknown4			[ISODCL (173, 176)]; /* 732 */
164988fa8efSJoerg Wunsch 	char unknown5			[ISODCL (177, 180)]; /* 732 */
165988fa8efSJoerg Wunsch 	char root_directory_record	[ISODCL (181, 214)]; /* 9.1 */
166988fa8efSJoerg Wunsch 	char volume_set_id		[ISODCL (215, 342)]; /* dchars */
167988fa8efSJoerg Wunsch 	char publisher_id		[ISODCL (343, 470)]; /* achars */
168988fa8efSJoerg Wunsch 	char preparer_id		[ISODCL (471, 598)]; /* achars */
169988fa8efSJoerg Wunsch 	char application_id		[ISODCL (599, 726)]; /* achars */
170988fa8efSJoerg Wunsch 	char copyright_id		[ISODCL (727, 790)]; /* achars */
171988fa8efSJoerg Wunsch 	char creation_date		[ISODCL (791, 806)]; /* ? */
172988fa8efSJoerg Wunsch 	char modification_date		[ISODCL (807, 822)]; /* ? */
173988fa8efSJoerg Wunsch 	char expiration_date		[ISODCL (823, 838)]; /* ? */
174988fa8efSJoerg Wunsch 	char effective_date		[ISODCL (839, 854)]; /* ? */
175988fa8efSJoerg Wunsch 	char file_structure_version	[ISODCL (855, 855)]; /* 711 */
176988fa8efSJoerg Wunsch 	char unused4			[ISODCL (856, 2048)];
177988fa8efSJoerg Wunsch };
178988fa8efSJoerg Wunsch 
179df8bae1dSRodney W. Grimes struct iso_directory_record {
180527d337fSToomas Soome 	u_char length			[ISODCL (1, 1)]; /* 711 */
181527d337fSToomas Soome 	u_char ext_attr_length		[ISODCL (2, 2)]; /* 711 */
182996c772fSJohn Dyson 	u_char extent			[ISODCL (3, 10)]; /* 733 */
183996c772fSJohn Dyson 	u_char size			[ISODCL (11, 18)]; /* 733 */
184527d337fSToomas Soome 	u_char date			[ISODCL (19, 25)]; /* 7 by 711 */
185527d337fSToomas Soome 	u_char flags			[ISODCL (26, 26)];
186527d337fSToomas Soome 	u_char file_unit_size		[ISODCL (27, 27)]; /* 711 */
187527d337fSToomas Soome 	u_char interleave		[ISODCL (28, 28)]; /* 711 */
188527d337fSToomas Soome 	u_char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */
189527d337fSToomas Soome 	u_char name_len			[ISODCL (33, 33)]; /* 711 */
190996c772fSJohn Dyson 	char name			[1];			/* XXX */
191527d337fSToomas Soome } __packed;
192df8bae1dSRodney W. Grimes /* can't take sizeof(iso_directory_record), because of possible alignment
193df8bae1dSRodney W. Grimes    of the last entry (34 instead of 33) */
194df8bae1dSRodney W. Grimes #define ISO_DIRECTORY_RECORD_SIZE	33
195df8bae1dSRodney W. Grimes 
196df8bae1dSRodney W. Grimes struct iso_extended_attributes {
197996c772fSJohn Dyson 	u_char owner			[ISODCL (1, 4)]; /* 723 */
198996c772fSJohn Dyson 	u_char group			[ISODCL (5, 8)]; /* 723 */
199996c772fSJohn Dyson 	u_char perm			[ISODCL (9, 10)]; /* 9.5.3 */
200df8bae1dSRodney W. Grimes 	char ctime			[ISODCL (11, 27)]; /* 8.4.26.1 */
201df8bae1dSRodney W. Grimes 	char mtime			[ISODCL (28, 44)]; /* 8.4.26.1 */
202df8bae1dSRodney W. Grimes 	char xtime			[ISODCL (45, 61)]; /* 8.4.26.1 */
203df8bae1dSRodney W. Grimes 	char ftime			[ISODCL (62, 78)]; /* 8.4.26.1 */
204df8bae1dSRodney W. Grimes 	char recfmt			[ISODCL (79, 79)]; /* 711 */
205df8bae1dSRodney W. Grimes 	char recattr			[ISODCL (80, 80)]; /* 711 */
206996c772fSJohn Dyson 	u_char reclen			[ISODCL (81, 84)]; /* 723 */
207df8bae1dSRodney W. Grimes 	char system_id			[ISODCL (85, 116)]; /* achars */
208df8bae1dSRodney W. Grimes 	char system_use			[ISODCL (117, 180)];
209df8bae1dSRodney W. Grimes 	char version			[ISODCL (181, 181)]; /* 711 */
210df8bae1dSRodney W. Grimes 	char len_esc			[ISODCL (182, 182)]; /* 711 */
211df8bae1dSRodney W. Grimes 	char reserved			[ISODCL (183, 246)];
212996c772fSJohn Dyson 	u_char len_au			[ISODCL (247, 250)]; /* 723 */
213df8bae1dSRodney W. Grimes };
214df8bae1dSRodney W. Grimes 
215*68c3cec9SJessica Clarke #if defined(_KERNEL) || defined(_WANT_ISO_MNT)
21608ed607aSJoerg Wunsch 
217df8bae1dSRodney W. Grimes /* CD-ROM Format type */
218988fa8efSJoerg Wunsch enum ISO_FTYPE	{ ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
21944e568e2SDaniel C. Sobral 		  ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };
220df8bae1dSRodney W. Grimes 
221df8bae1dSRodney W. Grimes struct iso_mnt {
2226beb3bb4SKirk McKusick 	uint64_t im_flags;
223df8bae1dSRodney W. Grimes 
224df8bae1dSRodney W. Grimes 	struct mount *im_mountp;
22589c9c53dSPoul-Henning Kamp 	struct cdev *im_dev;
226df8bae1dSRodney W. Grimes 	struct vnode *im_devvp;
227df8bae1dSRodney W. Grimes 
228bf7e2ae1SPoul-Henning Kamp 	struct g_consumer *im_cp;
229bf7e2ae1SPoul-Henning Kamp 	struct bufobj *im_bo;
230bf7e2ae1SPoul-Henning Kamp 
23182f2275bSRicardo Branco 	uid_t	im_uid;
23282f2275bSRicardo Branco 	gid_t	im_gid;
23382f2275bSRicardo Branco 	mode_t	im_fmask;
23482f2275bSRicardo Branco 	mode_t	im_dmask;
23582f2275bSRicardo Branco 
236df8bae1dSRodney W. Grimes 	int logical_block_size;
237df8bae1dSRodney W. Grimes 	int im_bshift;
238df8bae1dSRodney W. Grimes 	int im_bmask;
239df8bae1dSRodney W. Grimes 
240df8bae1dSRodney W. Grimes 	int volume_space_size;
241df8bae1dSRodney W. Grimes 
242df8bae1dSRodney W. Grimes 	char root[ISODCL (157, 190)];
243df8bae1dSRodney W. Grimes 	int root_extent;
244df8bae1dSRodney W. Grimes 	int root_size;
245df8bae1dSRodney W. Grimes 	enum ISO_FTYPE	iso_ftype;
246df8bae1dSRodney W. Grimes 
247df8bae1dSRodney W. Grimes 	int rr_skip;
248df8bae1dSRodney W. Grimes 	int rr_skip0;
24944e568e2SDaniel C. Sobral 
25044e568e2SDaniel C. Sobral 	int joliet_level;
251c4f02a89SMax Khon 
252c4f02a89SMax Khon 	void *im_d2l;
253c4f02a89SMax Khon 	void *im_l2d;
254df8bae1dSRodney W. Grimes };
255df8bae1dSRodney W. Grimes 
256*68c3cec9SJessica Clarke #endif /* defined(_KERNEL) || defined(_WANT_ISO_MNT) */
257*68c3cec9SJessica Clarke 
258*68c3cec9SJessica Clarke #ifdef _KERNEL
259*68c3cec9SJessica Clarke 
26010bcafe9SPawel Jakub Dawidek struct ifid {
26110bcafe9SPawel Jakub Dawidek 	u_short		ifid_len;
26210bcafe9SPawel Jakub Dawidek 	u_short		ifid_pad;
26396e69c8eSMark Johnston 	ino_t		ifid_ino;
26410bcafe9SPawel Jakub Dawidek 	long		ifid_start;
265205659c4SMark Johnston } __packed;
26610bcafe9SPawel Jakub Dawidek 
267df8bae1dSRodney W. Grimes #define VFSTOISOFS(mp)	((struct iso_mnt *)((mp)->mnt_data))
268df8bae1dSRodney W. Grimes 
269996c772fSJohn Dyson #define blkoff(imp, loc)	((loc) & (imp)->im_bmask)
270996c772fSJohn Dyson #define lblktosize(imp, blk)	((blk) << (imp)->im_bshift)
271996c772fSJohn Dyson #define lblkno(imp, loc)	((loc) >> (imp)->im_bshift)
272996c772fSJohn Dyson #define blksize(imp, ip, lbn)	((imp)->logical_block_size)
273df8bae1dSRodney W. Grimes 
27496e69c8eSMark Johnston int cd9660_vget_internal(struct mount *, ino_t	, int, struct vnode **, int,
27589c9a483SAlfred Perlstein 			 struct iso_directory_record *);
27689c9a483SAlfred Perlstein #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \
27789c9a483SAlfred Perlstein 				size_t, struct proc *))eopnotsupp)
278996c772fSJohn Dyson 
279aec0fb7bSPoul-Henning Kamp extern struct vop_vector cd9660_vnodeops;
280aec0fb7bSPoul-Henning Kamp extern struct vop_vector cd9660_fifoops;
281df8bae1dSRodney W. Grimes 
282c4f02a89SMax Khon int isochar(u_char *, u_char *, int, u_short *, int *, int, void *);
283c4f02a89SMax Khon int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *);
284c4f02a89SMax Khon void isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *);
28596e69c8eSMark Johnston ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
286c4f02a89SMax Khon u_short sgetrune(const char *, size_t, char const **, int, void *);
28708ed607aSJoerg Wunsch 
288c4473420SPeter Wemm #endif /* _KERNEL */
28908ed607aSJoerg Wunsch 
29008ed607aSJoerg Wunsch /*
29108ed607aSJoerg Wunsch  * The isonum_xxx functions are inlined anyway, and could come handy even
29208ed607aSJoerg Wunsch  * outside the kernel.  Thus we don't hide them here.
29308ed607aSJoerg Wunsch  */
29408ed607aSJoerg Wunsch 
295a92fef8aSDag-Erling Smørgrav /*
296a92fef8aSDag-Erling Smørgrav  * 7xy
297a92fef8aSDag-Erling Smørgrav  *  x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits
298a92fef8aSDag-Erling Smørgrav  *   y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)
299a92fef8aSDag-Erling Smørgrav  */
300a92fef8aSDag-Erling Smørgrav 
301a92fef8aSDag-Erling Smørgrav static __inline uint8_t
isonum_711(const unsigned char * p)302cd67748bSMarius Strobl isonum_711(const unsigned char *p)
303df8bae1dSRodney W. Grimes {
304cd67748bSMarius Strobl 
305cd67748bSMarius Strobl 	return (p[0]);
306cd67748bSMarius Strobl }
307cd67748bSMarius Strobl 
308cd67748bSMarius Strobl static __inline int8_t
isonum_712(const unsigned char * p)309cd67748bSMarius Strobl isonum_712(const unsigned char *p)
310cd67748bSMarius Strobl {
311cd67748bSMarius Strobl 
312cd67748bSMarius Strobl 	return ((signed char)p[0]);
313df8bae1dSRodney W. Grimes }
314df8bae1dSRodney W. Grimes 
315a92fef8aSDag-Erling Smørgrav static __inline uint8_t
isonum_713(const unsigned char * p)316cd67748bSMarius Strobl isonum_713(const unsigned char *p)
317df8bae1dSRodney W. Grimes {
318df8bae1dSRodney W. Grimes 
319cd67748bSMarius Strobl 	return (p[0]);
320df8bae1dSRodney W. Grimes }
321df8bae1dSRodney W. Grimes 
322a92fef8aSDag-Erling Smørgrav static __inline uint16_t
isonum_721(const unsigned char * p)323cd67748bSMarius Strobl isonum_721(const unsigned char *p)
324df8bae1dSRodney W. Grimes {
325cd67748bSMarius Strobl 
326a92fef8aSDag-Erling Smørgrav 	return (p[0] | p[1] << 8);
327df8bae1dSRodney W. Grimes }
328df8bae1dSRodney W. Grimes 
329a92fef8aSDag-Erling Smørgrav static __inline uint16_t
isonum_722(const unsigned char * p)330cd67748bSMarius Strobl isonum_722(const unsigned char *p)
331df8bae1dSRodney W. Grimes {
332cd67748bSMarius Strobl 
333a92fef8aSDag-Erling Smørgrav 	return (p[1] | p[0] << 8);
334df8bae1dSRodney W. Grimes }
335df8bae1dSRodney W. Grimes 
336a92fef8aSDag-Erling Smørgrav static __inline uint16_t
isonum_723(const unsigned char * p)337cd67748bSMarius Strobl isonum_723(const unsigned char *p)
338df8bae1dSRodney W. Grimes {
339cd67748bSMarius Strobl 
340a92fef8aSDag-Erling Smørgrav 	return (p[0] | p[1] << 8);
341df8bae1dSRodney W. Grimes }
342df8bae1dSRodney W. Grimes 
343a92fef8aSDag-Erling Smørgrav static __inline uint32_t
isonum_731(const unsigned char * p)344cd67748bSMarius Strobl isonum_731(const unsigned char *p)
345996c772fSJohn Dyson {
346cd67748bSMarius Strobl 
347a92fef8aSDag-Erling Smørgrav 	return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
348996c772fSJohn Dyson }
349996c772fSJohn Dyson 
350a92fef8aSDag-Erling Smørgrav static __inline uint32_t
isonum_732(const unsigned char * p)351cd67748bSMarius Strobl isonum_732(const unsigned char *p)
352996c772fSJohn Dyson {
353cd67748bSMarius Strobl 
354a92fef8aSDag-Erling Smørgrav 	return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);
355996c772fSJohn Dyson }
356996c772fSJohn Dyson 
357a92fef8aSDag-Erling Smørgrav static __inline uint32_t
isonum_733(const unsigned char * p)358cd67748bSMarius Strobl isonum_733(const unsigned char *p)
359a92fef8aSDag-Erling Smørgrav {
360cd67748bSMarius Strobl 
361a92fef8aSDag-Erling Smørgrav 	return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
362a92fef8aSDag-Erling Smørgrav }
363996c772fSJohn Dyson 
364df8bae1dSRodney W. Grimes /*
365df8bae1dSRodney W. Grimes  * Associated files have a leading '='.
366df8bae1dSRodney W. Grimes  */
367df8bae1dSRodney W. Grimes #define	ASSOCCHAR	'='
368d33cdf16SEd Maste 
369d33cdf16SEd Maste #endif /* _ISOFS_CD9660_ISO_H_ */
370