1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2000 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 /************************************************************************** 27 * 28 * iso_impl.h internal macros for /usr/etc/fs/HSFS/mkproto 29 * 30 ***************************************************************************/ 31 32 #pragma ident "%Z%%M% %I% %E% SMI" 33 34 /* 35 * Macros for counting and rounding. 36 */ 37 #ifdef howmany 38 #undef howmany 39 #endif 40 41 #if defined(sun386) || defined(i386) 42 #define howmany(x, y) ((((u_int)(x))+(((u_int)(y))-1))/((u_int)(y))) 43 #define roundup(x, y) ((((u_int)(x)+((u_int)(y)-1))/(u_int)(y))*(u_int)(y)) 44 #else 45 #define howmany(x, y) (((x)+((y)-1))/(y)) 46 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) 47 #endif 48 49 extern int cdout; 50 extern int set_size; 51 extern int set_seq; 52 extern int blk_size; 53 extern int nlbn_per_sec; 54 extern char u[], v[]; 55 extern long unix_voldesc_sec; 56 extern int prototype; 57 58 #define PUTSECTOR(buf, secno, nosec) (putdisk(buf, (secno)*ISO_SECTOR_SIZE, \ 59 (nosec)*ISO_SECTOR_SIZE)) 60 #define GETSECTOR(buf, secno, nosec) (getdisk(buf, (secno)*ISO_SECTOR_SIZE, \ 61 (nosec)*ISO_SECTOR_SIZE)) 62 #define PUTLBN(buf, secno, nosec) (putdisk(buf, (secno)*blk_size, \ 63 (nosec)*blk_size)) 64 #define GETLBN(buf, lbn, nolbn) (getdisk(buf, (lbn)*blk_size, \ 65 (nolbn)*blk_size)) 66 #define LBN_TO_SEC(lbn) ((lbn)/nlbn_per_sec) 67 #define SEC_TO_LBN(sec) ((sec)*nlbn_per_sec) 68 #define LBN_TO_BYTE(lbn) ((lbn)*blk_size) 69 #define BYTE_TO_SEC(byte) (byte/ISO_SECTOR_SIZE) 70 71 #define CD_UNIX 0 72 #define CD_ISO 1 73 74 #define CD_MSB 0 75 #define CD_LSB 1 76 77 #define CD_REGULAR 1 78 #define CD_FILE 2 79 #define CD_DIRECTORY 4 80 #define CD_DOT 8 81 #define CD_DOTDOT 16 82 83 #define UNIX_VOLDESC_SEC ISO_VOLDESC_SEC+1 84 85 /* internal data structure */ 86 /* unix file info - to be copied to a cd-rom image */ 87 struct ufname { 88 int fsize; /* size of file in byte */ 89 char fname[1]; /* file name, should be longer */ 90 }; 91 92 /* dlist - individual element of a directory tree */ 93 struct dlist { 94 struct dlist *dnext; /* point to next */ 95 struct dlist *pdp; /* point to parent */ 96 struct dlist *cdp; /* point to child */ 97 struct dlist *ucdp; /* point to first unix child */ 98 struct dlist *icdp; /* point to first iso child */ 99 struct dlist *unext; /* pointer to next in UNIX fname order */ 100 struct dlist *inext; /* pointer to next in ISO fname order */ 101 struct dlist *idirnext; /* pointer to next dir in iso, breadth first order */ 102 struct dlist *udirnext; /* pointer to next dir in unix, breadth first order */ 103 int idno; /* directory number in iso, in breadth first order */ 104 int udno; /* directory number in unix, in breadth first order */ 105 int ipoffset; /* offset in iso path table - directory only */ 106 int upoffset; /* offset in unix path table - directory only */ 107 int idlbn; /* lbn of parent in iso directory */ 108 int idoffset; /* offset of parent in iso directory */ 109 int udlbn; /* lbn of parent in unix directory */ 110 int udoffset; /* offset of parent in unix directory */ 111 int idextlbn; /* lbn of extent in iso */ 112 int udextlbn; /* lbn of extent in unix */ 113 int idsize; /* iso directory size */ 114 int udsize; /* unix directory size */ 115 int extlbn; /* location of the data */ 116 int fsize; /* size of the data */ 117 time_t mtime; /* las modification time */ 118 long duid; /* owner's user id */ 119 long dgid; /* owner's group id */ 120 long dmode; /* mode and type of file */ 121 long nlink; /* no. of links */ 122 struct ufname *ufnp; /* pointer to the corresponding UNIX file */ 123 char isofname[32]; /* iso file name */ 124 char unixfname[1]; /* unix file name, should be longer */ 125 }; 126 127 void update_pvd(); 128 void update_uvd(); 129 void update_pvd_ptbl(); 130 void update_uvd_ptbl(); 131 132 struct dlist * mkdlist(); 133 struct dlist * mkdlist_proto(); 134 struct dlist * mkdlist_path(); 135 void sortdlist(); 136 137 138