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 /* 22*9cbc422eSpeterte * 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_SPEC_H 277c478bd9Sstevel@tonic-gate #define _SYS_FS_HSFS_SPEC_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate /* 327c478bd9Sstevel@tonic-gate * High Sierra filesystem specification 337c478bd9Sstevel@tonic-gate */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <sys/time.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifdef _KERNEL 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate /* routines required for date parsing */ 457c478bd9Sstevel@tonic-gate extern void hs_parse_dirdate(uchar_t *, struct timeval *); 467c478bd9Sstevel@tonic-gate extern void hs_parse_longdate(uchar_t *, struct timeval *); 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* macros to parse binary integers */ 527c478bd9Sstevel@tonic-gate #define ZERO(x) (uint_t)(((uchar_t *)(x))[0]) 537c478bd9Sstevel@tonic-gate #define ONE(x) (uint_t)(((uchar_t *)(x))[1]) 547c478bd9Sstevel@tonic-gate #define TWO(x) (uint_t)(((uchar_t *)(x))[2]) 557c478bd9Sstevel@tonic-gate #define THREE(x) (uint_t)(((uchar_t *)(x))[3]) 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #define MSB_INT(x) \ 587c478bd9Sstevel@tonic-gate ((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x)) 597c478bd9Sstevel@tonic-gate #define LSB_INT(x) \ 607c478bd9Sstevel@tonic-gate ((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x)) 617c478bd9Sstevel@tonic-gate #define MSB_SHORT(x) ((ZERO(x) << 8) | ONE(x)) 627c478bd9Sstevel@tonic-gate #define LSB_SHORT(x) ((ONE(x) << 8) | ZERO(x)) 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64) 657c478bd9Sstevel@tonic-gate #define BOTH_SHORT(x) (short)*((short *)x) 667c478bd9Sstevel@tonic-gate #define BOTH_INT(x) (int)*((int *)x) 677c478bd9Sstevel@tonic-gate #elif defined(__sparc) 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * SPARC machines requires that integer must 707c478bd9Sstevel@tonic-gate * be in a full word boundary. CD-ROM data aligns 717c478bd9Sstevel@tonic-gate * to even word boundary only. Because of this mismatch, 727c478bd9Sstevel@tonic-gate * we have to move integer data from CD-ROM to memory one 737c478bd9Sstevel@tonic-gate * byte at a time. LSB data starts first. We therefore 747c478bd9Sstevel@tonic-gate * use this to do byte by byte copying. 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate #define BOTH_SHORT(x) LSB_SHORT(x) 777c478bd9Sstevel@tonic-gate #define BOTH_INT(x) LSB_INT(x) 787c478bd9Sstevel@tonic-gate #endif 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate /* 817c478bd9Sstevel@tonic-gate * The following describes actual on-disk structures. 827c478bd9Sstevel@tonic-gate * To achieve portability, all structures are #defines 837c478bd9Sstevel@tonic-gate * rather than a structure definition. Macros are provided 847c478bd9Sstevel@tonic-gate * to get either the data or address of individual fields. 857c478bd9Sstevel@tonic-gate */ 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate /* Overall High Sierra disk structure */ 887c478bd9Sstevel@tonic-gate #define HS_SECTOR_SIZE 2048 /* bytes per logical sector */ 897c478bd9Sstevel@tonic-gate #define HS_SECTOR_SHIFT 11 /* sector<->byte shift count */ 907c478bd9Sstevel@tonic-gate #define HS_SEC_PER_PAGE (PAGESIZE/HS_SECTOR_SIZE) /* sectors per page */ 917c478bd9Sstevel@tonic-gate #define HS_SYSAREA_SEC 0 /* 1st sector of system area */ 927c478bd9Sstevel@tonic-gate #define HS_VOLDESC_SEC 16 /* 1st sector of volume descriptors */ 93*9cbc422eSpeterte #define HS_MAXFILEOFF 4294967295U /* Max file offset (4Gb - 1). */ 947c478bd9Sstevel@tonic-gate #define MAXHSOFFSET (HS_SECTOR_SIZE - 1) 957c478bd9Sstevel@tonic-gate #define MAXHSMASK (~MAXHSOFFSET) 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* Standard File Structure Volume Descriptor */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate enum hs_voldesc_type { 1007c478bd9Sstevel@tonic-gate VD_BOOT = 0, VD_SFS = 1, VD_CCFS = 2, VD_UNSPEC = 3, VD_EOV = 255 1017c478bd9Sstevel@tonic-gate }; 1027c478bd9Sstevel@tonic-gate #define HSV_ID_STRING "CDROM" /* HSV_std_id field */ 1037c478bd9Sstevel@tonic-gate #define HSV_ID_STRLEN 5 /* HSV_std_id field length */ 1047c478bd9Sstevel@tonic-gate #define HSV_ID_VER 1 /* HSV_std_ver field */ 1057c478bd9Sstevel@tonic-gate #define HSV_FILE_STRUCT_ID_VER 1 /* HSV_file_struct_ver field */ 1067c478bd9Sstevel@tonic-gate #define HSV_SYS_ID_STRLEN 32 /* HSV_sys_id field length */ 1077c478bd9Sstevel@tonic-gate #define HSV_VOL_ID_STRLEN 32 /* HSV_vol_id field length */ 1087c478bd9Sstevel@tonic-gate #define HSV_VOL_SET_ID_STRLEN 128 /* HSV_vol_set_id field length */ 1097c478bd9Sstevel@tonic-gate #define HSV_PUB_ID_STRLEN 128 /* HSV_pub_id field length */ 1107c478bd9Sstevel@tonic-gate #define HSV_PREP_ID_STRLEN 128 /* HSV_prep_id field length */ 1117c478bd9Sstevel@tonic-gate #define HSV_APPL_ID_STRLEN 128 /* HSV_appl_id field length */ 1127c478bd9Sstevel@tonic-gate #define HSV_COPYR_ID_STRLEN 32 /* HSV_copyr_id field length */ 1137c478bd9Sstevel@tonic-gate #define HSV_ABSTR_ID_STRLEN 32 /* HSV_abstr_id field length */ 1147c478bd9Sstevel@tonic-gate #define HSV_DATE_LEN 16 /* HSV date filed length */ 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* macros to get the address of each field */ 1177c478bd9Sstevel@tonic-gate #define HSV_desc_lbn(x) (&((uchar_t *)x)[0]) 1187c478bd9Sstevel@tonic-gate #define HSV_desc_type(x) (&((uchar_t *)x)[8]) 1197c478bd9Sstevel@tonic-gate #define HSV_std_id(x) (&((uchar_t *)x)[9]) 1207c478bd9Sstevel@tonic-gate #define HSV_std_ver(x) (&((uchar_t *)x)[14]) 1217c478bd9Sstevel@tonic-gate #define HSV_sys_id(x) (&((uchar_t *)x)[16]) 1227c478bd9Sstevel@tonic-gate #define HSV_vol_id(x) (&((uchar_t *)x)[48]) 1237c478bd9Sstevel@tonic-gate #define HSV_vol_size(x) (&((uchar_t *)x)[88]) 1247c478bd9Sstevel@tonic-gate #define HSV_set_size(x) (&((uchar_t *)x)[128]) 1257c478bd9Sstevel@tonic-gate #define HSV_set_seq(x) (&((uchar_t *)x)[132]) 1267c478bd9Sstevel@tonic-gate #define HSV_blk_size(x) (&((uchar_t *)x)[136]) 1277c478bd9Sstevel@tonic-gate #define HSV_ptbl_size(x) (&((uchar_t *)x)[140]) 1287c478bd9Sstevel@tonic-gate #define HSV_ptbl_man_ls(x) (&((uchar_t *)x)[148]) 1297c478bd9Sstevel@tonic-gate #define HSV_ptbl_opt_ls1(x) (&((uchar_t *)x)[152]) 1307c478bd9Sstevel@tonic-gate #define HSV_ptbl_opt_ls2(x) (&((uchar_t *)x)[156]) 1317c478bd9Sstevel@tonic-gate #define HSV_ptbl_opt_ls3(x) (&((uchar_t *)x)[160]) 1327c478bd9Sstevel@tonic-gate #define HSV_ptbl_man_ms(x) (&((uchar_t *)x)[164]) 1337c478bd9Sstevel@tonic-gate #define HSV_ptbl_opt_ms1(x) (&((uchar_t *)x)[168]) 1347c478bd9Sstevel@tonic-gate #define HSV_ptbl_opt_ms2(x) (&((uchar_t *)x)[172]) 1357c478bd9Sstevel@tonic-gate #define HSV_ptbl_opt_ms3(x) (&((uchar_t *)x)[176]) 1367c478bd9Sstevel@tonic-gate #define HSV_root_dir(x) (&((uchar_t *)x)[180]) 1377c478bd9Sstevel@tonic-gate #define HSV_vol_set_id(x) (&((uchar_t *)x)[214]) 1387c478bd9Sstevel@tonic-gate #define HSV_pub_id(x) (&((uchar_t *)x)[342]) 1397c478bd9Sstevel@tonic-gate #define HSV_prep_id(x) (&((uchar_t *)x)[470]) 1407c478bd9Sstevel@tonic-gate #define HSV_appl_id(x) (&((uchar_t *)x)[598]) 1417c478bd9Sstevel@tonic-gate #define HSV_copyr_id(x) (&((uchar_t *)x)[726]) 1427c478bd9Sstevel@tonic-gate #define HSV_abstr_id(x) (&((uchar_t *)x)[758]) 1437c478bd9Sstevel@tonic-gate #define HSV_cre_date(x) (&((uchar_t *)x)[790]) 1447c478bd9Sstevel@tonic-gate #define HSV_mod_date(x) (&((uchar_t *)x)[806]) 1457c478bd9Sstevel@tonic-gate #define HSV_exp_date(x) (&((uchar_t *)x)[822]) 1467c478bd9Sstevel@tonic-gate #define HSV_eff_date(x) (&((uchar_t *)x)[838]) 1477c478bd9Sstevel@tonic-gate #define HSV_file_struct_ver(x) (&((uchar_t *)x)[854]) 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate /* macros to get the values of each field (strings are returned as ptrs) */ 1507c478bd9Sstevel@tonic-gate #define HSV_DESC_LBN(x) BOTH_INT(HSV_desc_lbn(x)) 1517c478bd9Sstevel@tonic-gate #define HSV_DESC_TYPE(x) ((enum hs_voldesc_type)*(HSV_desc_type(x))) 1527c478bd9Sstevel@tonic-gate #define HSV_STD_ID(x) HSV_std_id(x) 1537c478bd9Sstevel@tonic-gate #define HSV_STD_VER(x) *(HSV_std_ver(x)) 1547c478bd9Sstevel@tonic-gate #define HSV_SYS_ID(x) HSV_sys_id(x) 1557c478bd9Sstevel@tonic-gate #define HSV_VOL_ID(x) HSV_vol_id(x) 1567c478bd9Sstevel@tonic-gate #define HSV_VOL_SIZE(x) BOTH_INT(HSV_vol_size(x)) 1577c478bd9Sstevel@tonic-gate #define HSV_SET_SIZE(x) BOTH_SHORT(HSV_set_size(x)) 1587c478bd9Sstevel@tonic-gate #define HSV_SET_SEQ(x) BOTH_SHORT(HSV_set_seq(x)) 1597c478bd9Sstevel@tonic-gate #define HSV_BLK_SIZE(x) BOTH_SHORT(HSV_blk_size(x)) 1607c478bd9Sstevel@tonic-gate #define HSV_PTBL_SIZE(x) BOTH_INT(HSV_ptbl_size(x)) 1617c478bd9Sstevel@tonic-gate #define HSV_PTBL_MAN_LS(x) LSB_INT(HSV_ptbl_man_ls(x)) 1627c478bd9Sstevel@tonic-gate #define HSV_PTBL_OPT_LS1(x) LSB_INT(HSV_ptbl_opt_ls1(x)) 1637c478bd9Sstevel@tonic-gate #define HSV_PTBL_OPT_LS2(x) LSB_INT(HSV_ptbl_opt_ls2(x)) 1647c478bd9Sstevel@tonic-gate #define HSV_PTBL_OPT_LS3(x) LSB_INT(HSV_ptbl_opt_ls3(x)) 1657c478bd9Sstevel@tonic-gate #define HSV_PTBL_MAN_MS(x) MSB_INT(HSV_ptbl_man_ms(x)) 1667c478bd9Sstevel@tonic-gate #define HSV_PTBL_OPT_MS1(x) MSB_INT(HSV_ptbl_opt_ms1(x)) 1677c478bd9Sstevel@tonic-gate #define HSV_PTBL_OPT_MS2(x) MSB_INT(HSV_ptbl_opt_ms2(x)) 1687c478bd9Sstevel@tonic-gate #define HSV_PTBL_OPT_MS3(x) MSB_INT(HSV_ptbl_opt_ms3(x)) 1697c478bd9Sstevel@tonic-gate #define HSV_ROOT_DIR(x) HSV_root_dir(x) 1707c478bd9Sstevel@tonic-gate #define HSV_VOL_SET_ID(x) HSV_vol_set_id(x) 1717c478bd9Sstevel@tonic-gate #define HSV_PUB_ID(x) HSV_pub_id(x) 1727c478bd9Sstevel@tonic-gate #define HSV_PREP_ID(x) HSV_prep_id(x) 1737c478bd9Sstevel@tonic-gate #define HSV_APPL_ID(x) HSV_appl_id(x) 1747c478bd9Sstevel@tonic-gate #define HSV_COPYR_ID(x) HSV_copyr_id(x) 1757c478bd9Sstevel@tonic-gate #define HSV_ABSTR_ID(x) HSV_abstr_id(x) 1767c478bd9Sstevel@tonic-gate #define HSV_CRE_DATE(x) HSV_cre_date(x) 1777c478bd9Sstevel@tonic-gate #define HSV_MOD_DATE(x) HSV_mod_date(x) 1787c478bd9Sstevel@tonic-gate #define HSV_EXP_DATE(x) HSV_exp_date(x) 1797c478bd9Sstevel@tonic-gate #define HSV_EFF_DATE(x) HSV_eff_date(x) 1807c478bd9Sstevel@tonic-gate #define HSV_FILE_STRUCT_VER(x) *(HSV_file_struct_ver(x)) 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* Standard File Structure Volume Descriptor date fields */ 1837c478bd9Sstevel@tonic-gate #define HSV_DATE_2DIG(x) ((((x)[0] - '0') * 10) + \ 1847c478bd9Sstevel@tonic-gate ((x)[1] - '0')) 1857c478bd9Sstevel@tonic-gate #define HSV_DATE_4DIG(x) ((((x)[0] - '0') * 1000) + \ 1867c478bd9Sstevel@tonic-gate (((x)[1] - '0') * 100) + \ 1877c478bd9Sstevel@tonic-gate (((x)[2] - '0') * 10) + \ 1887c478bd9Sstevel@tonic-gate ((x)[3] - '0')) 1897c478bd9Sstevel@tonic-gate #define HSV_DATE_YEAR(x) HSV_DATE_4DIG(&((uchar_t *)x)[0]) 1907c478bd9Sstevel@tonic-gate #define HSV_DATE_MONTH(x) HSV_DATE_2DIG(&((uchar_t *)x)[4]) 1917c478bd9Sstevel@tonic-gate #define HSV_DATE_DAY(x) HSV_DATE_2DIG(&((uchar_t *)x)[6]) 1927c478bd9Sstevel@tonic-gate #define HSV_DATE_HOUR(x) HSV_DATE_2DIG(&((uchar_t *)x)[8]) 1937c478bd9Sstevel@tonic-gate #define HSV_DATE_MIN(x) HSV_DATE_2DIG(&((uchar_t *)x)[10]) 1947c478bd9Sstevel@tonic-gate #define HSV_DATE_SEC(x) HSV_DATE_2DIG(&((uchar_t *)x)[12]) 1957c478bd9Sstevel@tonic-gate #define HSV_DATE_HSEC(x) HSV_DATE_2DIG(&((uchar_t *)x)[14]) 1967c478bd9Sstevel@tonic-gate #define HSV_DATE_GMTOFF(x) (((char *)x)[16]) 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate /* Path table enry */ 2007c478bd9Sstevel@tonic-gate /* fix size of path table entry */ 2017c478bd9Sstevel@tonic-gate #define HPE_FPESIZE 8 2027c478bd9Sstevel@tonic-gate /* macros to get the address of each field */ 2037c478bd9Sstevel@tonic-gate #define HPE_ext_lbn(x) (&((uchar_t *)x)[0]) 2047c478bd9Sstevel@tonic-gate #define HPE_xar_len(x) (&((uchar_t *)x)[4]) 2057c478bd9Sstevel@tonic-gate #define HPE_name_len(x) (&((uchar_t *)x)[5]) 2067c478bd9Sstevel@tonic-gate #define HPE_parent_no(x) (&((uchar_t *)x)[6]) 2077c478bd9Sstevel@tonic-gate #define HPE_name(x) (&((uchar_t *)x)[8]) 2087c478bd9Sstevel@tonic-gate 2097c478bd9Sstevel@tonic-gate /* macros to get the values of each field */ 2107c478bd9Sstevel@tonic-gate #if defined(__sparc) 2117c478bd9Sstevel@tonic-gate #define HPE_EXT_LBN(x) (MSB_INT(HPE_ext_lbn(x))) 2127c478bd9Sstevel@tonic-gate #else 2137c478bd9Sstevel@tonic-gate #define HPE_EXT_LBN(x) *(int *)(HPE_ext_lbn(x)) 2147c478bd9Sstevel@tonic-gate #endif 2157c478bd9Sstevel@tonic-gate #define HPE_XAR_LEN(x) *(HPE_xar_len(x)) 2167c478bd9Sstevel@tonic-gate #define HPE_NAME_LEN(x) *(HPE_name_len(x)) 2177c478bd9Sstevel@tonic-gate #define HPE_PARENT_NO(x) *(short *)(HPE_parent_no(x)) 2187c478bd9Sstevel@tonic-gate #define HPE_NAME(x) HPE_name(x) 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate /* root record */ 2217c478bd9Sstevel@tonic-gate #define HDE_ROOT_DIR_REC_SIZE 34 /* size of root directory record */ 2227c478bd9Sstevel@tonic-gate #define HDE_FDESIZE 33 /* fixed size for hsfs directory area */ 22354e0249cSfrankho #define HDE_FUSIZE 12 /* fixed size for unix area */ 2247c478bd9Sstevel@tonic-gate /* max size of a name */ 2257c478bd9Sstevel@tonic-gate #define HDE_MAX_NAME_LEN (255 - HDE_FDESIZE - HDE_FUSIZE) 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate /* Directory Entry (Directory Record) */ 2287c478bd9Sstevel@tonic-gate 2297c478bd9Sstevel@tonic-gate #define UNIX_TO_HDE_DATE(t, p) parse_unixdate((t), (p)) 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate /* macros to get the address of each field */ 2327c478bd9Sstevel@tonic-gate #define HDE_dir_len(x) (&((uchar_t *)x)[0]) 2337c478bd9Sstevel@tonic-gate #define HDE_xar_len(x) (&((uchar_t *)x)[1]) 2347c478bd9Sstevel@tonic-gate #define HDE_ext_lbn(x) (&((uchar_t *)x)[2]) 2357c478bd9Sstevel@tonic-gate #define HDE_ext_size(x) (&((uchar_t *)x)[10]) 2367c478bd9Sstevel@tonic-gate #define HDE_cdate(x) (&((uchar_t *)x)[18]) 2377c478bd9Sstevel@tonic-gate #define HDE_flags(x) (&((uchar_t *)x)[24]) 2387c478bd9Sstevel@tonic-gate #define HDE_reserved(x) (&((uchar_t *)x)[25]) 2397c478bd9Sstevel@tonic-gate #define HDE_intrlv_size(x) (&((uchar_t *)x)[26]) 2407c478bd9Sstevel@tonic-gate #define HDE_intrlv_skip(x) (&((uchar_t *)x)[27]) 2417c478bd9Sstevel@tonic-gate #define HDE_vol_set(x) (&((uchar_t *)x)[28]) 2427c478bd9Sstevel@tonic-gate #define HDE_name_len(x) (&((uchar_t *)x)[32]) 2437c478bd9Sstevel@tonic-gate #define HDE_name(x) (&((uchar_t *)x)[33]) 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate /* **UNIX extension*** */ 2467c478bd9Sstevel@tonic-gate #define HDE_mode(x) (&((uchar_t *)x)[0]) 2477c478bd9Sstevel@tonic-gate #define HDE_uid(x) (&((uchar_t *)x)[4]) 2487c478bd9Sstevel@tonic-gate #define HDE_gid(x) (&((uchar_t *)x)[8]) 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate /* macros to get the values of each field (strings are returned as ptrs) */ 2517c478bd9Sstevel@tonic-gate #define HDE_DIR_LEN(x) *(HDE_dir_len(x)) 2527c478bd9Sstevel@tonic-gate #define HDE_XAR_LEN(x) *(HDE_xar_len(x)) 2537c478bd9Sstevel@tonic-gate #define HDE_EXT_LBN(x) BOTH_INT(HDE_ext_lbn(x)) 2547c478bd9Sstevel@tonic-gate #define HDE_EXT_SIZE(x) BOTH_INT(HDE_ext_size(x)) 2557c478bd9Sstevel@tonic-gate #define HDE_CDATE(x) HDE_cdate(x) 2567c478bd9Sstevel@tonic-gate #define HDE_FLAGS(x) *(HDE_flags(x)) 2577c478bd9Sstevel@tonic-gate #define HDE_RESERVED(x) *(HDE_reserved(x)) 2587c478bd9Sstevel@tonic-gate #define HDE_INTRLV_SIZE(x) *(HDE_intrlv_size(x)) 2597c478bd9Sstevel@tonic-gate #define HDE_INTRLV_SKIP(x) *(HDE_intrlv_skip(x)) 2607c478bd9Sstevel@tonic-gate #define HDE_VOL_SET(x) BOTH_SHORT(HDE_vol_set(x)) 2617c478bd9Sstevel@tonic-gate #define HDE_NAME_LEN(x) *(HDE_name_len(x)) 2627c478bd9Sstevel@tonic-gate #define HDE_NAME(x) HDE_name(x) 2637c478bd9Sstevel@tonic-gate 2647c478bd9Sstevel@tonic-gate /* **UNIX EXTENSION**** */ 2657c478bd9Sstevel@tonic-gate #define HDE_MODE(x) *(HDE_mode(x)) 2667c478bd9Sstevel@tonic-gate #define HDE_UID(x) *(HDE_uid(x)) 2677c478bd9Sstevel@tonic-gate #define HDE_GID(x) *(HDE_gid(x)) 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate /* mask bits for HDE_FLAGS */ 2707c478bd9Sstevel@tonic-gate #define HDE_EXISTENCE 0x01 /* zero if file exists */ 2717c478bd9Sstevel@tonic-gate #define HDE_DIRECTORY 0x02 /* zero if file is not a directory */ 2727c478bd9Sstevel@tonic-gate #define HDE_ASSOCIATED 0x04 /* zero if file is not Associated */ 2737c478bd9Sstevel@tonic-gate #define HDE_RECORD 0x08 /* zero if no record attributes */ 2747c478bd9Sstevel@tonic-gate #define HDE_PROTECTION 0x10 /* zero if no protection attributes */ 2757c478bd9Sstevel@tonic-gate #define HDE_UNUSED_FLAGS 0x60 2767c478bd9Sstevel@tonic-gate #define HDE_LAST_EXTENT 0x80 /* zero if last extent in file */ 2777c478bd9Sstevel@tonic-gate #define HDE_PROHIBITED (HDE_DIRECTORY | HDE_RECORD | \ 2787c478bd9Sstevel@tonic-gate HDE_LAST_EXTENT | HDE_UNUSED_FLAGS) 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate /* Directory Record date fields */ 2817c478bd9Sstevel@tonic-gate #define HDE_DATE_YEAR(x) (((uchar_t *)x)[0] + 1900) 2827c478bd9Sstevel@tonic-gate #define HDE_DATE_MONTH(x) (((uchar_t *)x)[1]) 2837c478bd9Sstevel@tonic-gate #define HDE_DATE_DAY(x) (((uchar_t *)x)[2]) 2847c478bd9Sstevel@tonic-gate #define HDE_DATE_HOUR(x) (((uchar_t *)x)[3]) 2857c478bd9Sstevel@tonic-gate #define HDE_DATE_MIN(x) (((uchar_t *)x)[4]) 2867c478bd9Sstevel@tonic-gate #define HDE_DATE_SEC(x) (((uchar_t *)x)[5]) 2877c478bd9Sstevel@tonic-gate #define HDE_DATE_GMTOFF(x) (((char *)x)[6]) 2887c478bd9Sstevel@tonic-gate 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate /* tests for Interchange Levels 1 & 2 file types */ 2917c478bd9Sstevel@tonic-gate #define HDE_REGULAR_FILE(x) (((x) & HDE_PROHIBITED) == 0) 2927c478bd9Sstevel@tonic-gate #define HDE_REGULAR_DIR(x) (((x) & HDE_PROHIBITED) == HDE_DIRECTORY) 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate #define HS_DIR_NAMELEN 31 /* max length of a directory name */ 2957c478bd9Sstevel@tonic-gate #define HS_FILE_NAMELEN 31 /* max length of a filename */ 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2987c478bd9Sstevel@tonic-gate } 2997c478bd9Sstevel@tonic-gate #endif 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gate #endif /* _SYS_FS_HSFS_SPEC_H */ 302