xref: /titanic_51/usr/src/uts/common/sys/fs/hsfs_isospec.h (revision 0c79d02b29618f74322989ec8ceafaa5486ac1db)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
554e0249cSfrankho  * Common Development and Distribution License (the "License").
654e0249cSfrankho  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22fc1c62b8Sfrankho  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_FS_HSFS_ISOSPEC_H
277c478bd9Sstevel@tonic-gate #define	_SYS_FS_HSFS_ISOSPEC_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * ISO 9660 filesystem specification
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /* macros to parse binary integers */
387c478bd9Sstevel@tonic-gate #define	ZERO(x)		(uint_t)(((uchar_t *)(x))[0])
397c478bd9Sstevel@tonic-gate #define	ONE(x)		(uint_t)(((uchar_t *)(x))[1])
407c478bd9Sstevel@tonic-gate #define	TWO(x)		(uint_t)(((uchar_t *)(x))[2])
417c478bd9Sstevel@tonic-gate #define	THREE(x)	(uint_t)(((uchar_t *)(x))[3])
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	MSB_INT(x) \
447c478bd9Sstevel@tonic-gate 	((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x))
457c478bd9Sstevel@tonic-gate #define	LSB_INT(x) \
467c478bd9Sstevel@tonic-gate 	((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x))
477c478bd9Sstevel@tonic-gate #define	MSB_SHORT(x)	((ZERO(x) << 8) | ONE(x))
487c478bd9Sstevel@tonic-gate #define	LSB_SHORT(x)	((ONE(x) << 8) | ZERO(x))
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
517c478bd9Sstevel@tonic-gate #define	BOTH_SHORT(x)	(short)*((short *)x)
527c478bd9Sstevel@tonic-gate #define	BOTH_INT(x)	(int)*((int *)x)
537c478bd9Sstevel@tonic-gate #elif defined(__sparc)
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * SPARC machines require that integers must
567c478bd9Sstevel@tonic-gate  * be aligned on a full word boundary.	CD-ROM data aligns
577c478bd9Sstevel@tonic-gate  * to even word boundary only.	Because of this mismatch,
587c478bd9Sstevel@tonic-gate  * we have to move integer data from CD-ROM to memory one
597c478bd9Sstevel@tonic-gate  * byte at a time.  LSB data starts first. We therefore
607c478bd9Sstevel@tonic-gate  * use this to do byte by byte copying.
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate #define	BOTH_SHORT(x)	LSB_SHORT(x)
637c478bd9Sstevel@tonic-gate #define	BOTH_INT(x)	LSB_INT(x)
647c478bd9Sstevel@tonic-gate #endif
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * The following describes actual on-disk structures.
687c478bd9Sstevel@tonic-gate  * To achieve portability, all structures are #defines
697c478bd9Sstevel@tonic-gate  * rather than a structure definition.	Macros are provided
707c478bd9Sstevel@tonic-gate  * to get either the data or address of individual fields.
717c478bd9Sstevel@tonic-gate  */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /* Overall High Sierra disk structure */
747c478bd9Sstevel@tonic-gate #define	ISO_SECTOR_SIZE	2048		/* bytes per logical sector */
757c478bd9Sstevel@tonic-gate #define	ISO_SECTOR_SHIFT	11		/* sector<->byte shift count */
767c478bd9Sstevel@tonic-gate #define	ISO_SEC_PER_PAGE	(PAGESIZE/HS_SECTOR_SIZE)
777c478bd9Sstevel@tonic-gate 							/* sectors per page */
787c478bd9Sstevel@tonic-gate #define	ISO_SYSAREA_SEC	0		/* 1st sector of system area */
797c478bd9Sstevel@tonic-gate #define	ISO_VOLDESC_SEC	16		/* 1st sector of volume descriptors */
807c478bd9Sstevel@tonic-gate #define	MAXISOOFFSET (ISO_SECTOR_SIZE - 1)
817c478bd9Sstevel@tonic-gate #define	MAXISOMASK   (~MAXISOOFFSET)
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /* Standard File Structure Volume Descriptor */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate enum iso_voldesc_type {
877c478bd9Sstevel@tonic-gate 	ISO_VD_BOOT = 0, ISO_VD_PVD = 1, ISO_VD_SVD = 2, ISO_VD_VPD = 3,
88*0c79d02bSRichard Lowe 	ISO_VD_UNIX = 4,		/* UNIX extension */
897c478bd9Sstevel@tonic-gate 	ISO_VD_EOV = 255
907c478bd9Sstevel@tonic-gate };
917c478bd9Sstevel@tonic-gate #define	ISO_ID_STRING	"CD001"		/* ISO_std_id field */
927c478bd9Sstevel@tonic-gate #define	ISO_ID_STRLEN	5		/* ISO_std_id field length */
93fc1c62b8Sfrankho #define	ISO_ID_VER	1		/* ISO_std_ver field ISO-9660:1988 */
94fc1c62b8Sfrankho #define	ISO_ID_VER2	2		/* ISO_std_ver field ISO-9660:1999 */
957c478bd9Sstevel@tonic-gate #define	ISO_FILE_STRUCT_ID_VER	1	/* ISO_file structure version  field */
967c478bd9Sstevel@tonic-gate #define	ISO_SYS_ID_STRLEN	32
977c478bd9Sstevel@tonic-gate #define	ISO_VOL_ID_STRLEN	32
987c478bd9Sstevel@tonic-gate #define	ISO_VOL_SET_ID_STRLEN	128
997c478bd9Sstevel@tonic-gate #define	ISO_PUB_ID_STRLEN	128
1007c478bd9Sstevel@tonic-gate #define	ISO_PREP_ID_STRLEN	128
1017c478bd9Sstevel@tonic-gate #define	ISO_APPL_ID_STRLEN	128
1027c478bd9Sstevel@tonic-gate #define	ISO_COPYR_ID_STRLEN	37
1037c478bd9Sstevel@tonic-gate #define	ISO_ABSTR_ID_STRLEN	37
1047c478bd9Sstevel@tonic-gate #define	ISO_SHORT_DATE_LEN	7
1057c478bd9Sstevel@tonic-gate #define	ISO_DATE_LEN		17
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /* macros to get the address of each field */
1107c478bd9Sstevel@tonic-gate #define	ISO_desc_type(x)	(&((uchar_t *)x)[0])
1117c478bd9Sstevel@tonic-gate #define	ISO_std_id(x)		(&((uchar_t *)x)[1])
1127c478bd9Sstevel@tonic-gate #define	ISO_std_ver(x)		(&((uchar_t *)x)[6])
1137c478bd9Sstevel@tonic-gate #define	ISO_sys_id(x)		(&((uchar_t *)x)[8])
1147c478bd9Sstevel@tonic-gate #define	ISO_vol_id(x)		(&((uchar_t *)x)[40])
1157c478bd9Sstevel@tonic-gate #define	ISO_vol_size(x)		(&((uchar_t *)x)[80])
116fc1c62b8Sfrankho #define	ISO_svd_esc(x)		(&((uchar_t *)x)[88])	/* Supplemental VD */
1177c478bd9Sstevel@tonic-gate #define	ISO_set_size(x)		(&((uchar_t *)x)[120])
1187c478bd9Sstevel@tonic-gate #define	ISO_set_seq(x)		(&((uchar_t *)x)[124])
1197c478bd9Sstevel@tonic-gate #define	ISO_blk_size(x)		(&((uchar_t *)x)[128])
1207c478bd9Sstevel@tonic-gate #define	ISO_ptbl_size(x)	(&((uchar_t *)x)[132])
1217c478bd9Sstevel@tonic-gate #define	ISO_ptbl_man_ls(x)	(&((uchar_t *)x)[140])
1227c478bd9Sstevel@tonic-gate #define	ISO_ptbl_opt_ls1(x)	(&((uchar_t *)x)[144])
1237c478bd9Sstevel@tonic-gate #define	ISO_ptbl_man_ms(x)	(&((uchar_t *)x)[148])
1247c478bd9Sstevel@tonic-gate #define	ISO_ptbl_opt_ms1(x)	(&((uchar_t *)x)[152])
1257c478bd9Sstevel@tonic-gate #define	ISO_root_dir(x)		(&((uchar_t *)x)[156])
1267c478bd9Sstevel@tonic-gate #define	ISO_vol_set_id(x)	(&((uchar_t *)x)[190])
1277c478bd9Sstevel@tonic-gate #define	ISO_pub_id(x)		(&((uchar_t *)x)[318])
1287c478bd9Sstevel@tonic-gate #define	ISO_prep_id(x)		(&((uchar_t *)x)[446])
1297c478bd9Sstevel@tonic-gate #define	ISO_appl_id(x)		(&((uchar_t *)x)[574])
1307c478bd9Sstevel@tonic-gate #define	ISO_copyr_id(x)		(&((uchar_t *)x)[702])
1317c478bd9Sstevel@tonic-gate #define	ISO_abstr_id(x)		(&((uchar_t *)x)[739])
1327c478bd9Sstevel@tonic-gate #define	ISO_bibli_id(x)		(&((uchar_t *)x)[776])
1337c478bd9Sstevel@tonic-gate #define	ISO_cre_date(x)		(&((uchar_t *)x)[813])
1347c478bd9Sstevel@tonic-gate #define	ISO_mod_date(x)		(&((uchar_t *)x)[830])
1357c478bd9Sstevel@tonic-gate #define	ISO_exp_date(x)		(&((uchar_t *)x)[847])
1367c478bd9Sstevel@tonic-gate #define	ISO_eff_date(x)		(&((uchar_t *)x)[864])
1377c478bd9Sstevel@tonic-gate #define	ISO_file_struct_ver(x)	(&((uchar_t *)x)[881])
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /* macros to get the values of each field (strings are returned as ptrs) */
140*0c79d02bSRichard Lowe #define	ISO_DESC_TYPE(x)	((enum iso_voldesc_type)*(ISO_desc_type(x)))
1417c478bd9Sstevel@tonic-gate #define	ISO_STD_ID(x)		ISO_std_id(x)
1427c478bd9Sstevel@tonic-gate #define	ISO_STD_VER(x)		*(ISO_std_ver(x))
1437c478bd9Sstevel@tonic-gate #define	ISO_SYS_ID(x)		ISO_sys_id(x)
1447c478bd9Sstevel@tonic-gate #define	ISO_VOL_ID(x)		ISO_vol_id(x)
1457c478bd9Sstevel@tonic-gate #define	ISO_VOL_SIZE(x)		BOTH_INT(ISO_vol_size(x))
1467c478bd9Sstevel@tonic-gate #define	ISO_SET_SIZE(x)		BOTH_SHORT(ISO_set_size(x))
1477c478bd9Sstevel@tonic-gate #define	ISO_SET_SEQ(x)		BOTH_SHORT(ISO_set_seq(x))
1487c478bd9Sstevel@tonic-gate #define	ISO_BLK_SIZE(x)		BOTH_SHORT(ISO_blk_size(x))
1497c478bd9Sstevel@tonic-gate #define	ISO_PTBL_SIZE(x)	BOTH_INT(ISO_ptbl_size(x))
1507c478bd9Sstevel@tonic-gate #define	ISO_PTBL_MAN_LS(x)	LSB_INT(ISO_ptbl_man_ls(x))
1517c478bd9Sstevel@tonic-gate #define	ISO_PTBL_OPT_LS1(x)	LSB_INT(ISO_ptbl_opt_ls1(x))
1527c478bd9Sstevel@tonic-gate #define	ISO_PTBL_MAN_MS(x)	MSB_INT(ISO_ptbl_man_ms(x))
1537c478bd9Sstevel@tonic-gate #define	ISO_PTBL_OPT_MS1(x)	MSB_INT(ISO_ptbl_opt_ms1(x))
1547c478bd9Sstevel@tonic-gate #define	ISO_ROOT_DIR(x)		ISO_root_dir(x)
1557c478bd9Sstevel@tonic-gate #define	ISO_VOL_SET_ID(x)	ISO_vol_set_id(x)
1567c478bd9Sstevel@tonic-gate #define	ISO_PUB_ID(x)		ISO_pub_id(x)
1577c478bd9Sstevel@tonic-gate #define	ISO_PREP_ID(x)		ISO_prep_id(x)
1587c478bd9Sstevel@tonic-gate #define	ISO_APPL_ID(x)		ISO_appl_id(x)
1597c478bd9Sstevel@tonic-gate #define	ISO_COPYR_ID(x)		ISO_copyr_id(x)
1607c478bd9Sstevel@tonic-gate #define	ISO_ABSTR_ID(x)		ISO_abstr_id(x)
1617c478bd9Sstevel@tonic-gate #define	ISO_BIBLI_ID(x)		ISO_bibli_id(x)
1627c478bd9Sstevel@tonic-gate #define	ISO_CRE_DATE(x)		HSV_cre_date(x)
1637c478bd9Sstevel@tonic-gate #define	ISO_MOD_DATE(x)		HSV_mod_date(x)
1647c478bd9Sstevel@tonic-gate #define	ISO_EXP_DATE(x)		HSV_exp_date(x)
1657c478bd9Sstevel@tonic-gate #define	ISO_EFF_DATE(x)		HSV_eff_date(x)
1667c478bd9Sstevel@tonic-gate #define	ISO_FILE_STRUCT_VER(x)	*(ISO_file_struct_ver(x))
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate /* Standard File Structure Volume Descriptor date fields */
1697c478bd9Sstevel@tonic-gate #define	ISO_DATE_2DIG(x)	((((x)[0] - '0') * 10) +		\
1707c478bd9Sstevel@tonic-gate 					((x)[1] - '0'))
1717c478bd9Sstevel@tonic-gate #define	ISO_DATE_4DIG(x)	((((x)[0] - '0') * 1000) +		\
1727c478bd9Sstevel@tonic-gate 					(((x)[1] - '0') * 100) +	\
1737c478bd9Sstevel@tonic-gate 					(((x)[2] - '0') * 10) +		\
1747c478bd9Sstevel@tonic-gate 					((x)[3] - '0'))
1757c478bd9Sstevel@tonic-gate #define	ISO_DATE_YEAR(x)	ISO_DATE_4DIG(&((uchar_t *)x)[0])
1767c478bd9Sstevel@tonic-gate #define	ISO_DATE_MONTH(x)	ISO_DATE_2DIG(&((uchar_t *)x)[4])
1777c478bd9Sstevel@tonic-gate #define	ISO_DATE_DAY(x)		ISO_DATE_2DIG(&((uchar_t *)x)[6])
1787c478bd9Sstevel@tonic-gate #define	ISO_DATE_HOUR(x)	ISO_DATE_2DIG(&((uchar_t *)x)[8])
1797c478bd9Sstevel@tonic-gate #define	ISO_DATE_MIN(x)		ISO_DATE_2DIG(&((uchar_t *)x)[10])
1807c478bd9Sstevel@tonic-gate #define	ISO_DATE_SEC(x)		ISO_DATE_2DIG(&((uchar_t *)x)[12])
1817c478bd9Sstevel@tonic-gate #define	ISO_DATE_HSEC(x)	ISO_DATE_2DIG(&((uchar_t *)x)[14])
1827c478bd9Sstevel@tonic-gate #define	ISO_DATE_GMTOFF(x)	(((char *)x)[16])
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /* Directory Entry (Directory Record) */
1877c478bd9Sstevel@tonic-gate #define	IDE_ROOT_DIR_REC_SIZE	34	/* size of root directory record */
1887c478bd9Sstevel@tonic-gate #define	IDE_FDESIZE		33	/* fixed size for hsfs directory area */
1897c478bd9Sstevel@tonic-gate 					/* max size of a name */
1907c478bd9Sstevel@tonic-gate #define	IDE_MAX_NAME_LEN	(255 - IDE_FDESIZE)
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate /* macros to get the address of each field */
1947c478bd9Sstevel@tonic-gate #define	IDE_dir_len(x)		(&((uchar_t *)x)[0])
1957c478bd9Sstevel@tonic-gate #define	IDE_xar_len(x)		(&((uchar_t *)x)[1])
1967c478bd9Sstevel@tonic-gate #define	IDE_ext_lbn(x)		(&((uchar_t *)x)[2])
1977c478bd9Sstevel@tonic-gate #define	IDE_ext_size(x)		(&((uchar_t *)x)[10])
1987c478bd9Sstevel@tonic-gate #define	IDE_cdate(x)		(&((uchar_t *)x)[18])
1997c478bd9Sstevel@tonic-gate #define	IDE_flags(x)		(&((uchar_t *)x)[25])
2007c478bd9Sstevel@tonic-gate #define	IDE_intrlv_size(x)	(&((uchar_t *)x)[26])
2017c478bd9Sstevel@tonic-gate #define	IDE_intrlv_skip(x)	(&((uchar_t *)x)[27])
2027c478bd9Sstevel@tonic-gate #define	IDE_vol_set(x)		(&((uchar_t *)x)[28])
2037c478bd9Sstevel@tonic-gate #define	IDE_name_len(x)		(&((uchar_t *)x)[32])
2047c478bd9Sstevel@tonic-gate #define	IDE_name(x)		(&((uchar_t *)x)[33])
2057c478bd9Sstevel@tonic-gate #define	IDE_sys_use_area(x)	(&((uchar_t *)x)[IDE_NAME_LEN(x) + \
2067c478bd9Sstevel@tonic-gate 				IDE_PAD_LEN(x)] + IDE_FDESIZE)
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /* macros to get the values of each field (strings are returned as ptrs) */
2097c478bd9Sstevel@tonic-gate #define	IDE_DIR_LEN(x)		*(IDE_dir_len(x))
2107c478bd9Sstevel@tonic-gate #define	IDE_XAR_LEN(x)		*(IDE_xar_len(x))
2117c478bd9Sstevel@tonic-gate #define	IDE_EXT_LBN(x)		BOTH_INT(IDE_ext_lbn(x))
2127c478bd9Sstevel@tonic-gate #define	IDE_EXT_SIZE(x)		BOTH_INT(IDE_ext_size(x))
2137c478bd9Sstevel@tonic-gate #define	IDE_CDATE(x)		IDE_cdate(x)
2147c478bd9Sstevel@tonic-gate #define	IDE_FLAGS(x)		*(IDE_flags(x))
2157c478bd9Sstevel@tonic-gate #define	IDE_INTRLV_SIZE(x)	*(IDE_intrlv_size(x))
2167c478bd9Sstevel@tonic-gate #define	IDE_INTRLV_SKIP(x)	*(IDE_intrlv_skip(x))
2177c478bd9Sstevel@tonic-gate #define	IDE_VOL_SET(x)		BOTH_SHORT(IDE_vol_set(x))
2187c478bd9Sstevel@tonic-gate #define	IDE_NAME_LEN(x)		*(IDE_name_len(x))
2197c478bd9Sstevel@tonic-gate #define	IDE_NAME(x)		IDE_name(x)
2207c478bd9Sstevel@tonic-gate #define	IDE_PAD_LEN(x)		((IDE_NAME_LEN(x) % 2) ? 0 : 1)
22154e0249cSfrankho #define	IDE_SUA_LEN(x)		((int)(IDE_DIR_LEN(x)) - (int)(IDE_FDESIZE) - \
22254e0249cSfrankho 				(int)(IDE_NAME_LEN(x)) - (int)(IDE_PAD_LEN(x)))
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate /* mask bits for IDE_FLAGS */
2257c478bd9Sstevel@tonic-gate #define	IDE_EXISTENCE		0x01	/* zero if file exists */
2267c478bd9Sstevel@tonic-gate #define	IDE_DIRECTORY		0x02	/* zero if file is not a directory */
2277c478bd9Sstevel@tonic-gate #define	IDE_ASSOCIATED		0x04	/* zero if file is not Associated */
2287c478bd9Sstevel@tonic-gate #define	IDE_RECORD		0x08	/* zero if no record attributes */
2297c478bd9Sstevel@tonic-gate #define	IDE_PROTECTION		0x10	/* zero if no protection attributes */
2307c478bd9Sstevel@tonic-gate #define	IDE_UNUSED_FLAGS	0x60
2317c478bd9Sstevel@tonic-gate #define	IDE_LAST_EXTENT		0x80	/* zero if last extent in file */
2327c478bd9Sstevel@tonic-gate #define	IDE_PROHIBITED	(IDE_DIRECTORY | IDE_RECORD | \
2337c478bd9Sstevel@tonic-gate 				IDE_LAST_EXTENT | IDE_UNUSED_FLAGS)
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate /* Directory Record date fields */
2367c478bd9Sstevel@tonic-gate #define	IDE_DATE_YEAR(x)	(((uchar_t *)x)[0] + 1900)
2377c478bd9Sstevel@tonic-gate #define	IDE_DATE_MONTH(x)	(((uchar_t *)x)[1])
2387c478bd9Sstevel@tonic-gate #define	IDE_DATE_DAY(x)		(((uchar_t *)x)[2])
2397c478bd9Sstevel@tonic-gate #define	IDE_DATE_HOUR(x)	(((uchar_t *)x)[3])
2407c478bd9Sstevel@tonic-gate #define	IDE_DATE_MIN(x)		(((uchar_t *)x)[4])
2417c478bd9Sstevel@tonic-gate #define	IDE_DATE_SEC(x)		(((uchar_t *)x)[5])
2427c478bd9Sstevel@tonic-gate #define	IDE_DATE_GMTOFF(x)	(((char *)x)[6])
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /* tests for Interchange Levels 1 & 2 file types */
2457c478bd9Sstevel@tonic-gate #define	IDE_REGULAR_FILE(x)	(((x) & IDE_PROHIBITED) == 0)
2467c478bd9Sstevel@tonic-gate #define	IDE_REGULAR_DIR(x)	(((x) & IDE_PROHIBITED) == IDE_DIRECTORY)
2477c478bd9Sstevel@tonic-gate 
248fc1c62b8Sfrankho /*
249fc1c62b8Sfrankho  * A ISO filename is: "ABCDE.EEE;1" -> <filename> '.' <ext> ';' <version #>
250fc1c62b8Sfrankho  *
251fc1c62b8Sfrankho  * The ISO-9660:1988 (Version 1) maximum needed string length is:
252fc1c62b8Sfrankho  *	30 chars (filename + ext)
253fc1c62b8Sfrankho  * +	 2 chars ('.' + ';')
254fc1c62b8Sfrankho  * +	   strlen("32767")
255fc1c62b8Sfrankho  * +	   null byte
256fc1c62b8Sfrankho  * ================================
257fc1c62b8Sfrankho  * =	38 chars
258fc1c62b8Sfrankho  *
259fc1c62b8Sfrankho  * ISO_DIR_NAMELEN counts 30 chars + '.'
260fc1c62b8Sfrankho  */
2617c478bd9Sstevel@tonic-gate #define	ISO_DIR_NAMELEN		31	/* max length of a directory name */
2627c478bd9Sstevel@tonic-gate #define	ISO_FILE_NAMELEN	31	/* max length of a filename, */
2637c478bd9Sstevel@tonic-gate 					/* excluding ";" and version num */
264fc1c62b8Sfrankho #define	ISO_NAMELEN_V2		207	/* ISOv2: 254 - 33 - 14 (XA Record) */
265fc1c62b8Sfrankho #define	ISO_NAMELEN_V2_MAX	221	/* max length, ignorig ISOv2 */
266fc1c62b8Sfrankho #define	JOLIET_NAMELEN		64	/* Joliet file name length (spec) */
267fc1c62b8Sfrankho #define	JOLIET_NAMELEN_MAX	110	/* max Joliet file name length  */
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /* Path table enry */
2707c478bd9Sstevel@tonic-gate /* fix size of path table entry */
2717c478bd9Sstevel@tonic-gate #define	IPE_FPESIZE		8
2727c478bd9Sstevel@tonic-gate /* macros to get the address of each field */
2737c478bd9Sstevel@tonic-gate #define	IPE_name_len(x)		(&((uchar_t *)x)[0])
2747c478bd9Sstevel@tonic-gate #define	IPE_xar_len(x)		(&((uchar_t *)x)[1])
2757c478bd9Sstevel@tonic-gate #define	IPE_ext_lbn(x)		(&((uchar_t *)x)[2])
2767c478bd9Sstevel@tonic-gate #define	IPE_parent_no(x)	(&((uchar_t *)x)[6])
2777c478bd9Sstevel@tonic-gate #define	IPE_name(x)		(&((uchar_t *)x)[8])
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate /* macros to get the values of each field */
2807c478bd9Sstevel@tonic-gate #define	IPE_EXT_LBN(x)		(MSB_INT(IPE_ext_lbn(x)))
2817c478bd9Sstevel@tonic-gate #define	IPE_XAR_LEN(x)		*(IPE_xar_len(x))
2827c478bd9Sstevel@tonic-gate #define	IPE_NAME_LEN(x)		*(IPE_name_len(x))
2837c478bd9Sstevel@tonic-gate #define	IPE_PARENT_NO(x)	*(short *)(IPE_parent_no(x))
2847c478bd9Sstevel@tonic-gate #define	IPE_NAME(x)		IPE_name(x)
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2877c478bd9Sstevel@tonic-gate }
2887c478bd9Sstevel@tonic-gate #endif
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate #endif	/* _SYS_FS_HSFS_ISOSPEC_H */
291