hsfs_spec.h revision 9cbc422eb4bbb3a109f0a452a66b366ceb784609
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FS_HSFS_SPEC_H
#define _SYS_FS_HSFS_SPEC_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* High Sierra filesystem specification
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
/* routines required for date parsing */
#endif /* _KERNEL */
/* macros to parse binary integers */
#define MSB_INT(x) \
#define LSB_INT(x) \
#define BOTH_SHORT(x) (short)*((short *)x)
#define BOTH_INT(x) (int)*((int *)x)
/*
* 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)
#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 HS_SYSAREA_SEC 0 /* 1st sector of system area */
#define MAXHSMASK (~MAXHSOFFSET)
/* Standard File Structure Volume Descriptor */
enum hs_voldesc_type {
};
/* macros to get the address of each field */
#define HSV_desc_lbn(x) (&((uchar_t *)x)[0])
/* macros to get the values of each field (strings are returned as ptrs) */
#define HSV_STD_ID(x) HSV_std_id(x)
#define HSV_STD_VER(x) *(HSV_std_ver(x))
#define HSV_SYS_ID(x) HSV_sys_id(x)
#define HSV_VOL_ID(x) HSV_vol_id(x)
#define HSV_ROOT_DIR(x) HSV_root_dir(x)
#define HSV_VOL_SET_ID(x) HSV_vol_set_id(x)
#define HSV_PUB_ID(x) HSV_pub_id(x)
#define HSV_PREP_ID(x) HSV_prep_id(x)
#define HSV_APPL_ID(x) HSV_appl_id(x)
#define HSV_COPYR_ID(x) HSV_copyr_id(x)
#define HSV_ABSTR_ID(x) HSV_abstr_id(x)
#define HSV_CRE_DATE(x) HSV_cre_date(x)
#define HSV_MOD_DATE(x) HSV_mod_date(x)
#define HSV_EXP_DATE(x) HSV_exp_date(x)
#define HSV_EFF_DATE(x) HSV_eff_date(x)
#define HSV_FILE_STRUCT_VER(x) *(HSV_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'))
#define HSV_DATE_GMTOFF(x) (((char *)x)[16])
/* Path table enry */
/* fix size of path table entry */
#define HPE_FPESIZE 8
/* macros to get the address of each field */
#define HPE_ext_lbn(x) (&((uchar_t *)x)[0])
/* macros to get the values of each field */
#if defined(__sparc)
#else
#define HPE_EXT_LBN(x) *(int *)(HPE_ext_lbn(x))
#endif
#define HPE_XAR_LEN(x) *(HPE_xar_len(x))
#define HPE_NAME_LEN(x) *(HPE_name_len(x))
#define HPE_PARENT_NO(x) *(short *)(HPE_parent_no(x))
/* root record */
/* max size of a name */
/* Directory Entry (Directory Record) */
#define UNIX_TO_HDE_DATE(t, p) parse_unixdate((t), (p))
/* macros to get the address of each field */
#define HDE_dir_len(x) (&((uchar_t *)x)[0])
/* **UNIX extension*** */
/* macros to get the values of each field (strings are returned as ptrs) */
#define HDE_DIR_LEN(x) *(HDE_dir_len(x))
#define HDE_XAR_LEN(x) *(HDE_xar_len(x))
#define HDE_RESERVED(x) *(HDE_reserved(x))
#define HDE_INTRLV_SIZE(x) *(HDE_intrlv_size(x))
#define HDE_INTRLV_SKIP(x) *(HDE_intrlv_skip(x))
#define HDE_NAME_LEN(x) *(HDE_name_len(x))
/* **UNIX EXTENSION**** */
/* mask bits for HDE_FLAGS */
#define HDE_UNUSED_FLAGS 0x60
/* Directory Record date fields */
#define HDE_DATE_GMTOFF(x) (((char *)x)[6])
/* tests for Interchange Levels 1 & 2 file types */
#define HDE_REGULAR_FILE(x) (((x) & HDE_PROHIBITED) == 0)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_HSFS_SPEC_H */