iso_spec.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2000 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ISO 9660 filesystem specification
*/
#ifndef _ISO_SPEC_H_
#define _ISO_SPEC_H_
#include <sys/isa_defs.h>
/* routines required for date parsing */
/* macros to parse binary integers */
#define MSB_INT(x) \
#define LSB_INT(x) \
#if defined(sparc)
/*
* Sparc machines requires that integer must
* be in a full word boundary. CD-ROM data aligns
* to even word boundary only. Because of this mismatch,
* we have to move integer data from CD-ROM to memory one
* byte at a time. LSB data starts first. We therefore
* use this to do byte by byte copying.
*/
#define BOTH_SHORT(x) LSB_SHORT(x)
#elif defined(_LITTLE_ENDIAN)
#define BOTH_SHORT(x) (short) *((short *)x)
#define BOTH_INT(x) (int) *((int *)x)
#elif defined(_BIG_ENDIAN)
#define BOTH_SHORT(x) (short) *((short *)x + 1)
#define BOTH_INT(x) (int) *((int *)x + 1)
#else
#endif
/*
*/
#if defined(_LITTLE_ENDIAN)
/* little endian machines */
#define ltohs(S) (S)
#define ltohl(L) (L)
#define htols(S) (S)
#define htoll(L) (L)
#else
/* big endian machines */
#endif
/*
* The following describes actual on-disk structures.
* To achieve portability, all structures are #defines
* rather than a structure definition. Macros are provided
* to get either the data or address of individual fields.
*/
/* Overall High Sierra disk structure */
#define ISO_SYSAREA_SEC 0 /* 1st sector of system area */
#define MAXISOMASK (~MAXISOOFFSET)
/* Standard File Structure Volume Descriptor */
enum iso_voldesc_type {
ISO_VD_EOV=255
};
#define ISO_SYS_ID_STRLEN 32
#define ISO_VOL_ID_STRLEN 32
#define ISO_VOL_SET_ID_STRLEN 128
#define ISO_PUB_ID_STRLEN 128
#define ISO_PREP_ID_STRLEN 128
#define ISO_APPL_ID_STRLEN 128
#define ISO_COPYR_ID_STRLEN 37
#define ISO_ABSTR_ID_STRLEN 37
#define ISO_DATE_LEN 17
/* macros to get the address of each field */
#define ISO_desc_type(x) (&((u_char *)x)[0])
/* macros to get the values of each field (strings are returned as ptrs) */
#define ISO_STD_ID(x) ISO_std_id(x)
#define ISO_STD_VER(x) *(ISO_std_ver(x))
#define ISO_SYS_ID(x) ISO_sys_id(x)
#define ISO_VOL_ID(x) ISO_vol_id(x)
#define ISO_ROOT_DIR(x) ISO_root_dir(x)
#define ISO_VOL_SET_ID(x) ISO_vol_set_id(x)
#define ISO_PUB_ID(x) ISO_pub_id(x)
#define ISO_PREP_ID(x) ISO_prep_id(x)
#define ISO_APPL_ID(x) ISO_appl_id(x)
#define ISO_COPYR_ID(x) ISO_copyr_id(x)
#define ISO_ABSTR_ID(x) ISO_abstr_id(x)
#define ISO_BIBLI_ID(x) ISO_bibli_id(x)
#define ISO_FILE_STRUCT_VER(x) *(ISO_file_struct_ver(x))
/* Standard File Structure Volume Descriptor date fields */
((x)[1] - '0') )
(((x)[1] - '0') * 100) + \
(((x)[2] - '0') * 10) + \
((x)[3] - '0') )
/* Directory Entry (Directory Record) */
/* max size of a name */
/* macros to get the address of each field */
#define IDE_dir_len(x) (&((u_char *)x)[0])
/* macros to get the values of each field (strings are returned as ptrs) */
#define IDE_DIR_LEN(x) *(IDE_dir_len(x))
#define IDE_XAR_LEN(x) *(IDE_xar_len(x))
#define IDE_INTRLV_SIZE(x) *(IDE_intrlv_size(x))
#define IDE_INTRLV_SKIP(x) *(IDE_intrlv_skip(x))
#define IDE_NAME_LEN(x) *(IDE_name_len(x))
/* mask bits for IDE_FLAGS */
#define IDE_UNUSED_FLAGS 0x60
/* Directory Record date fields */
/* tests for Interchange Levels 1 & 2 file types */
#define IDE_REGULAR_FILE(x) (((x) & IDE_PROHIBITED) == 0)
/* Path table enry */
/* fix size of path table entry */
#define IPE_FPESIZE 8
/* macros to get the address of each field */
#define IPE_name_len(x) (&((u_char *)x)[0])
/* macros to get the values of each field */
#define IPE_XAR_LEN(x) *(IPE_xar_len(x))
#define IPE_NAME_LEN(x) *(IPE_name_len(x))
#define IPE_PARENT_NO(x) *(short *)(IPE_parent_no(x))
/* cdrom UNIX extension */
/* UNIX Volume Descriptor */
#define ISO_UNIX_FEATURE(x) *(ISO_UNIX_feature(x))
#define ISO_UNIX_ROOT_DIR(x) ISO_UNIX_root_dir(x)
#define ISO_UNIX_SIGNATURE(x) ISO_UNIX_signature(x)
/* UNIX extension to path table entry */
/* fix size of path table entry */
#define IPE_UNIX_FPESIZE 20
#define IPE_UNIX_mode(x) (&((u_char *)x)[0])
/* macros to get the values of each field */
/* UNIX extension to directory entry */
#define IDE_UNIX_signature(x) (&((u_char *)x)[0])
#define IDE_UNIX_SIGNATURE(x) IDE_UNIX_signature(x)
#define IDE_UNIX_EXT_LEN(x) *(IDE_UNIX_ext_len(x))
#define IDE_UNIX_USE_ID(x) *(IDE_UNIX_use_id(x))
#define IDE_UNIX_CRE_DATE(x) IDE_UNIX_cre_date(x)
#define IDE_UNIX_MOD_DATE(x) IDE_UNIX_mod_date(x)
#define IDE_UNIX_EXP_DATE(x) IDE_UNIX_exp_date(x)
#define IDE_UNIX_EFF_DATE(x) IDE_UNIX_eff_date(x)
#define IDE_UNIX_ACC_DATE(x) IDE_UNIX_acc_date(x)
#define IDE_UNIX_RESERVED(x) *(IDE_UNIX_reserved(x))
/* root record */
/* size of root directory record */
#endif /*!_ISO_SPEC_H_*/