# HG changeset patch # User Richard Lowe # Date 1340852814 -3600 # Node ID 6c5d0718e8213fefa0cf6c5e6536b97d0ad14fff # Parent df4cd82e2b60f66498231e1ea08b21dc47e9d538 2974 hate having heap of hsfs headers 2977 ISO_DESC_TYPE should return iso_voldesc_type as everyone expects Reviewed by: Joshua M. Clulow Reviewed by: Milan Jurik Approved by: Eric Schrock diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/fstyp/fstyp.c --- a/usr/src/cmd/fs.d/hsfs/fstyp/fstyp.c Thu Jul 12 05:32:45 2012 -0700 +++ b/usr/src/cmd/fs.d/hsfs/fstyp/fstyp.c Thu Jun 28 04:06:54 2012 +0100 @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * libfstyp module for hsfs */ @@ -42,9 +40,9 @@ #include #include #include -#include "hsfs_spec.h" -#include "iso_spec.h" -#include "iso_impl.h" + +#include +#include typedef struct fstyp_hsfs { int fd; diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/fstyp/hsfs_spec.h --- a/usr/src/cmd/fs.d/hsfs/fstyp/hsfs_spec.h Thu Jul 12 05:32:45 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * High Sierra filesystem specification - * Copyright (c) 1989 by Sun Microsystem, Inc. - */ - -#ifndef _HSFS_SPEC_H_ -#define _HSFS_SPEC_H_ - -#include /* for ENDIAN defines */ - -/* routines required for date parsing */ -extern void hs_parse_dirdate(); /* parse date in directory */ -extern void hs_parse_longdate(); /* parse date in volume id */ - -/* macros to parse binary integers */ -#define ZERO(x) (u_int) (((u_char *)(x))[0]) -#define ONE(x) (u_int) (((u_char *)(x))[1]) -#define TWO(x) (u_int) (((u_char *)(x))[2]) -#define THREE(x) (u_int) (((u_char *)(x))[3]) - -#define MSB_INT(x) \ - ((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x)) -#define LSB_INT(x) \ - ((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x)) -#define MSB_SHORT(x) ((ZERO(x) << 8) | ONE(x)) -#define LSB_SHORT(x) ((ONE(x) << 8) | ZERO(x)) - -#if defined(_LITTLE_ENDIAN) -#define BOTH_SHORT(x) (short) *((short *)x) -#define BOTH_INT(x) (int) *((int *)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_SECTOR_SIZE 2048 /* bytes per logical sector */ -#define HS_SECTOR_SHIFT 11 /* sector<->byte shift count */ -#define HS_SEC_PER_PAGE (PAGESIZE/HS_SECTOR_SIZE) /* sectors per page */ -#define HS_SYSAREA_SEC 0 /* 1st sector of system area */ -#define HS_VOLDESC_SEC 16 /* 1st sector of volume descriptors */ -#define MAXHSOFFSET (HS_SECTOR_SIZE - 1) -#define MAXHSMASK (~MAXHSOFFSET) - -/* Standard File Structure Volume Descriptor */ - -enum hs_voldesc_type { - VD_BOOT=0, VD_SFS=1, VD_CCFS=2, VD_UNSPEC=3, VD_EOV=255 -}; -#define HSV_ID_STRING "CDROM" /* HSV_std_id field */ -#define HSV_ID_STRLEN 5 /* HSV_std_id field length */ -#define HSV_ID_VER 1 /* HSV_std_ver field */ -#define HSV_FILE_STRUCT_ID_VER 1 /* HSV_file_struct_ver field */ -#define HSV_SYS_ID_STRLEN 32 /* HSV_sys_id field length */ -#define HSV_VOL_ID_STRLEN 32 /* HSV_vol_id field length */ -#define HSV_VOL_SET_ID_STRLEN 128 /* HSV_vol_set_id field length */ -#define HSV_PUB_ID_STRLEN 128 /* HSV_pub_id field length */ -#define HSV_PREP_ID_STRLEN 128 /* HSV_prep_id field length */ -#define HSV_APPL_ID_STRLEN 128 /* HSV_appl_id field length */ -#define HSV_COPYR_ID_STRLEN 32 /* HSV_copyr_id field length */ -#define HSV_ABSTR_ID_STRLEN 32 /* HSV_abstr_id field length */ -#define HSV_DATE_LEN 16 /* HSV date filed length */ - -/* macros to get the address of each field */ -#define HSV_desc_lbn(x) (&((u_char *)x)[0]) -#define HSV_desc_type(x) (&((u_char *)x)[8]) -#define HSV_std_id(x) (&((u_char *)x)[9]) -#define HSV_std_ver(x) (&((u_char *)x)[14]) -#define HSV_sys_id(x) (&((u_char *)x)[16]) -#define HSV_vol_id(x) (&((u_char *)x)[48]) -#define HSV_vol_size(x) (&((u_char *)x)[88]) -#define HSV_set_size(x) (&((u_char *)x)[128]) -#define HSV_set_seq(x) (&((u_char *)x)[132]) -#define HSV_blk_size(x) (&((u_char *)x)[136]) -#define HSV_ptbl_size(x) (&((u_char *)x)[140]) -#define HSV_ptbl_man_ls(x) (&((u_char *)x)[148]) -#define HSV_ptbl_opt_ls1(x) (&((u_char *)x)[152]) -#define HSV_ptbl_opt_ls2(x) (&((u_char *)x)[156]) -#define HSV_ptbl_opt_ls3(x) (&((u_char *)x)[160]) -#define HSV_ptbl_man_ms(x) (&((u_char *)x)[164]) -#define HSV_ptbl_opt_ms1(x) (&((u_char *)x)[168]) -#define HSV_ptbl_opt_ms2(x) (&((u_char *)x)[172]) -#define HSV_ptbl_opt_ms3(x) (&((u_char *)x)[176]) -#define HSV_root_dir(x) (&((u_char *)x)[180]) -#define HSV_vol_set_id(x) (&((u_char *)x)[214]) -#define HSV_pub_id(x) (&((u_char *)x)[342]) -#define HSV_prep_id(x) (&((u_char *)x)[470]) -#define HSV_appl_id(x) (&((u_char *)x)[598]) -#define HSV_copyr_id(x) (&((u_char *)x)[726]) -#define HSV_abstr_id(x) (&((u_char *)x)[758]) -#define HSV_cre_date(x) (&((u_char *)x)[790]) -#define HSV_mod_date(x) (&((u_char *)x)[806]) -#define HSV_exp_date(x) (&((u_char *)x)[822]) -#define HSV_eff_date(x) (&((u_char *)x)[838]) -#define HSV_file_struct_ver(x) (&((u_char *)x)[854]) - -/* macros to get the values of each field (strings are returned as ptrs) */ -#define HSV_DESC_LBN(x) BOTH_INT(HSV_desc_lbn(x)) -#define HSV_DESC_TYPE(x) ((enum hs_voldesc_type)*(HSV_desc_type(x))) -#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_VOL_SIZE(x) BOTH_INT(HSV_vol_size(x)) -#define HSV_SET_SIZE(x) BOTH_SHORT(HSV_set_size(x)) -#define HSV_SET_SEQ(x) BOTH_SHORT(HSV_set_seq(x)) -#define HSV_BLK_SIZE(x) BOTH_SHORT(HSV_blk_size(x)) -#define HSV_PTBL_SIZE(x) BOTH_INT(HSV_ptbl_size(x)) -#define HSV_PTBL_MAN_LS(x) LSB_INT(HSV_ptbl_man_ls(x)) -#define HSV_PTBL_OPT_LS1(x) LSB_INT(HSV_ptbl_opt_ls1(x)) -#define HSV_PTBL_OPT_LS2(x) LSB_INT(HSV_ptbl_opt_ls2(x)) -#define HSV_PTBL_OPT_LS3(x) LSB_INT(HSV_ptbl_opt_ls3(x)) -#define HSV_PTBL_MAN_MS(x) MSB_INT(HSV_ptbl_man_ms(x)) -#define HSV_PTBL_OPT_MS1(x) MSB_INT(HSV_ptbl_opt_ms1(x)) -#define HSV_PTBL_OPT_MS2(x) MSB_INT(HSV_ptbl_opt_ms2(x)) -#define HSV_PTBL_OPT_MS3(x) MSB_INT(HSV_ptbl_opt_ms3(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 */ -#define HSV_DATE_2DIG(x) ( (((x)[0] - '0') * 10) + \ - ((x)[1] - '0') ) -#define HSV_DATE_4DIG(x) ( (((x)[0] - '0') * 1000) + \ - (((x)[1] - '0') * 100) + \ - (((x)[2] - '0') * 10) + \ - ((x)[3] - '0') ) -#define HSV_DATE_YEAR(x) HSV_DATE_4DIG(&((u_char *)x)[0]) -#define HSV_DATE_MONTH(x) HSV_DATE_2DIG(&((u_char *)x)[4]) -#define HSV_DATE_DAY(x) HSV_DATE_2DIG(&((u_char *)x)[6]) -#define HSV_DATE_HOUR(x) HSV_DATE_2DIG(&((u_char *)x)[8]) -#define HSV_DATE_MIN(x) HSV_DATE_2DIG(&((u_char *)x)[10]) -#define HSV_DATE_SEC(x) HSV_DATE_2DIG(&((u_char *)x)[12]) -#define HSV_DATE_HSEC(x) HSV_DATE_2DIG(&((u_char *)x)[14]) - -/* 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) (&((u_char *)x)[0]) -#define HPE_xar_len(x) (&((u_char *)x)[4]) -#define HPE_name_len(x) (&((u_char *)x)[5]) -#define HPE_parent_no(x) (&((u_char *)x)[6]) -#define HPE_name(x) (&((u_char *)x)[8]) - -/* macros to get the values of each field */ -#if sun4 -#define HPE_EXT_LBN(x) (MSB_INT(HPE_ext_lbn(x))) -#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)) -#define HPE_NAME(x) HPE_name(x) - -/* root record */ -#define HDE_ROOT_DIR_REC_SIZE 34 /* size of root directory record */ -#define HDE_FDESIZE 33 /* fixed size for hsfs directory area */ -#define HDE_FUSIZE 12 /* fixed size for unix areaa */ - /* max size of a name */ -#define HDE_MAX_NAME_LEN (255 - HDE_FDESIZE - HDE_FUSIZE) - -/* Directory Entry (Directory Record) */ - -#define UNIX_TO_HDE_DATE(t,p) parse_unixdate(t, p) /* return val at p */ - -/* macros to get the address of each field */ -#define HDE_dir_len(x) (&((u_char *)x)[0]) -#define HDE_xar_len(x) (&((u_char *)x)[1]) -#define HDE_ext_lbn(x) (&((u_char *)x)[2]) -#define HDE_ext_size(x) (&((u_char *)x)[10]) -#define HDE_cdate(x) (&((u_char *)x)[18]) -#define HDE_flags(x) (&((u_char *)x)[24]) -#define HDE_reserved(x) (&((u_char *)x)[25]) -#define HDE_intrlv_size(x) (&((u_char *)x)[26]) -#define HDE_intrlv_skip(x) (&((u_char *)x)[27]) -#define HDE_vol_set(x) (&((u_char *)x)[28]) -#define HDE_name_len(x) (&((u_char *)x)[32]) -#define HDE_name(x) (&((u_char *)x)[33]) - -/***UNIX extension****/ -#define HDE_mode(x) (&((u_char *)x)[0]) -#define HDE_uid(x) (&((u_char *)x)[4]) -#define HDE_gid(x) (&((u_char *)x)[8]) - -/* 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_EXT_LBN(x) BOTH_INT(HDE_ext_lbn(x)) -#define HDE_EXT_SIZE(x) BOTH_INT(HDE_ext_size(x)) -#define HDE_CDATE(x) HDE_cdate(x) -#define HDE_FLAGS(x) *(HDE_flags(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_VOL_SET(x) BOTH_SHORT(HDE_vol_set(x)) -#define HDE_NAME_LEN(x) *(HDE_name_len(x)) -#define HDE_NAME(x) HDE_name(x) - -/***UNIX EXTENSION*****/ -#define HDE_MODE(x) *(HDE_mode(x)) -#define HDE_UID(x) *(HDE_uid(x)) -#define HDE_GID(x) *(HDE_gid(x)) - -/* mask bits for HDE_FLAGS */ -#define HDE_EXISTENCE 0x01 /* zero if file exists */ -#define HDE_DIRECTORY 0x02 /* zero if file is not a directory */ -#define HDE_ASSOCIATED 0x04 /* zero if file is not Associated */ -#define HDE_RECORD 0x08 /* zero if no record attributes */ -#define HDE_PROTECTION 0x10 /* zero if no protection attributes */ -#define HDE_UNUSED_FLAGS 0x60 -#define HDE_LAST_EXTENT 0x80 /* zero if last extent in file */ -#define HDE_PROHIBITED (HDE_DIRECTORY | HDE_ASSOCIATED | HDE_RECORD | \ - HDE_LAST_EXTENT | HDE_UNUSED_FLAGS) - -/* Directory Record date fields */ -#define HDE_DATE_YEAR(x) (((u_char *)x)[0] + 1900) -#define HDE_DATE_MONTH(x) (((u_char *)x)[1]) -#define HDE_DATE_DAY(x) (((u_char *)x)[2]) -#define HDE_DATE_HOUR(x) (((u_char *)x)[3]) -#define HDE_DATE_MIN(x) (((u_char *)x)[4]) -#define HDE_DATE_SEC(x) (((u_char *)x)[5]) - -/* tests for Interchange Levels 1 & 2 file types */ -#define HDE_REGULAR_FILE(x) (((x) & HDE_PROHIBITED) == 0) -#define HDE_REGULAR_DIR(x) (((x) & HDE_PROHIBITED) == HDE_DIRECTORY) - -#define HS_DIR_NAMELEN 31 /* max length of a directory name */ -#define HS_FILE_NAMELEN 31 /* max length of a filename */ - -#endif /*!_HSFS_SPEC_H_*/ diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/fstyp/iso_impl.h --- a/usr/src/cmd/fs.d/hsfs/fstyp/iso_impl.h Thu Jul 12 05:32:45 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ -/************************************************************************** - * - * iso_impl.h internal macros for /usr/etc/fs/HSFS/mkproto - * - ***************************************************************************/ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Macros for counting and rounding. - */ -#ifdef howmany -#undef howmany -#endif - -#if defined(sun386) || defined(i386) -#define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) -#define roundup(x, y) ((((u_int)(x)+((u_int)(y)-1))/(u_int)(y))*(u_int)(y)) -#else -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#endif - -extern int cdout; -extern int set_size; -extern int set_seq; -extern int blk_size; -extern int nlbn_per_sec; -extern char u[], v[]; -extern long unix_voldesc_sec; -extern int prototype; - -#define PUTSECTOR(buf, secno, nosec) (putdisk(buf, (secno)*ISO_SECTOR_SIZE, \ - (nosec)*ISO_SECTOR_SIZE)) -#define GETSECTOR(buf, secno, nosec) (getdisk(buf, (secno)*ISO_SECTOR_SIZE, \ - (nosec)*ISO_SECTOR_SIZE)) -#define PUTLBN(buf, secno, nosec) (putdisk(buf, (secno)*blk_size, \ - (nosec)*blk_size)) -#define GETLBN(buf, lbn, nolbn) (getdisk(buf, (lbn)*blk_size, \ - (nolbn)*blk_size)) -#define LBN_TO_SEC(lbn) ((lbn)/nlbn_per_sec) -#define SEC_TO_LBN(sec) ((sec)*nlbn_per_sec) -#define LBN_TO_BYTE(lbn) ((lbn)*blk_size) -#define BYTE_TO_SEC(byte) (byte/ISO_SECTOR_SIZE) - -#define CD_UNIX 0 -#define CD_ISO 1 - -#define CD_MSB 0 -#define CD_LSB 1 - -#define CD_REGULAR 1 -#define CD_FILE 2 -#define CD_DIRECTORY 4 -#define CD_DOT 8 -#define CD_DOTDOT 16 - -#define UNIX_VOLDESC_SEC ISO_VOLDESC_SEC+1 - -/* internal data structure */ -/* unix file info - to be copied to a cd-rom image */ -struct ufname { - int fsize; /* size of file in byte */ - char fname[1]; /* file name, should be longer */ -}; - -/* dlist - individual element of a directory tree */ -struct dlist { - struct dlist *dnext; /* point to next */ - struct dlist *pdp; /* point to parent */ - struct dlist *cdp; /* point to child */ - struct dlist *ucdp; /* point to first unix child */ - struct dlist *icdp; /* point to first iso child */ - struct dlist *unext; /* pointer to next in UNIX fname order */ - struct dlist *inext; /* pointer to next in ISO fname order */ - struct dlist *idirnext; /* pointer to next dir in iso, breadth first order */ - struct dlist *udirnext; /* pointer to next dir in unix, breadth first order */ - int idno; /* directory number in iso, in breadth first order */ - int udno; /* directory number in unix, in breadth first order */ - int ipoffset; /* offset in iso path table - directory only */ - int upoffset; /* offset in unix path table - directory only */ - int idlbn; /* lbn of parent in iso directory */ - int idoffset; /* offset of parent in iso directory */ - int udlbn; /* lbn of parent in unix directory */ - int udoffset; /* offset of parent in unix directory */ - int idextlbn; /* lbn of extent in iso */ - int udextlbn; /* lbn of extent in unix */ - int idsize; /* iso directory size */ - int udsize; /* unix directory size */ - int extlbn; /* location of the data */ - int fsize; /* size of the data */ - time_t mtime; /* las modification time */ - long duid; /* owner's user id */ - long dgid; /* owner's group id */ - long dmode; /* mode and type of file */ - long nlink; /* no. of links */ - struct ufname *ufnp; /* pointer to the corresponding UNIX file */ - char isofname[32]; /* iso file name */ - char unixfname[1]; /* unix file name, should be longer */ -}; - -void update_pvd(); -void update_uvd(); -void update_pvd_ptbl(); -void update_uvd_ptbl(); - -struct dlist * mkdlist(); -struct dlist * mkdlist_proto(); -struct dlist * mkdlist_path(); -void sortdlist(); - - diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/fstyp/iso_spec.h --- a/usr/src/cmd/fs.d/hsfs/fstyp/iso_spec.h Thu Jul 12 05:32:45 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,359 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 - -/* routines required for date parsing */ -extern struct timeval iso_parse_dirdate(); /* parse date in directory */ -extern struct timeval iso__parse_longdate(); /* parse date in volume id */ - -/* macros to parse binary integers */ -#define ZERO(x) (u_int) (((u_char *)(x))[0]) -#define ONE(x) (u_int) (((u_char *)(x))[1]) -#define TWO(x) (u_int) (((u_char *)(x))[2]) -#define THREE(x) (u_int) (((u_char *)(x))[3]) - -#define MSB_INT(x) \ - ((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x)) -#define LSB_INT(x) \ - ((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x)) -#define MSB_SHORT(x) ((ZERO(x) << 8) | ONE(x)) -#define LSB_SHORT(x) ((ONE(x) << 8) | ZERO(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) -#define BOTH_INT(x) LSB_INT(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 -#error One of _BIG_ENDIAN and _LITTLE_ENDIAN must be defined -#endif - -/* - * conversions to/from little endian format - */ -#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 */ -#define ltohs(S) LSB_SHORT((char *) (S)) -#define ltohl(L) LSB_INT((char *) (L)) -#define htols(S) LSB_SHORT((char *) (S)) -#define htoll(L) LSB_INT((char *) (L)) -#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_SECTOR_SIZE 2048 /* bytes per logical sector */ -#define ISO_SECTOR_SHIFT 11 /* sector<->byte shift count */ -#define ISO_SEC_PER_PAGE (PAGESIZE/HS_SECTOR_SIZE) /* sectors per page */ -#define ISO_SYSAREA_SEC 0 /* 1st sector of system area */ -#define ISO_VOLDESC_SEC 16 /* 1st sector of volume descriptors */ -#define MAXISOOFFSET (ISO_SECTOR_SIZE - 1) -#define MAXISOMASK (~MAXISOOFFSET) - - -/* Standard File Structure Volume Descriptor */ - -enum iso_voldesc_type { - ISO_VD_BOOT=0, ISO_VD_PVD=1, ISO_VD_SVD=2, ISO_VD_VPD=3, - ISO_VD_UNIX=4, /* UNIX extension */ - ISO_VD_EOV=255 -}; -#define ISO_ID_STRING "CD001" /* ISO_std_id field */ -#define ISO_ID_STRLEN 5 /* ISO_std_id field length */ -#define ISO_ID_VER 1 /* ISO_std_ver field */ -#define ISO_FILE_STRUCT_ID_VER 1 /* ISO_file structure version field */ -#define ISO_DATE_TO_UNIX(x) iso_parse_longdate(x) /* returns a timeval */ -#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]) -#define ISO_std_id(x) (&((u_char *)x)[1]) -#define ISO_std_ver(x) (&((u_char *)x)[6]) -#define ISO_sys_id(x) (&((u_char *)x)[8]) -#define ISO_vol_id(x) (&((u_char *)x)[40]) -#define ISO_vol_size(x) (&((u_char *)x)[80]) -#define ISO_set_size(x) (&((u_char *)x)[120]) -#define ISO_set_seq(x) (&((u_char *)x)[124]) -#define ISO_blk_size(x) (&((u_char *)x)[128]) -#define ISO_ptbl_size(x) (&((u_char *)x)[132]) -#define ISO_ptbl_man_ls(x) (&((u_char *)x)[140]) -#define ISO_ptbl_opt_ls1(x) (&((u_char *)x)[144]) -#define ISO_ptbl_man_ms(x) (&((u_char *)x)[148]) -#define ISO_ptbl_opt_ms1(x) (&((u_char *)x)[152]) -#define ISO_root_dir(x) (&((u_char *)x)[156]) -#define ISO_vol_set_id(x) (&((u_char *)x)[190]) -#define ISO_pub_id(x) (&((u_char *)x)[318]) -#define ISO_prep_id(x) (&((u_char *)x)[446]) -#define ISO_appl_id(x) (&((u_char *)x)[574]) -#define ISO_copyr_id(x) (&((u_char *)x)[702]) -#define ISO_abstr_id(x) (&((u_char *)x)[739]) -#define ISO_bibli_id(x) (&((u_char *)x)[776]) -#define ISO_cre_date(x) (&((u_char *)x)[813]) -#define ISO_mod_date(x) (&((u_char *)x)[830]) -#define ISO_exp_date(x) (&((u_char *)x)[847]) -#define ISO_eff_date(x) (&((u_char *)x)[864]) -#define ISO_file_struct_ver(x) (&((u_char *)x)[881]) - -/* macros to get the values of each field (strings are returned as ptrs) */ -#define ISO_DESC_TYPE(x) ((enum hs_voldesc_type)*(ISO_desc_type(x))) -#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_VOL_SIZE(x) BOTH_INT(ISO_vol_size(x)) -#define ISO_SET_SIZE(x) BOTH_SHORT(ISO_set_size(x)) -#define ISO_SET_SEQ(x) BOTH_SHORT(ISO_set_seq(x)) -#define ISO_BLK_SIZE(x) BOTH_SHORT(ISO_blk_size(x)) -#define ISO_PTBL_SIZE(x) BOTH_INT(ISO_ptbl_size(x)) -#define ISO_PTBL_MAN_LS(x) LSB_INT(ISO_ptbl_man_ls(x)) -#define ISO_PTBL_OPT_LS1(x) LSB_INT(ISO_ptbl_opt_ls1(x)) -#define ISO_PTBL_MAN_MS(x) MSB_INT(ISO_ptbl_man_ms(x)) -#define ISO_PTBL_OPT_MS1(x) MSB_INT(ISO_ptbl_opt_ms1(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_CRE_DATE(x) ISO_DATE_TO_UNIX(HSV_cre_date(x)) -#define ISO_MOD_DATE(x) ISO_DATE_TO_UNIX(HSV_mod_date(x)) -#define ISO_EXP_DATE(x) ISO_DATE_TO_UNIX(HSV_exp_date(x)) -#define ISO_EFF_DATE(x) ISO_DATE_TO_UNIX(HSV_eff_date(x)) -#define ISO_FILE_STRUCT_VER(x) *(ISO_file_struct_ver(x)) - -/* Standard File Structure Volume Descriptor date fields */ -#define ISO_DATE_2DIG(x) ( (((x)[0] - '0') * 10) + \ - ((x)[1] - '0') ) -#define ISO_DATE_4DIG(x) ( (((x)[0] - '0') * 1000) + \ - (((x)[1] - '0') * 100) + \ - (((x)[2] - '0') * 10) + \ - ((x)[3] - '0') ) -#define ISO_DATE_YEAR(x) ISO_DATE_4DIG(&((u_char *)x)[0]) -#define ISO_DATE_MONTH(x) ISO_DATE_2DIG(&((u_char *)x)[4]) -#define ISO_DATE_DAY(x) ISO_DATE_2DIG(&((u_char *)x)[6]) -#define ISO_DATE_HOUR(x) ISO_DATE_2DIG(&((u_char *)x)[8]) -#define ISO_DATE_MIN(x) ISO_DATE_2DIG(&((u_char *)x)[10]) -#define ISO_DATE_SEC(x) ISO_DATE_2DIG(&((u_char *)x)[12]) -#define ISO_DATE_HSEC(x) ISO_DATE_2DIG(&((u_char *)x)[14]) - - - -/* Directory Entry (Directory Record) */ -#define IDE_ROOT_DIR_REC_SIZE 34 /* size of root directory record */ -#define IDE_FDESIZE 33 /* fixed size for hsfs directory area */ - /* max size of a name */ -#define IDE_MAX_NAME_LEN (255 - IDE_FDESIZE) - - -#define IDE_DATE_TO_UNIX(x) iso_parse_dirdate(x) /* returns a timeval */ - -/* macros to get the address of each field */ -#define IDE_dir_len(x) (&((u_char *)x)[0]) -#define IDE_xar_len(x) (&((u_char *)x)[1]) -#define IDE_ext_lbn(x) (&((u_char *)x)[2]) -#define IDE_ext_size(x) (&((u_char *)x)[10]) -#define IDE_cdate(x) (&((u_char *)x)[18]) -#define IDE_flags(x) (&((u_char *)x)[25]) -#define IDE_intrlv_size(x) (&((u_char *)x)[26]) -#define IDE_intrlv_skip(x) (&((u_char *)x)[27]) -#define IDE_vol_set(x) (&((u_char *)x)[28]) -#define IDE_name_len(x) (&((u_char *)x)[32]) -#define IDE_name(x) (&((u_char *)x)[33]) - -/* 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_EXT_LBN(x) BOTH_INT(IDE_ext_lbn(x)) -#define IDE_EXT_SIZE(x) BOTH_INT(IDE_ext_size(x)) -#define IDE_CDATE(x) IDE_DATE_TO_UNIX(HDE_cdate(x)) -#define IDE_FLAGS(x) *(IDE_flags(x)) -#define IDE_INTRLV_SIZE(x) *(IDE_intrlv_size(x)) -#define IDE_INTRLV_SKIP(x) *(IDE_intrlv_skip(x)) -#define IDE_VOL_SET(x) BOTH_SHORT(IDE_vol_set(x)) -#define IDE_NAME_LEN(x) *(IDE_name_len(x)) -#define IDE_NAME(x) IDE_name(x) - -/* mask bits for IDE_FLAGS */ -#define IDE_EXISTENCE 0x01 /* zero if file exists */ -#define IDE_DIRECTORY 0x02 /* zero if file is not a directory */ -#define IDE_ASSOCIATED 0x04 /* zero if file is not Associated */ -#define IDE_RECORD 0x08 /* zero if no record attributes */ -#define IDE_PROTECTION 0x10 /* zero if no protection attributes */ -#define IDE_UNUSED_FLAGS 0x60 -#define IDE_LAST_EXTENT 0x80 /* zero if last extent in file */ -#define IDE_PROHIBITED (IDE_DIRECTORY | HDE_ASSOCIATED | HDE_RECORD | \ - IDE_LAST_EXTENT | IDE_UNUSED_FLAGS) - -/* Directory Record date fields */ -#define IDE_DATE_YEAR(x) (((u_char *)x)[0] + 1900) -#define IDE_DATE_MONTH(x) (((u_char *)x)[1]) -#define IDE_DATE_DAY(x) (((u_char *)x)[2]) -#define IDE_DATE_HOUR(x) (((u_char *)x)[3]) -#define IDE_DATE_MIN(x) (((u_char *)x)[4]) -#define IDE_DATE_SEC(x) (((u_char *)x)[5]) - -/* tests for Interchange Levels 1 & 2 file types */ -#define IDE_REGULAR_FILE(x) (((x) & IDE_PROHIBITED) == 0) -#define IDE_REGULAR_DIR(x) (((x) & IDE_PROHIBITED) == IDE_DIRECTORY) - -#define ISO_DIR_NAMELEN 31 /* max length of a directory name */ -#define ISO_FILE_NAMELEN 31 /* max length of a filename */ - -/* 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]) -#define IPE_xar_len(x) (&((u_char *)x)[1]) -#define IPE_ext_lbn(x) (&((u_char *)x)[2]) -#define IPE_parent_no(x) (&((u_char *)x)[6]) -#define IPE_name(x) (&((u_char *)x)[8]) - -/* macros to get the values of each field */ -#define IPE_EXT_LBN(x) (MSB_INT(IPE_ext_lbn(x))) -#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)) -#define IPE_NAME(x) IPE_name(x) - -/* cdrom UNIX extension */ -/* UNIX Volume Descriptor */ -#define ISO_UNIX_ID_STRING "UNIXCD01" /* ISO_UNIX_std_id field */ -#define ISO_UNIX_ID_STRLEN 8 /* ISO_UNIX_std_id length */ -#define ISO_UNIX_FEATURE_SYMLNK 0x01 /* CD-ROM supports symbolic links */ -#define ISO_UNIX_FEATURE_LONGFN 0x02 /* CD-ROM supports long BSD file names */ - -#define ISO_UNIX_feature(x) (&((u_char *)x)[7]) -#define ISO_UNIX_root_dir(x) (&((u_char *)x)[1395]) -#define ISO_UNIX_signature(x) (&((u_char *)x)[2040]) - -#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]) -#define IPE_UNIX_uid(x) (&((u_char *)x)[4]) -#define IPE_UNIX_gid(x) (&((u_char *)x)[8]) - -/* macros to get the values of each field */ -#define IPE_UNIX_MODE(x) (MSB_INT(IPE_UNIX_mode(x))) -#define IPE_UNIX_UID(x) (MSB_INT(IPE_UNIX_uid(x))) -#define IPE_UNIX_GID(x) (MSB_INT(IPE_UNIX_gid(x))) - -/* UNIX extension to directory entry */ -#define IDE_UNIX_SIG_UX "UX" /* UNIX extension signature */ -#define IDE_UNIX_SIG_TI "TI" /* UNIX extension signature for time */ -#define IDE_UNIX_USE_ID_VER 1 /* UNIX extension sys use id */ -#define IDE_UNIX_UX_LEN 36 /* length of UX */ -#define IDE_UNIX_TI_LEN 40 /* length of TI */ - -#define IDE_UNIX_signature(x) (&((u_char *)x)[0]) -#define IDE_UNIX_ext_len(x) (&((u_char *)x)[2]) -#define IDE_UNIX_use_id(x) (&((u_char *)x)[3]) -#define IDE_UNIX_mode(x) (&((u_char *)x)[4]) -#define IDE_UNIX_nlink(x) (&((u_char *)x)[12]) -#define IDE_UNIX_uid(x) (&((u_char *)x)[20]) -#define IDE_UNIX_gid(x) (&((u_char *)x)[28]) - - -#define IDE_UNIX_cre_date(x) (&((u_char *)x)[4]) -#define IDE_UNIX_mod_date(x) (&((u_char *)x)[11]) -#define IDE_UNIX_exp_date(x) (&((u_char *)x)[18]) -#define IDE_UNIX_eff_date(x) (&((u_char *)x)[25]) -#define IDE_UNIX_acc_date(x) (&((u_char *)x)[32]) -#define IDE_UNIX_reserved(x) (&((u_char *)x)[39]) - -#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_MODE(x) BOTH_INT(IDE_UNIX_mode(x)) -#define IDE_UNIX_NLINK(x) BOTH_INT(IDE_UNIX_nlink(x)) -#define IDE_UNIX_UID(x) BOTH_INT(IDE_UNIX_uid(x)) -#define IDE_UNIX_GID(x) BOTH_INT(IDE_UNIX_gid(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 */ -#define IDE_UNIX_ROOT_DIR_REC_SIZE 34+IDE_UNIX_UX_LEN -#define IDE_UNIX_MAX_NAME_LEN IDE_MAX_NAME_LEN - IDE_UNIX_UX_LEN - -#endif /*!_ISO_SPEC_H_*/ diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/labelit/hsfs_spec.h --- a/usr/src/cmd/fs.d/hsfs/labelit/hsfs_spec.h Thu Jul 12 05:32:45 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 - */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * High Sierra filesystem specification - * Copyright (c) 1989 by Sun Microsystem, Inc. - */ - -#ifndef _HSFS_SPEC_H_ -#define _HSFS_SPEC_H_ - -#include /* for ENDIAN defines */ - -/* routines required for date parsing */ -extern void hs_parse_dirdate(); /* parse date in directory */ -extern void hs_parse_longdate(); /* parse date in volume id */ - -/* macros to parse binary integers */ -#define ZERO(x) (u_int) (((u_char *)(x))[0]) -#define ONE(x) (u_int) (((u_char *)(x))[1]) -#define TWO(x) (u_int) (((u_char *)(x))[2]) -#define THREE(x) (u_int) (((u_char *)(x))[3]) - -#define MSB_INT(x) \ - ((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x)) -#define LSB_INT(x) \ - ((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x)) -#define MSB_SHORT(x) ((ZERO(x) << 8) | ONE(x)) -#define LSB_SHORT(x) ((ONE(x) << 8) | ZERO(x)) - -/* for sun 3 only */ -#if defined(_LITTLE_ENDIAN) -#define BOTH_SHORT(x) (short) *((short *)x) -#define BOTH_INT(x) (int) *((int *)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_SECTOR_SIZE 2048 /* bytes per logical sector */ -#define HS_SECTOR_SHIFT 11 /* sector<->byte shift count */ -#define HS_SEC_PER_PAGE (PAGESIZE/HS_SECTOR_SIZE) /* sectors per page */ -#define HS_SYSAREA_SEC 0 /* 1st sector of system area */ -#define HS_VOLDESC_SEC 16 /* 1st sector of volume descriptors */ -#define MAXHSOFFSET (HS_SECTOR_SIZE - 1) -#define MAXHSMASK (~MAXHSOFFSET) - -/* Standard File Structure Volume Descriptor */ - -enum hs_voldesc_type { - VD_BOOT=0, VD_SFS=1, VD_CCFS=2, VD_UNSPEC=3, VD_EOV=255 -}; -#define HSV_ID_STRING "CDROM" /* HSV_std_id field */ -#define HSV_ID_STRLEN 5 /* HSV_std_id field length */ -#define HSV_ID_VER 1 /* HSV_std_ver field */ -#define HSV_FILE_STRUCT_ID_VER 1 /* HSV_file_struct_ver field */ -#define HSV_SYS_ID_STRLEN 32 /* HSV_sys_id field length */ -#define HSV_VOL_ID_STRLEN 32 /* HSV_vol_id field length */ -#define HSV_VOL_SET_ID_STRLEN 128 /* HSV_vol_set_id field length */ -#define HSV_PUB_ID_STRLEN 128 /* HSV_pub_id field length */ -#define HSV_PREP_ID_STRLEN 128 /* HSV_prep_id field length */ -#define HSV_APPL_ID_STRLEN 128 /* HSV_appl_id field length */ -#define HSV_COPYR_ID_STRLEN 32 /* HSV_copyr_id field length */ -#define HSV_ABSTR_ID_STRLEN 32 /* HSV_abstr_id field length */ -#define HSV_DATE_LEN 16 /* HSV date filed length */ - -/* macros to get the address of each field */ -#define HSV_desc_lbn(x) (&((u_char *)x)[0]) -#define HSV_desc_type(x) (&((u_char *)x)[8]) -#define HSV_std_id(x) (&((u_char *)x)[9]) -#define HSV_std_ver(x) (&((u_char *)x)[14]) -#define HSV_sys_id(x) (&((u_char *)x)[16]) -#define HSV_vol_id(x) (&((u_char *)x)[48]) -#define HSV_vol_size(x) (&((u_char *)x)[88]) -#define HSV_set_size(x) (&((u_char *)x)[128]) -#define HSV_set_seq(x) (&((u_char *)x)[132]) -#define HSV_blk_size(x) (&((u_char *)x)[136]) -#define HSV_ptbl_size(x) (&((u_char *)x)[140]) -#define HSV_ptbl_man_ls(x) (&((u_char *)x)[148]) -#define HSV_ptbl_opt_ls1(x) (&((u_char *)x)[152]) -#define HSV_ptbl_opt_ls2(x) (&((u_char *)x)[156]) -#define HSV_ptbl_opt_ls3(x) (&((u_char *)x)[160]) -#define HSV_ptbl_man_ms(x) (&((u_char *)x)[164]) -#define HSV_ptbl_opt_ms1(x) (&((u_char *)x)[168]) -#define HSV_ptbl_opt_ms2(x) (&((u_char *)x)[172]) -#define HSV_ptbl_opt_ms3(x) (&((u_char *)x)[176]) -#define HSV_root_dir(x) (&((u_char *)x)[180]) -#define HSV_vol_set_id(x) (&((u_char *)x)[214]) -#define HSV_pub_id(x) (&((u_char *)x)[342]) -#define HSV_prep_id(x) (&((u_char *)x)[470]) -#define HSV_appl_id(x) (&((u_char *)x)[598]) -#define HSV_copyr_id(x) (&((u_char *)x)[726]) -#define HSV_abstr_id(x) (&((u_char *)x)[758]) -#define HSV_cre_date(x) (&((u_char *)x)[790]) -#define HSV_mod_date(x) (&((u_char *)x)[806]) -#define HSV_exp_date(x) (&((u_char *)x)[822]) -#define HSV_eff_date(x) (&((u_char *)x)[838]) -#define HSV_file_struct_ver(x) (&((u_char *)x)[854]) - -/* macros to get the values of each field (strings are returned as ptrs) */ -#define HSV_DESC_LBN(x) BOTH_INT(HSV_desc_lbn(x)) -#define HSV_DESC_TYPE(x) ((enum hs_voldesc_type)*(HSV_desc_type(x))) -#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_VOL_SIZE(x) BOTH_INT(HSV_vol_size(x)) -#define HSV_SET_SIZE(x) BOTH_SHORT(HSV_set_size(x)) -#define HSV_SET_SEQ(x) BOTH_SHORT(HSV_set_seq(x)) -#define HSV_BLK_SIZE(x) BOTH_SHORT(HSV_blk_size(x)) -#define HSV_PTBL_SIZE(x) BOTH_INT(HSV_ptbl_size(x)) -#define HSV_PTBL_MAN_LS(x) LSB_INT(HSV_ptbl_man_ls(x)) -#define HSV_PTBL_OPT_LS1(x) LSB_INT(HSV_ptbl_opt_ls1(x)) -#define HSV_PTBL_OPT_LS2(x) LSB_INT(HSV_ptbl_opt_ls2(x)) -#define HSV_PTBL_OPT_LS3(x) LSB_INT(HSV_ptbl_opt_ls3(x)) -#define HSV_PTBL_MAN_MS(x) MSB_INT(HSV_ptbl_man_ms(x)) -#define HSV_PTBL_OPT_MS1(x) MSB_INT(HSV_ptbl_opt_ms1(x)) -#define HSV_PTBL_OPT_MS2(x) MSB_INT(HSV_ptbl_opt_ms2(x)) -#define HSV_PTBL_OPT_MS3(x) MSB_INT(HSV_ptbl_opt_ms3(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 */ -#define HSV_DATE_2DIG(x) ( (((x)[0] - '0') * 10) + \ - ((x)[1] - '0') ) -#define HSV_DATE_4DIG(x) ( (((x)[0] - '0') * 1000) + \ - (((x)[1] - '0') * 100) + \ - (((x)[2] - '0') * 10) + \ - ((x)[3] - '0') ) -#define HSV_DATE_YEAR(x) HSV_DATE_4DIG(&((u_char *)x)[0]) -#define HSV_DATE_MONTH(x) HSV_DATE_2DIG(&((u_char *)x)[4]) -#define HSV_DATE_DAY(x) HSV_DATE_2DIG(&((u_char *)x)[6]) -#define HSV_DATE_HOUR(x) HSV_DATE_2DIG(&((u_char *)x)[8]) -#define HSV_DATE_MIN(x) HSV_DATE_2DIG(&((u_char *)x)[10]) -#define HSV_DATE_SEC(x) HSV_DATE_2DIG(&((u_char *)x)[12]) -#define HSV_DATE_HSEC(x) HSV_DATE_2DIG(&((u_char *)x)[14]) - -/* 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) (&((u_char *)x)[0]) -#define HPE_xar_len(x) (&((u_char *)x)[4]) -#define HPE_name_len(x) (&((u_char *)x)[5]) -#define HPE_parent_no(x) (&((u_char *)x)[6]) -#define HPE_name(x) (&((u_char *)x)[8]) - -/* macros to get the values of each field */ -#if sun4 -#define HPE_EXT_LBN(x) (MSB_INT(HPE_ext_lbn(x))) -#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)) -#define HPE_NAME(x) HPE_name(x) - -/* root record */ -#define HDE_ROOT_DIR_REC_SIZE 34 /* size of root directory record */ -#define HDE_FDESIZE 33 /* fixed size for hsfs directory area */ -#define HDE_FUSIZE 12 /* fixed size for unix areaa */ - /* max size of a name */ -#define HDE_MAX_NAME_LEN (255 - HDE_FDESIZE - HDE_FUSIZE) - -/* Directory Entry (Directory Record) */ - -#define UNIX_TO_HDE_DATE(t,p) parse_unixdate(t, p) /* return val at p */ - -/* macros to get the address of each field */ -#define HDE_dir_len(x) (&((u_char *)x)[0]) -#define HDE_xar_len(x) (&((u_char *)x)[1]) -#define HDE_ext_lbn(x) (&((u_char *)x)[2]) -#define HDE_ext_size(x) (&((u_char *)x)[10]) -#define HDE_cdate(x) (&((u_char *)x)[18]) -#define HDE_flags(x) (&((u_char *)x)[24]) -#define HDE_reserved(x) (&((u_char *)x)[25]) -#define HDE_intrlv_size(x) (&((u_char *)x)[26]) -#define HDE_intrlv_skip(x) (&((u_char *)x)[27]) -#define HDE_vol_set(x) (&((u_char *)x)[28]) -#define HDE_name_len(x) (&((u_char *)x)[32]) -#define HDE_name(x) (&((u_char *)x)[33]) - -/***UNIX extension****/ -#define HDE_mode(x) (&((u_char *)x)[0]) -#define HDE_uid(x) (&((u_char *)x)[4]) -#define HDE_gid(x) (&((u_char *)x)[8]) - -/* 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_EXT_LBN(x) BOTH_INT(HDE_ext_lbn(x)) -#define HDE_EXT_SIZE(x) BOTH_INT(HDE_ext_size(x)) -#define HDE_CDATE(x) HDE_cdate(x) -#define HDE_FLAGS(x) *(HDE_flags(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_VOL_SET(x) BOTH_SHORT(HDE_vol_set(x)) -#define HDE_NAME_LEN(x) *(HDE_name_len(x)) -#define HDE_NAME(x) HDE_name(x) - -/***UNIX EXTENSION*****/ -#define HDE_MODE(x) *(HDE_mode(x)) -#define HDE_UID(x) *(HDE_uid(x)) -#define HDE_GID(x) *(HDE_gid(x)) - -/* mask bits for HDE_FLAGS */ -#define HDE_EXISTENCE 0x01 /* zero if file exists */ -#define HDE_DIRECTORY 0x02 /* zero if file is not a directory */ -#define HDE_ASSOCIATED 0x04 /* zero if file is not Associated */ -#define HDE_RECORD 0x08 /* zero if no record attributes */ -#define HDE_PROTECTION 0x10 /* zero if no protection attributes */ -#define HDE_UNUSED_FLAGS 0x60 -#define HDE_LAST_EXTENT 0x80 /* zero if last extent in file */ -#define HDE_PROHIBITED (HDE_DIRECTORY | HDE_ASSOCIATED | HDE_RECORD | \ - HDE_LAST_EXTENT | HDE_UNUSED_FLAGS) - -/* Directory Record date fields */ -#define HDE_DATE_YEAR(x) (((u_char *)x)[0] + 1900) -#define HDE_DATE_MONTH(x) (((u_char *)x)[1]) -#define HDE_DATE_DAY(x) (((u_char *)x)[2]) -#define HDE_DATE_HOUR(x) (((u_char *)x)[3]) -#define HDE_DATE_MIN(x) (((u_char *)x)[4]) -#define HDE_DATE_SEC(x) (((u_char *)x)[5]) - -/* tests for Interchange Levels 1 & 2 file types */ -#define HDE_REGULAR_FILE(x) (((x) & HDE_PROHIBITED) == 0) -#define HDE_REGULAR_DIR(x) (((x) & HDE_PROHIBITED) == HDE_DIRECTORY) - -#define HS_DIR_NAMELEN 31 /* max length of a directory name */ -#define HS_FILE_NAMELEN 31 /* max length of a filename */ - -#endif /*!_HSFS_SPEC_H_*/ diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/labelit/iso_impl.h --- a/usr/src/cmd/fs.d/hsfs/labelit/iso_impl.h Thu Jul 12 05:32:45 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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. - */ -/************************************************************************** - * - * iso_impl.h internal macros for /usr/etc/fs/HSFS/mkproto - * - ***************************************************************************/ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Macros for counting and rounding. - */ -#ifdef howmany -#undef howmany -#endif - -#if defined(sun386) || defined(i386) -#define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) -#define roundup(x, y) ((((u_int)(x)+((u_int)(y)-1))/(u_int)(y))*(u_int)(y)) -#else -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#endif - -extern int cdout; -extern int set_size; -extern int set_seq; -extern int blk_size; -extern int nlbn_per_sec; -extern char u[], v[]; -extern long unix_voldesc_sec; -extern int prototype; - -#define PUTSECTOR(buf, secno, nosec) (putdisk(buf, (secno)*ISO_SECTOR_SIZE, \ - (nosec)*ISO_SECTOR_SIZE)) -#define GETSECTOR(buf, secno, nosec) (getdisk(buf, (secno)*ISO_SECTOR_SIZE, \ - (nosec)*ISO_SECTOR_SIZE)) -#define PUTLBN(buf, secno, nosec) (putdisk(buf, (secno)*blk_size, \ - (nosec)*blk_size)) -#define GETLBN(buf, lbn, nolbn) (getdisk(buf, (lbn)*blk_size, \ - (nolbn)*blk_size)) -#define LBN_TO_SEC(lbn) ((lbn)/nlbn_per_sec) -#define SEC_TO_LBN(sec) ((sec)*nlbn_per_sec) -#define LBN_TO_BYTE(lbn) ((lbn)*blk_size) -#define BYTE_TO_SEC(byte) (byte/ISO_SECTOR_SIZE) - -#define CD_UNIX 0 -#define CD_ISO 1 - -#define CD_MSB 0 -#define CD_LSB 1 - -#define CD_REGULAR 1 -#define CD_FILE 2 -#define CD_DIRECTORY 4 -#define CD_DOT 8 -#define CD_DOTDOT 16 - -#define UNIX_VOLDESC_SEC ISO_VOLDESC_SEC+1 - -/* internal data structure */ -/* unix file info - to be copied to a cd-rom image */ -struct ufname { - int fsize; /* size of file in byte */ - char fname[1]; /* file name, should be longer */ -}; - -/* dlist - individual element of a directory tree */ -struct dlist { - struct dlist *dnext; /* point to next */ - struct dlist *pdp; /* point to parent */ - struct dlist *cdp; /* point to child */ - struct dlist *ucdp; /* point to first unix child */ - struct dlist *icdp; /* point to first iso child */ - struct dlist *unext; /* pointer to next in UNIX fname order */ - struct dlist *inext; /* pointer to next in ISO fname order */ - struct dlist *idirnext; /* pointer to next dir in iso, breadth first order */ - struct dlist *udirnext; /* pointer to next dir in unix, breadth first order */ - int idno; /* directory number in iso, in breadth first order */ - int udno; /* directory number in unix, in breadth first order */ - int ipoffset; /* offset in iso path table - directory only */ - int upoffset; /* offset in unix path table - directory only */ - int idlbn; /* lbn of parent in iso directory */ - int idoffset; /* offset of parent in iso directory */ - int udlbn; /* lbn of parent in unix directory */ - int udoffset; /* offset of parent in unix directory */ - int idextlbn; /* lbn of extent in iso */ - int udextlbn; /* lbn of extent in unix */ - int idsize; /* iso directory size */ - int udsize; /* unix directory size */ - int extlbn; /* location of the data */ - int fsize; /* size of the data */ - time_t mtime; /* las modification time */ - long duid; /* owner's user id */ - long dgid; /* owner's group id */ - long dmode; /* mode and type of file */ - long nlink; /* no. of links */ - struct ufname *ufnp; /* pointer to the corresponding UNIX file */ - char isofname[32]; /* iso file name */ - char unixfname[1]; /* unix file name, should be longer */ -}; - -void update_pvd(); -void update_uvd(); -void update_pvd_ptbl(); -void update_uvd_ptbl(); - -struct dlist * mkdlist(); -struct dlist * mkdlist_proto(); -struct dlist * mkdlist_path(); -void sortdlist(); - - diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/labelit/iso_spec.h --- a/usr/src/cmd/fs.d/hsfs/labelit/iso_spec.h Thu Jul 12 05:32:45 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,359 +0,0 @@ -/* - * 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 - * or http://www.opensolaris.org/os/licensing. - * 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 2005 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 - -/* routines required for date parsing */ -extern struct timeval iso_parse_dirdate(); /* parse date in directory */ -extern struct timeval iso__parse_longdate(); /* parse date in volume id */ - -/* macros to parse binary integers */ -#define ZERO(x) (u_int) (((u_char *)(x))[0]) -#define ONE(x) (u_int) (((u_char *)(x))[1]) -#define TWO(x) (u_int) (((u_char *)(x))[2]) -#define THREE(x) (u_int) (((u_char *)(x))[3]) - -#define MSB_INT(x) \ - ((((((ZERO(x) << 8) | ONE(x)) << 8) | TWO(x)) << 8) | THREE(x)) -#define LSB_INT(x) \ - ((((((THREE(x) << 8) | TWO(x)) << 8) | ONE(x)) << 8) | ZERO(x)) -#define MSB_SHORT(x) ((ZERO(x) << 8) | ONE(x)) -#define LSB_SHORT(x) ((ONE(x) << 8) | ZERO(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) -#define BOTH_INT(x) LSB_INT(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 -#error One of _BIG_ENDIAN and _LITTLE_ENDIAN must be defined -#endif - -/* - * conversions to/from little endian format - */ -#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 */ -#define ltohs(S) LSB_SHORT((char *) (S)) -#define ltohl(L) LSB_INT((char *) (L)) -#define htols(S) LSB_SHORT((char *) (S)) -#define htoll(L) LSB_INT((char *) (L)) -#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_SECTOR_SIZE 2048 /* bytes per logical sector */ -#define ISO_SECTOR_SHIFT 11 /* sector<->byte shift count */ -#define ISO_SEC_PER_PAGE (PAGESIZE/HS_SECTOR_SIZE) /* sectors per page */ -#define ISO_SYSAREA_SEC 0 /* 1st sector of system area */ -#define ISO_VOLDESC_SEC 16 /* 1st sector of volume descriptors */ -#define MAXISOOFFSET (ISO_SECTOR_SIZE - 1) -#define MAXISOMASK (~MAXISOOFFSET) - - -/* Standard File Structure Volume Descriptor */ - -enum iso_voldesc_type { - ISO_VD_BOOT=0, ISO_VD_PVD=1, ISO_VD_SVD=2, ISO_VD_VPD=3, - ISO_VD_UNIX=4, /* UNIX extension */ - ISO_VD_EOV=255 -}; -#define ISO_ID_STRING "CD001" /* ISO_std_id field */ -#define ISO_ID_STRLEN 5 /* ISO_std_id field length */ -#define ISO_ID_VER 1 /* ISO_std_ver field */ -#define ISO_FILE_STRUCT_ID_VER 1 /* ISO_file structure version field */ -#define ISO_DATE_TO_UNIX(x) iso_parse_longdate(x) /* returns a timeval */ -#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]) -#define ISO_std_id(x) (&((u_char *)x)[1]) -#define ISO_std_ver(x) (&((u_char *)x)[6]) -#define ISO_sys_id(x) (&((u_char *)x)[8]) -#define ISO_vol_id(x) (&((u_char *)x)[40]) -#define ISO_vol_size(x) (&((u_char *)x)[80]) -#define ISO_set_size(x) (&((u_char *)x)[120]) -#define ISO_set_seq(x) (&((u_char *)x)[124]) -#define ISO_blk_size(x) (&((u_char *)x)[128]) -#define ISO_ptbl_size(x) (&((u_char *)x)[132]) -#define ISO_ptbl_man_ls(x) (&((u_char *)x)[140]) -#define ISO_ptbl_opt_ls1(x) (&((u_char *)x)[144]) -#define ISO_ptbl_man_ms(x) (&((u_char *)x)[148]) -#define ISO_ptbl_opt_ms1(x) (&((u_char *)x)[152]) -#define ISO_root_dir(x) (&((u_char *)x)[156]) -#define ISO_vol_set_id(x) (&((u_char *)x)[190]) -#define ISO_pub_id(x) (&((u_char *)x)[318]) -#define ISO_prep_id(x) (&((u_char *)x)[446]) -#define ISO_appl_id(x) (&((u_char *)x)[574]) -#define ISO_copyr_id(x) (&((u_char *)x)[702]) -#define ISO_abstr_id(x) (&((u_char *)x)[739]) -#define ISO_bibli_id(x) (&((u_char *)x)[776]) -#define ISO_cre_date(x) (&((u_char *)x)[813]) -#define ISO_mod_date(x) (&((u_char *)x)[830]) -#define ISO_exp_date(x) (&((u_char *)x)[847]) -#define ISO_eff_date(x) (&((u_char *)x)[864]) -#define ISO_file_struct_ver(x) (&((u_char *)x)[881]) - -/* macros to get the values of each field (strings are returned as ptrs) */ -#define ISO_DESC_TYPE(x) ((enum hs_voldesc_type)*(ISO_desc_type(x))) -#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_VOL_SIZE(x) BOTH_INT(ISO_vol_size(x)) -#define ISO_SET_SIZE(x) BOTH_SHORT(ISO_set_size(x)) -#define ISO_SET_SEQ(x) BOTH_SHORT(ISO_set_seq(x)) -#define ISO_BLK_SIZE(x) BOTH_SHORT(ISO_blk_size(x)) -#define ISO_PTBL_SIZE(x) BOTH_INT(ISO_ptbl_size(x)) -#define ISO_PTBL_MAN_LS(x) LSB_INT(ISO_ptbl_man_ls(x)) -#define ISO_PTBL_OPT_LS1(x) LSB_INT(ISO_ptbl_opt_ls1(x)) -#define ISO_PTBL_MAN_MS(x) MSB_INT(ISO_ptbl_man_ms(x)) -#define ISO_PTBL_OPT_MS1(x) MSB_INT(ISO_ptbl_opt_ms1(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_CRE_DATE(x) ISO_DATE_TO_UNIX(HSV_cre_date(x)) -#define ISO_MOD_DATE(x) ISO_DATE_TO_UNIX(HSV_mod_date(x)) -#define ISO_EXP_DATE(x) ISO_DATE_TO_UNIX(HSV_exp_date(x)) -#define ISO_EFF_DATE(x) ISO_DATE_TO_UNIX(HSV_eff_date(x)) -#define ISO_FILE_STRUCT_VER(x) *(ISO_file_struct_ver(x)) - -/* Standard File Structure Volume Descriptor date fields */ -#define ISO_DATE_2DIG(x) ( (((x)[0] - '0') * 10) + \ - ((x)[1] - '0') ) -#define ISO_DATE_4DIG(x) ( (((x)[0] - '0') * 1000) + \ - (((x)[1] - '0') * 100) + \ - (((x)[2] - '0') * 10) + \ - ((x)[3] - '0') ) -#define ISO_DATE_YEAR(x) ISO_DATE_4DIG(&((u_char *)x)[0]) -#define ISO_DATE_MONTH(x) ISO_DATE_2DIG(&((u_char *)x)[4]) -#define ISO_DATE_DAY(x) ISO_DATE_2DIG(&((u_char *)x)[6]) -#define ISO_DATE_HOUR(x) ISO_DATE_2DIG(&((u_char *)x)[8]) -#define ISO_DATE_MIN(x) ISO_DATE_2DIG(&((u_char *)x)[10]) -#define ISO_DATE_SEC(x) ISO_DATE_2DIG(&((u_char *)x)[12]) -#define ISO_DATE_HSEC(x) ISO_DATE_2DIG(&((u_char *)x)[14]) - - - -/* Directory Entry (Directory Record) */ -#define IDE_ROOT_DIR_REC_SIZE 34 /* size of root directory record */ -#define IDE_FDESIZE 33 /* fixed size for hsfs directory area */ - /* max size of a name */ -#define IDE_MAX_NAME_LEN (255 - IDE_FDESIZE) - - -#define IDE_DATE_TO_UNIX(x) iso_parse_dirdate(x) /* returns a timeval */ - -/* macros to get the address of each field */ -#define IDE_dir_len(x) (&((u_char *)x)[0]) -#define IDE_xar_len(x) (&((u_char *)x)[1]) -#define IDE_ext_lbn(x) (&((u_char *)x)[2]) -#define IDE_ext_size(x) (&((u_char *)x)[10]) -#define IDE_cdate(x) (&((u_char *)x)[18]) -#define IDE_flags(x) (&((u_char *)x)[25]) -#define IDE_intrlv_size(x) (&((u_char *)x)[26]) -#define IDE_intrlv_skip(x) (&((u_char *)x)[27]) -#define IDE_vol_set(x) (&((u_char *)x)[28]) -#define IDE_name_len(x) (&((u_char *)x)[32]) -#define IDE_name(x) (&((u_char *)x)[33]) - -/* 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_EXT_LBN(x) BOTH_INT(IDE_ext_lbn(x)) -#define IDE_EXT_SIZE(x) BOTH_INT(IDE_ext_size(x)) -#define IDE_CDATE(x) IDE_DATE_TO_UNIX(HDE_cdate(x)) -#define IDE_FLAGS(x) *(IDE_flags(x)) -#define IDE_INTRLV_SIZE(x) *(IDE_intrlv_size(x)) -#define IDE_INTRLV_SKIP(x) *(IDE_intrlv_skip(x)) -#define IDE_VOL_SET(x) BOTH_SHORT(IDE_vol_set(x)) -#define IDE_NAME_LEN(x) *(IDE_name_len(x)) -#define IDE_NAME(x) IDE_name(x) - -/* mask bits for IDE_FLAGS */ -#define IDE_EXISTENCE 0x01 /* zero if file exists */ -#define IDE_DIRECTORY 0x02 /* zero if file is not a directory */ -#define IDE_ASSOCIATED 0x04 /* zero if file is not Associated */ -#define IDE_RECORD 0x08 /* zero if no record attributes */ -#define IDE_PROTECTION 0x10 /* zero if no protection attributes */ -#define IDE_UNUSED_FLAGS 0x60 -#define IDE_LAST_EXTENT 0x80 /* zero if last extent in file */ -#define IDE_PROHIBITED (IDE_DIRECTORY | HDE_ASSOCIATED | HDE_RECORD | \ - IDE_LAST_EXTENT | IDE_UNUSED_FLAGS) - -/* Directory Record date fields */ -#define IDE_DATE_YEAR(x) (((u_char *)x)[0] + 1900) -#define IDE_DATE_MONTH(x) (((u_char *)x)[1]) -#define IDE_DATE_DAY(x) (((u_char *)x)[2]) -#define IDE_DATE_HOUR(x) (((u_char *)x)[3]) -#define IDE_DATE_MIN(x) (((u_char *)x)[4]) -#define IDE_DATE_SEC(x) (((u_char *)x)[5]) - -/* tests for Interchange Levels 1 & 2 file types */ -#define IDE_REGULAR_FILE(x) (((x) & IDE_PROHIBITED) == 0) -#define IDE_REGULAR_DIR(x) (((x) & IDE_PROHIBITED) == IDE_DIRECTORY) - -#define ISO_DIR_NAMELEN 31 /* max length of a directory name */ -#define ISO_FILE_NAMELEN 31 /* max length of a filename */ - -/* 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]) -#define IPE_xar_len(x) (&((u_char *)x)[1]) -#define IPE_ext_lbn(x) (&((u_char *)x)[2]) -#define IPE_parent_no(x) (&((u_char *)x)[6]) -#define IPE_name(x) (&((u_char *)x)[8]) - -/* macros to get the values of each field */ -#define IPE_EXT_LBN(x) (MSB_INT(IPE_ext_lbn(x))) -#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)) -#define IPE_NAME(x) IPE_name(x) - -/* cdrom UNIX extension */ -/* UNIX Volume Descriptor */ -#define ISO_UNIX_ID_STRING "UNIXCD01" /* ISO_UNIX_std_id field */ -#define ISO_UNIX_ID_STRLEN 8 /* ISO_UNIX_std_id length */ -#define ISO_UNIX_FEATURE_SYMLNK 0x01 /* CD-ROM supports symbolic links */ -#define ISO_UNIX_FEATURE_LONGFN 0x02 /* CD-ROM supports long BSD file names */ - -#define ISO_UNIX_feature(x) (&((u_char *)x)[7]) -#define ISO_UNIX_root_dir(x) (&((u_char *)x)[1395]) -#define ISO_UNIX_signature(x) (&((u_char *)x)[2040]) - -#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]) -#define IPE_UNIX_uid(x) (&((u_char *)x)[4]) -#define IPE_UNIX_gid(x) (&((u_char *)x)[8]) - -/* macros to get the values of each field */ -#define IPE_UNIX_MODE(x) (MSB_INT(IPE_UNIX_mode(x))) -#define IPE_UNIX_UID(x) (MSB_INT(IPE_UNIX_uid(x))) -#define IPE_UNIX_GID(x) (MSB_INT(IPE_UNIX_gid(x))) - -/* UNIX extension to directory entry */ -#define IDE_UNIX_SIG_UX "UX" /* UNIX extension signature */ -#define IDE_UNIX_SIG_TI "TI" /* UNIX extension signature for time */ -#define IDE_UNIX_USE_ID_VER 1 /* UNIX extension sys use id */ -#define IDE_UNIX_UX_LEN 36 /* length of UX */ -#define IDE_UNIX_TI_LEN 40 /* length of TI */ - -#define IDE_UNIX_signature(x) (&((u_char *)x)[0]) -#define IDE_UNIX_ext_len(x) (&((u_char *)x)[2]) -#define IDE_UNIX_use_id(x) (&((u_char *)x)[3]) -#define IDE_UNIX_mode(x) (&((u_char *)x)[4]) -#define IDE_UNIX_nlink(x) (&((u_char *)x)[12]) -#define IDE_UNIX_uid(x) (&((u_char *)x)[20]) -#define IDE_UNIX_gid(x) (&((u_char *)x)[28]) - - -#define IDE_UNIX_cre_date(x) (&((u_char *)x)[4]) -#define IDE_UNIX_mod_date(x) (&((u_char *)x)[11]) -#define IDE_UNIX_exp_date(x) (&((u_char *)x)[18]) -#define IDE_UNIX_eff_date(x) (&((u_char *)x)[25]) -#define IDE_UNIX_acc_date(x) (&((u_char *)x)[32]) -#define IDE_UNIX_reserved(x) (&((u_char *)x)[39]) - -#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_MODE(x) BOTH_INT(IDE_UNIX_mode(x)) -#define IDE_UNIX_NLINK(x) BOTH_INT(IDE_UNIX_nlink(x)) -#define IDE_UNIX_UID(x) BOTH_INT(IDE_UNIX_uid(x)) -#define IDE_UNIX_GID(x) BOTH_INT(IDE_UNIX_gid(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 */ -#define IDE_UNIX_ROOT_DIR_REC_SIZE 34+IDE_UNIX_UX_LEN -#define IDE_UNIX_MAX_NAME_LEN IDE_MAX_NAME_LEN - IDE_UNIX_UX_LEN - -#endif /*!_ISO_SPEC_H_*/ diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/cmd/fs.d/hsfs/labelit/labelit.c --- a/usr/src/cmd/fs.d/hsfs/labelit/labelit.c Thu Jul 12 05:32:45 2012 -0700 +++ b/usr/src/cmd/fs.d/hsfs/labelit/labelit.c Thu Jun 28 04:06:54 2012 +0100 @@ -38,9 +38,6 @@ * bibfile: bibliographic file identifier (d-charcters, 37 max) */ -#pragma ident "%Z%%M% %I% %E% SMI" - - #include #include #include @@ -49,9 +46,9 @@ #include #include #include -#include "hsfs_spec.h" -#include "iso_spec.h" -#include "iso_impl.h" + +#include +#include #define PUTSECTOR(buf, secno, nosec) (putdisk(buf, (secno)*ISO_SECTOR_SIZE, \ (nosec)*ISO_SECTOR_SIZE)) @@ -157,7 +154,9 @@ if ((cdfd = open(argv[c], openopt)) < 0) { if (strchr(argv[c], '=') || - strchr(argv[c], '-')) usage(); + strchr(argv[c], '-')) { + usage(); + } sprintf(errstrng, "%s: main: open(): ", callname); perror(errstrng); exit(32); @@ -185,7 +184,7 @@ usage(void) { fprintf(stderr, "usage: %s [-F ufs] [option=value ...] cdimage\n", - callname); + callname); exit(32); } diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/uts/common/fs/hsfs/hsfs_vfsops.c --- a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c Thu Jul 12 05:32:45 2012 -0700 +++ b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c Thu Jun 28 04:06:54 2012 +0100 @@ -1156,8 +1156,7 @@ * To avoid that we read the whole medium in case that someone prepares * a malicious "fs image", we read at most 32 blocks. */ - for (n = 0; n < 32 && - (enum iso_voldesc_type) ISO_DESC_TYPE(volp) != ISO_VD_EOV; n++) { + for (n = 0; n < 32 && ISO_DESC_TYPE(volp) != ISO_VD_EOV; n++) { for (i = 0; i < ISO_ID_STRLEN; i++) if (ISO_STD_ID(volp)[i] != ISO_ID_STRING[i]) goto cantfind; diff -r df4cd82e2b60 -r 6c5d0718e821 usr/src/uts/common/sys/fs/hsfs_isospec.h --- a/usr/src/uts/common/sys/fs/hsfs_isospec.h Thu Jul 12 05:32:45 2012 -0700 +++ b/usr/src/uts/common/sys/fs/hsfs_isospec.h Thu Jun 28 04:06:54 2012 +0100 @@ -26,8 +26,6 @@ #ifndef _SYS_FS_HSFS_ISOSPEC_H #define _SYS_FS_HSFS_ISOSPEC_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ISO 9660 filesystem specification */ @@ -87,6 +85,7 @@ enum iso_voldesc_type { ISO_VD_BOOT = 0, ISO_VD_PVD = 1, ISO_VD_SVD = 2, ISO_VD_VPD = 3, + ISO_VD_UNIX = 4, /* UNIX extension */ ISO_VD_EOV = 255 }; #define ISO_ID_STRING "CD001" /* ISO_std_id field */ @@ -138,7 +137,7 @@ #define ISO_file_struct_ver(x) (&((uchar_t *)x)[881]) /* macros to get the values of each field (strings are returned as ptrs) */ -#define ISO_DESC_TYPE(x) ((enum hs_voldesc_type)*(ISO_desc_type(x))) +#define ISO_DESC_TYPE(x) ((enum iso_voldesc_type)*(ISO_desc_type(x))) #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)