xref: /onnv-gate/usr/src/cmd/fs.d/hsfs/labelit/iso_spec.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate /*
29*0Sstevel@tonic-gate  * ISO 9660 filesystem specification
30*0Sstevel@tonic-gate  */
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifndef	_ISO_SPEC_H_
33*0Sstevel@tonic-gate #define	_ISO_SPEC_H_
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #include <sys/isa_defs.h>
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate /* routines required for date parsing */
38*0Sstevel@tonic-gate extern struct timeval	iso_parse_dirdate();	/* parse date in directory */
39*0Sstevel@tonic-gate extern struct timeval	iso__parse_longdate();	/* parse date in volume id */
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate /* macros to parse binary integers */
42*0Sstevel@tonic-gate #define ZERO(x)         (u_int) (((u_char *)(x))[0])
43*0Sstevel@tonic-gate #define ONE(x)          (u_int) (((u_char *)(x))[1])
44*0Sstevel@tonic-gate #define TWO(x)          (u_int) (((u_char *)(x))[2])
45*0Sstevel@tonic-gate #define THREE(x)        (u_int) (((u_char *)(x))[3])
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #define MSB_INT(x) \
48*0Sstevel@tonic-gate         ((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x))
49*0Sstevel@tonic-gate #define LSB_INT(x) \
50*0Sstevel@tonic-gate         ((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x))
51*0Sstevel@tonic-gate #define MSB_SHORT(x)    ((ZERO(x) << 8) | ONE(x))
52*0Sstevel@tonic-gate #define LSB_SHORT(x)    ((ONE(x) << 8) | ZERO(x))
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate #if defined(sparc)
55*0Sstevel@tonic-gate /*
56*0Sstevel@tonic-gate  * Sparc machines requires that integer must
57*0Sstevel@tonic-gate  * be in a full word boundary.	CD-ROM data aligns
58*0Sstevel@tonic-gate  * to even word boundary only.	Because of this mismatch,
59*0Sstevel@tonic-gate  * we have to move integer data from CD-ROM to memory one
60*0Sstevel@tonic-gate  * byte at a time.  LSB data starts first. We therefore
61*0Sstevel@tonic-gate  * use this to do byte by byte copying.
62*0Sstevel@tonic-gate  */
63*0Sstevel@tonic-gate #define BOTH_SHORT(x)   LSB_SHORT(x)
64*0Sstevel@tonic-gate #define BOTH_INT(x)     LSB_INT(x)
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate #elif defined(_LITTLE_ENDIAN)
67*0Sstevel@tonic-gate #define BOTH_SHORT(x)   (short) *((short *)x)
68*0Sstevel@tonic-gate #define BOTH_INT(x)     (int) *((int *)x)
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate #elif defined(_BIG_ENDIAN)
71*0Sstevel@tonic-gate #define BOTH_SHORT(x)   (short) *((short *)x + 1)
72*0Sstevel@tonic-gate #define BOTH_INT(x)     (int) *((int *)x + 1)
73*0Sstevel@tonic-gate #else
74*0Sstevel@tonic-gate #error One of _BIG_ENDIAN and _LITTLE_ENDIAN must be defined
75*0Sstevel@tonic-gate #endif
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate /*
78*0Sstevel@tonic-gate  * conversions to/from little endian format
79*0Sstevel@tonic-gate  */
80*0Sstevel@tonic-gate #if defined(_LITTLE_ENDIAN)
81*0Sstevel@tonic-gate /* little endian machines */
82*0Sstevel@tonic-gate #define ltohs(S)                (S)
83*0Sstevel@tonic-gate #define ltohl(L)                (L)
84*0Sstevel@tonic-gate #define htols(S)                (S)
85*0Sstevel@tonic-gate #define htoll(L)                (L)
86*0Sstevel@tonic-gate #else
87*0Sstevel@tonic-gate /* big endian machines */
88*0Sstevel@tonic-gate #define ltohs(S)        LSB_SHORT((char *) (S))
89*0Sstevel@tonic-gate #define ltohl(L)        LSB_INT((char *) (L))
90*0Sstevel@tonic-gate #define htols(S)        LSB_SHORT((char *) (S))
91*0Sstevel@tonic-gate #define htoll(L)        LSB_INT((char *) (L))
92*0Sstevel@tonic-gate #endif
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate /*
95*0Sstevel@tonic-gate  * The following describes actual on-disk structures.
96*0Sstevel@tonic-gate  * To achieve portability, all structures are #defines
97*0Sstevel@tonic-gate  * rather than a structure definition.  Macros are provided
98*0Sstevel@tonic-gate  * to get either the data or address of individual fields.
99*0Sstevel@tonic-gate  */
100*0Sstevel@tonic-gate 
101*0Sstevel@tonic-gate /* Overall High Sierra disk structure */
102*0Sstevel@tonic-gate #define ISO_SECTOR_SIZE	2048		/* bytes per logical sector */
103*0Sstevel@tonic-gate #define ISO_SECTOR_SHIFT	11		/* sector<->byte shift count */
104*0Sstevel@tonic-gate #define ISO_SEC_PER_PAGE	(PAGESIZE/HS_SECTOR_SIZE)	/* sectors per page */
105*0Sstevel@tonic-gate #define ISO_SYSAREA_SEC	0		/* 1st sector of system area */
106*0Sstevel@tonic-gate #define ISO_VOLDESC_SEC	16		/* 1st sector of volume descriptors */
107*0Sstevel@tonic-gate #define MAXISOOFFSET (ISO_SECTOR_SIZE - 1)
108*0Sstevel@tonic-gate #define MAXISOMASK   (~MAXISOOFFSET)
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate /* Standard File Structure Volume Descriptor */
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate enum iso_voldesc_type {
114*0Sstevel@tonic-gate 	ISO_VD_BOOT=0, ISO_VD_PVD=1, ISO_VD_SVD=2, ISO_VD_VPD=3,
115*0Sstevel@tonic-gate 	ISO_VD_UNIX=4, /* UNIX extension */
116*0Sstevel@tonic-gate 	ISO_VD_EOV=255
117*0Sstevel@tonic-gate };
118*0Sstevel@tonic-gate #define ISO_ID_STRING	"CD001"		/* ISO_std_id field */
119*0Sstevel@tonic-gate #define ISO_ID_STRLEN	5		/* ISO_std_id field length */
120*0Sstevel@tonic-gate #define ISO_ID_VER	1		/* ISO_std_ver field */
121*0Sstevel@tonic-gate #define ISO_FILE_STRUCT_ID_VER	1	/* ISO_file structure version  field */
122*0Sstevel@tonic-gate #define ISO_DATE_TO_UNIX(x)	iso_parse_longdate(x)	/* returns a timeval */
123*0Sstevel@tonic-gate #define ISO_SYS_ID_STRLEN	32
124*0Sstevel@tonic-gate #define ISO_VOL_ID_STRLEN	32
125*0Sstevel@tonic-gate #define ISO_VOL_SET_ID_STRLEN	128
126*0Sstevel@tonic-gate #define ISO_PUB_ID_STRLEN	128
127*0Sstevel@tonic-gate #define ISO_PREP_ID_STRLEN	128
128*0Sstevel@tonic-gate #define ISO_APPL_ID_STRLEN	128
129*0Sstevel@tonic-gate #define ISO_COPYR_ID_STRLEN	37
130*0Sstevel@tonic-gate #define ISO_ABSTR_ID_STRLEN	37
131*0Sstevel@tonic-gate #define ISO_DATE_LEN		17
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate 
134*0Sstevel@tonic-gate 
135*0Sstevel@tonic-gate /* macros to get the address of each field */
136*0Sstevel@tonic-gate #define ISO_desc_type(x)	(&((u_char *)x)[0])
137*0Sstevel@tonic-gate #define ISO_std_id(x)		(&((u_char *)x)[1])
138*0Sstevel@tonic-gate #define ISO_std_ver(x)		(&((u_char *)x)[6])
139*0Sstevel@tonic-gate #define ISO_sys_id(x)		(&((u_char *)x)[8])
140*0Sstevel@tonic-gate #define ISO_vol_id(x)		(&((u_char *)x)[40])
141*0Sstevel@tonic-gate #define ISO_vol_size(x)		(&((u_char *)x)[80])
142*0Sstevel@tonic-gate #define ISO_set_size(x)		(&((u_char *)x)[120])
143*0Sstevel@tonic-gate #define ISO_set_seq(x)		(&((u_char *)x)[124])
144*0Sstevel@tonic-gate #define ISO_blk_size(x)		(&((u_char *)x)[128])
145*0Sstevel@tonic-gate #define ISO_ptbl_size(x)	(&((u_char *)x)[132])
146*0Sstevel@tonic-gate #define ISO_ptbl_man_ls(x)	(&((u_char *)x)[140])
147*0Sstevel@tonic-gate #define ISO_ptbl_opt_ls1(x)	(&((u_char *)x)[144])
148*0Sstevel@tonic-gate #define ISO_ptbl_man_ms(x)	(&((u_char *)x)[148])
149*0Sstevel@tonic-gate #define ISO_ptbl_opt_ms1(x)	(&((u_char *)x)[152])
150*0Sstevel@tonic-gate #define ISO_root_dir(x)		(&((u_char *)x)[156])
151*0Sstevel@tonic-gate #define ISO_vol_set_id(x)	(&((u_char *)x)[190])
152*0Sstevel@tonic-gate #define ISO_pub_id(x)		(&((u_char *)x)[318])
153*0Sstevel@tonic-gate #define ISO_prep_id(x)		(&((u_char *)x)[446])
154*0Sstevel@tonic-gate #define ISO_appl_id(x)		(&((u_char *)x)[574])
155*0Sstevel@tonic-gate #define ISO_copyr_id(x)		(&((u_char *)x)[702])
156*0Sstevel@tonic-gate #define ISO_abstr_id(x)		(&((u_char *)x)[739])
157*0Sstevel@tonic-gate #define ISO_bibli_id(x)		(&((u_char *)x)[776])
158*0Sstevel@tonic-gate #define ISO_cre_date(x)		(&((u_char *)x)[813])
159*0Sstevel@tonic-gate #define ISO_mod_date(x)		(&((u_char *)x)[830])
160*0Sstevel@tonic-gate #define ISO_exp_date(x)		(&((u_char *)x)[847])
161*0Sstevel@tonic-gate #define ISO_eff_date(x)		(&((u_char *)x)[864])
162*0Sstevel@tonic-gate #define ISO_file_struct_ver(x)	(&((u_char *)x)[881])
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate /* macros to get the values of each field (strings are returned as ptrs) */
165*0Sstevel@tonic-gate #define ISO_DESC_TYPE(x)	((enum hs_voldesc_type)*(ISO_desc_type(x)))
166*0Sstevel@tonic-gate #define ISO_STD_ID(x)		ISO_std_id(x)
167*0Sstevel@tonic-gate #define ISO_STD_VER(x)		*(ISO_std_ver(x))
168*0Sstevel@tonic-gate #define ISO_SYS_ID(x)		ISO_sys_id(x)
169*0Sstevel@tonic-gate #define ISO_VOL_ID(x)		ISO_vol_id(x)
170*0Sstevel@tonic-gate #define ISO_VOL_SIZE(x)		BOTH_INT(ISO_vol_size(x))
171*0Sstevel@tonic-gate #define ISO_SET_SIZE(x)		BOTH_SHORT(ISO_set_size(x))
172*0Sstevel@tonic-gate #define ISO_SET_SEQ(x)		BOTH_SHORT(ISO_set_seq(x))
173*0Sstevel@tonic-gate #define ISO_BLK_SIZE(x)		BOTH_SHORT(ISO_blk_size(x))
174*0Sstevel@tonic-gate #define ISO_PTBL_SIZE(x)	BOTH_INT(ISO_ptbl_size(x))
175*0Sstevel@tonic-gate #define ISO_PTBL_MAN_LS(x)	LSB_INT(ISO_ptbl_man_ls(x))
176*0Sstevel@tonic-gate #define ISO_PTBL_OPT_LS1(x)	LSB_INT(ISO_ptbl_opt_ls1(x))
177*0Sstevel@tonic-gate #define ISO_PTBL_MAN_MS(x)	MSB_INT(ISO_ptbl_man_ms(x))
178*0Sstevel@tonic-gate #define ISO_PTBL_OPT_MS1(x)	MSB_INT(ISO_ptbl_opt_ms1(x))
179*0Sstevel@tonic-gate #define ISO_ROOT_DIR(x)		ISO_root_dir(x)
180*0Sstevel@tonic-gate #define ISO_VOL_SET_ID(x)	ISO_vol_set_id(x)
181*0Sstevel@tonic-gate #define ISO_PUB_ID(x)		ISO_pub_id(x)
182*0Sstevel@tonic-gate #define ISO_PREP_ID(x)		ISO_prep_id(x)
183*0Sstevel@tonic-gate #define ISO_APPL_ID(x)		ISO_appl_id(x)
184*0Sstevel@tonic-gate #define ISO_COPYR_ID(x)		ISO_copyr_id(x)
185*0Sstevel@tonic-gate #define ISO_ABSTR_ID(x)		ISO_abstr_id(x)
186*0Sstevel@tonic-gate #define ISO_BIBLI_ID(x)		ISO_bibli_id(x)
187*0Sstevel@tonic-gate #define ISO_CRE_DATE(x)		ISO_DATE_TO_UNIX(HSV_cre_date(x))
188*0Sstevel@tonic-gate #define ISO_MOD_DATE(x)		ISO_DATE_TO_UNIX(HSV_mod_date(x))
189*0Sstevel@tonic-gate #define ISO_EXP_DATE(x)		ISO_DATE_TO_UNIX(HSV_exp_date(x))
190*0Sstevel@tonic-gate #define ISO_EFF_DATE(x)		ISO_DATE_TO_UNIX(HSV_eff_date(x))
191*0Sstevel@tonic-gate #define ISO_FILE_STRUCT_VER(x)	*(ISO_file_struct_ver(x))
192*0Sstevel@tonic-gate 
193*0Sstevel@tonic-gate /* Standard File Structure Volume Descriptor date fields */
194*0Sstevel@tonic-gate #define ISO_DATE_2DIG(x)	( (((x)[0] - '0') * 10) +		\
195*0Sstevel@tonic-gate 				   ((x)[1] - '0') )
196*0Sstevel@tonic-gate #define ISO_DATE_4DIG(x)	( (((x)[0] - '0') * 1000) +		\
197*0Sstevel@tonic-gate 				  (((x)[1] - '0') * 100) +		\
198*0Sstevel@tonic-gate 				  (((x)[2] - '0') * 10) +		\
199*0Sstevel@tonic-gate 				   ((x)[3] - '0') )
200*0Sstevel@tonic-gate #define ISO_DATE_YEAR(x)	ISO_DATE_4DIG(&((u_char *)x)[0])
201*0Sstevel@tonic-gate #define ISO_DATE_MONTH(x)	ISO_DATE_2DIG(&((u_char *)x)[4])
202*0Sstevel@tonic-gate #define ISO_DATE_DAY(x)		ISO_DATE_2DIG(&((u_char *)x)[6])
203*0Sstevel@tonic-gate #define ISO_DATE_HOUR(x)	ISO_DATE_2DIG(&((u_char *)x)[8])
204*0Sstevel@tonic-gate #define ISO_DATE_MIN(x)		ISO_DATE_2DIG(&((u_char *)x)[10])
205*0Sstevel@tonic-gate #define ISO_DATE_SEC(x)		ISO_DATE_2DIG(&((u_char *)x)[12])
206*0Sstevel@tonic-gate #define ISO_DATE_HSEC(x)	ISO_DATE_2DIG(&((u_char *)x)[14])
207*0Sstevel@tonic-gate 
208*0Sstevel@tonic-gate 
209*0Sstevel@tonic-gate 
210*0Sstevel@tonic-gate /* Directory Entry (Directory Record) */
211*0Sstevel@tonic-gate #define IDE_ROOT_DIR_REC_SIZE   34      /* size of root directory record */
212*0Sstevel@tonic-gate #define IDE_FDESIZE             33      /* fixed size for hsfs directory area */
213*0Sstevel@tonic-gate                                         /* max size of a name */
214*0Sstevel@tonic-gate #define IDE_MAX_NAME_LEN        (255 - IDE_FDESIZE)
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate 
217*0Sstevel@tonic-gate #define IDE_DATE_TO_UNIX(x)	iso_parse_dirdate(x)	/* returns a timeval */
218*0Sstevel@tonic-gate 
219*0Sstevel@tonic-gate /* macros to get the address of each field */
220*0Sstevel@tonic-gate #define IDE_dir_len(x)		(&((u_char *)x)[0])
221*0Sstevel@tonic-gate #define IDE_xar_len(x)		(&((u_char *)x)[1])
222*0Sstevel@tonic-gate #define IDE_ext_lbn(x)		(&((u_char *)x)[2])
223*0Sstevel@tonic-gate #define IDE_ext_size(x)		(&((u_char *)x)[10])
224*0Sstevel@tonic-gate #define IDE_cdate(x)		(&((u_char *)x)[18])
225*0Sstevel@tonic-gate #define IDE_flags(x)		(&((u_char *)x)[25])
226*0Sstevel@tonic-gate #define IDE_intrlv_size(x)	(&((u_char *)x)[26])
227*0Sstevel@tonic-gate #define IDE_intrlv_skip(x)	(&((u_char *)x)[27])
228*0Sstevel@tonic-gate #define IDE_vol_set(x)		(&((u_char *)x)[28])
229*0Sstevel@tonic-gate #define IDE_name_len(x)		(&((u_char *)x)[32])
230*0Sstevel@tonic-gate #define IDE_name(x)		(&((u_char *)x)[33])
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate /* macros to get the values of each field (strings are returned as ptrs) */
233*0Sstevel@tonic-gate #define IDE_DIR_LEN(x)		*(IDE_dir_len(x))
234*0Sstevel@tonic-gate #define IDE_XAR_LEN(x)		*(IDE_xar_len(x))
235*0Sstevel@tonic-gate #define IDE_EXT_LBN(x)		BOTH_INT(IDE_ext_lbn(x))
236*0Sstevel@tonic-gate #define IDE_EXT_SIZE(x)		BOTH_INT(IDE_ext_size(x))
237*0Sstevel@tonic-gate #define IDE_CDATE(x)		IDE_DATE_TO_UNIX(HDE_cdate(x))
238*0Sstevel@tonic-gate #define IDE_FLAGS(x)		*(IDE_flags(x))
239*0Sstevel@tonic-gate #define IDE_INTRLV_SIZE(x)	*(IDE_intrlv_size(x))
240*0Sstevel@tonic-gate #define IDE_INTRLV_SKIP(x)	*(IDE_intrlv_skip(x))
241*0Sstevel@tonic-gate #define IDE_VOL_SET(x)		BOTH_SHORT(IDE_vol_set(x))
242*0Sstevel@tonic-gate #define IDE_NAME_LEN(x)		*(IDE_name_len(x))
243*0Sstevel@tonic-gate #define IDE_NAME(x)		IDE_name(x)
244*0Sstevel@tonic-gate 
245*0Sstevel@tonic-gate /* mask bits for IDE_FLAGS */
246*0Sstevel@tonic-gate #define IDE_EXISTENCE		0x01	/* zero if file exists */
247*0Sstevel@tonic-gate #define IDE_DIRECTORY		0x02	/* zero if file is not a directory */
248*0Sstevel@tonic-gate #define IDE_ASSOCIATED		0x04	/* zero if file is not Associated */
249*0Sstevel@tonic-gate #define IDE_RECORD		0x08	/* zero if no record attributes */
250*0Sstevel@tonic-gate #define IDE_PROTECTION		0x10	/* zero if no protection attributes */
251*0Sstevel@tonic-gate #define IDE_UNUSED_FLAGS	0x60
252*0Sstevel@tonic-gate #define IDE_LAST_EXTENT		0x80	/* zero if last extent in file */
253*0Sstevel@tonic-gate #define IDE_PROHIBITED	(IDE_DIRECTORY | HDE_ASSOCIATED | HDE_RECORD | \
254*0Sstevel@tonic-gate 			 IDE_LAST_EXTENT | IDE_UNUSED_FLAGS)
255*0Sstevel@tonic-gate 
256*0Sstevel@tonic-gate /* Directory Record date fields */
257*0Sstevel@tonic-gate #define IDE_DATE_YEAR(x)	(((u_char *)x)[0] + 1900)
258*0Sstevel@tonic-gate #define IDE_DATE_MONTH(x)	(((u_char *)x)[1])
259*0Sstevel@tonic-gate #define IDE_DATE_DAY(x)		(((u_char *)x)[2])
260*0Sstevel@tonic-gate #define IDE_DATE_HOUR(x)	(((u_char *)x)[3])
261*0Sstevel@tonic-gate #define IDE_DATE_MIN(x)		(((u_char *)x)[4])
262*0Sstevel@tonic-gate #define IDE_DATE_SEC(x)		(((u_char *)x)[5])
263*0Sstevel@tonic-gate 
264*0Sstevel@tonic-gate /* tests for Interchange Levels 1 & 2 file types */
265*0Sstevel@tonic-gate #define IDE_REGULAR_FILE(x)	(((x) & IDE_PROHIBITED) == 0)
266*0Sstevel@tonic-gate #define IDE_REGULAR_DIR(x)	(((x) & IDE_PROHIBITED) == IDE_DIRECTORY)
267*0Sstevel@tonic-gate 
268*0Sstevel@tonic-gate #define ISO_DIR_NAMELEN		31	/* max length of a directory name */
269*0Sstevel@tonic-gate #define ISO_FILE_NAMELEN		31	/* max length of a filename */
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate /* Path table enry */
272*0Sstevel@tonic-gate /* fix size of path table entry */
273*0Sstevel@tonic-gate #define IPE_FPESIZE             8
274*0Sstevel@tonic-gate /* macros to get the address of each field */
275*0Sstevel@tonic-gate #define IPE_name_len(x)         (&((u_char *)x)[0])
276*0Sstevel@tonic-gate #define IPE_xar_len(x)          (&((u_char *)x)[1])
277*0Sstevel@tonic-gate #define IPE_ext_lbn(x)          (&((u_char *)x)[2])
278*0Sstevel@tonic-gate #define IPE_parent_no(x)        (&((u_char *)x)[6])
279*0Sstevel@tonic-gate #define IPE_name(x)             (&((u_char *)x)[8])
280*0Sstevel@tonic-gate 
281*0Sstevel@tonic-gate /* macros to get the values of each field */
282*0Sstevel@tonic-gate #define IPE_EXT_LBN(x)          (MSB_INT(IPE_ext_lbn(x)))
283*0Sstevel@tonic-gate #define IPE_XAR_LEN(x)          *(IPE_xar_len(x))
284*0Sstevel@tonic-gate #define IPE_NAME_LEN(x)         *(IPE_name_len(x))
285*0Sstevel@tonic-gate #define IPE_PARENT_NO(x)        *(short *)(IPE_parent_no(x))
286*0Sstevel@tonic-gate #define IPE_NAME(x)             IPE_name(x)
287*0Sstevel@tonic-gate 
288*0Sstevel@tonic-gate /* cdrom UNIX extension */
289*0Sstevel@tonic-gate /* UNIX Volume Descriptor */
290*0Sstevel@tonic-gate #define ISO_UNIX_ID_STRING	"UNIXCD01"	/* ISO_UNIX_std_id field */
291*0Sstevel@tonic-gate #define ISO_UNIX_ID_STRLEN	8		/* ISO_UNIX_std_id length */
292*0Sstevel@tonic-gate #define	ISO_UNIX_FEATURE_SYMLNK	0x01		/* CD-ROM supports symbolic links */
293*0Sstevel@tonic-gate #define	ISO_UNIX_FEATURE_LONGFN	0x02		/* CD-ROM supports long BSD file names */
294*0Sstevel@tonic-gate 
295*0Sstevel@tonic-gate #define ISO_UNIX_feature(x)	(&((u_char *)x)[7])
296*0Sstevel@tonic-gate #define ISO_UNIX_root_dir(x)	(&((u_char *)x)[1395])
297*0Sstevel@tonic-gate #define ISO_UNIX_signature(x)	(&((u_char *)x)[2040])
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate #define ISO_UNIX_FEATURE(x)	*(ISO_UNIX_feature(x))
300*0Sstevel@tonic-gate #define ISO_UNIX_ROOT_DIR(x)	ISO_UNIX_root_dir(x)
301*0Sstevel@tonic-gate #define ISO_UNIX_SIGNATURE(x)	ISO_UNIX_signature(x)
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate /* UNIX extension to path table entry */
304*0Sstevel@tonic-gate /* fix size of path table entry */
305*0Sstevel@tonic-gate #define IPE_UNIX_FPESIZE             20
306*0Sstevel@tonic-gate 
307*0Sstevel@tonic-gate #define IPE_UNIX_mode(x)        (&((u_char *)x)[0])
308*0Sstevel@tonic-gate #define IPE_UNIX_uid(x)         (&((u_char *)x)[4])
309*0Sstevel@tonic-gate #define IPE_UNIX_gid(x)         (&((u_char *)x)[8])
310*0Sstevel@tonic-gate 
311*0Sstevel@tonic-gate /* macros to get the values of each field */
312*0Sstevel@tonic-gate #define IPE_UNIX_MODE(x)        (MSB_INT(IPE_UNIX_mode(x)))
313*0Sstevel@tonic-gate #define IPE_UNIX_UID(x)         (MSB_INT(IPE_UNIX_uid(x)))
314*0Sstevel@tonic-gate #define IPE_UNIX_GID(x)         (MSB_INT(IPE_UNIX_gid(x)))
315*0Sstevel@tonic-gate 
316*0Sstevel@tonic-gate /* UNIX extension to directory entry */
317*0Sstevel@tonic-gate #define	IDE_UNIX_SIG_UX	"UX"		/* UNIX extension signature */
318*0Sstevel@tonic-gate #define	IDE_UNIX_SIG_TI	"TI"		/* UNIX extension signature for time */
319*0Sstevel@tonic-gate #define IDE_UNIX_USE_ID_VER 1           /* UNIX extension sys use id */
320*0Sstevel@tonic-gate #define IDE_UNIX_UX_LEN	36		/* length of UX */
321*0Sstevel@tonic-gate #define IDE_UNIX_TI_LEN	40		/* length of TI */
322*0Sstevel@tonic-gate 
323*0Sstevel@tonic-gate #define IDE_UNIX_signature(x)        (&((u_char *)x)[0])
324*0Sstevel@tonic-gate #define IDE_UNIX_ext_len(x)        (&((u_char *)x)[2])
325*0Sstevel@tonic-gate #define IDE_UNIX_use_id(x)        (&((u_char *)x)[3])
326*0Sstevel@tonic-gate #define IDE_UNIX_mode(x)        (&((u_char *)x)[4])
327*0Sstevel@tonic-gate #define IDE_UNIX_nlink(x)        (&((u_char *)x)[12])
328*0Sstevel@tonic-gate #define IDE_UNIX_uid(x)        (&((u_char *)x)[20])
329*0Sstevel@tonic-gate #define IDE_UNIX_gid(x)        (&((u_char *)x)[28])
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate 
332*0Sstevel@tonic-gate #define IDE_UNIX_cre_date(x)	(&((u_char *)x)[4])
333*0Sstevel@tonic-gate #define IDE_UNIX_mod_date(x)	(&((u_char *)x)[11])
334*0Sstevel@tonic-gate #define IDE_UNIX_exp_date(x)	(&((u_char *)x)[18])
335*0Sstevel@tonic-gate #define IDE_UNIX_eff_date(x)	(&((u_char *)x)[25])
336*0Sstevel@tonic-gate #define IDE_UNIX_acc_date(x)	(&((u_char *)x)[32])
337*0Sstevel@tonic-gate #define IDE_UNIX_reserved(x)	(&((u_char *)x)[39])
338*0Sstevel@tonic-gate 
339*0Sstevel@tonic-gate #define IDE_UNIX_SIGNATURE(x)	IDE_UNIX_signature(x)
340*0Sstevel@tonic-gate #define IDE_UNIX_EXT_LEN(x)	*(IDE_UNIX_ext_len(x))
341*0Sstevel@tonic-gate #define IDE_UNIX_USE_ID(x)	*(IDE_UNIX_use_id(x))
342*0Sstevel@tonic-gate #define IDE_UNIX_MODE(x)	BOTH_INT(IDE_UNIX_mode(x))
343*0Sstevel@tonic-gate #define IDE_UNIX_NLINK(x)	BOTH_INT(IDE_UNIX_nlink(x))
344*0Sstevel@tonic-gate #define IDE_UNIX_UID(x)		BOTH_INT(IDE_UNIX_uid(x))
345*0Sstevel@tonic-gate #define IDE_UNIX_GID(x)		BOTH_INT(IDE_UNIX_gid(x))
346*0Sstevel@tonic-gate 
347*0Sstevel@tonic-gate #define IDE_UNIX_CRE_DATE(x)	IDE_UNIX_cre_date(x)
348*0Sstevel@tonic-gate #define IDE_UNIX_MOD_DATE(x)	IDE_UNIX_mod_date(x)
349*0Sstevel@tonic-gate #define IDE_UNIX_EXP_DATE(x)	IDE_UNIX_exp_date(x)
350*0Sstevel@tonic-gate #define IDE_UNIX_EFF_DATE(x)	IDE_UNIX_eff_date(x)
351*0Sstevel@tonic-gate #define IDE_UNIX_ACC_DATE(x)	IDE_UNIX_acc_date(x)
352*0Sstevel@tonic-gate #define IDE_UNIX_RESERVED(x)	*(IDE_UNIX_reserved(x))
353*0Sstevel@tonic-gate 
354*0Sstevel@tonic-gate /* root record */
355*0Sstevel@tonic-gate /* size of root directory record */
356*0Sstevel@tonic-gate #define IDE_UNIX_ROOT_DIR_REC_SIZE   34+IDE_UNIX_UX_LEN
357*0Sstevel@tonic-gate #define IDE_UNIX_MAX_NAME_LEN   IDE_MAX_NAME_LEN - IDE_UNIX_UX_LEN
358*0Sstevel@tonic-gate 
359*0Sstevel@tonic-gate #endif	/*!_ISO_SPEC_H_*/
360