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