1df8bae1dSRodney W. Grimes /*- 2df8bae1dSRodney W. Grimes * Copyright (c) 1993, 1994 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * This code is derived from software contributed to Berkeley 6df8bae1dSRodney W. Grimes * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7df8bae1dSRodney W. Grimes * Support code is derived from software contributed to Berkeley 8df8bae1dSRodney W. Grimes * by Atsushi Murai (amurai@spec.co.jp). 9df8bae1dSRodney W. Grimes * 10df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 11df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 12df8bae1dSRodney W. Grimes * are met: 13df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 14df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 15df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 16df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 17df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 18df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 19df8bae1dSRodney W. Grimes * must display the following acknowledgement: 20df8bae1dSRodney W. Grimes * This product includes software developed by the University of 21df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 22df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 23df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 24df8bae1dSRodney W. Grimes * without specific prior written permission. 25df8bae1dSRodney W. Grimes * 26df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36df8bae1dSRodney W. Grimes * SUCH DAMAGE. 37df8bae1dSRodney W. Grimes * 38996c772fSJohn Dyson * @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94 39c3aac50fSPeter Wemm * $FreeBSD$ 40df8bae1dSRodney W. Grimes */ 41df8bae1dSRodney W. Grimes 42df8bae1dSRodney W. Grimes #include <sys/param.h> 431dbaf90cSBruce Evans #include <sys/systm.h> 449626b608SPoul-Henning Kamp #include <sys/bio.h> 45df8bae1dSRodney W. Grimes #include <sys/buf.h> 46df8bae1dSRodney W. Grimes #include <sys/vnode.h> 47df8bae1dSRodney W. Grimes #include <sys/mount.h> 48df8bae1dSRodney W. Grimes #include <sys/kernel.h> 49df8bae1dSRodney W. Grimes 50df8bae1dSRodney W. Grimes #include <isofs/cd9660/iso.h> 51df8bae1dSRodney W. Grimes #include <isofs/cd9660/cd9660_node.h> 52df8bae1dSRodney W. Grimes #include <isofs/cd9660/cd9660_rrip.h> 53df8bae1dSRodney W. Grimes #include <isofs/cd9660/iso_rrip.h> 54df8bae1dSRodney W. Grimes 5589c9a483SAlfred Perlstein typedef int rrt_func_t(void *, ISO_RRIP_ANALYZE *ana); 5610dd32cdSBruce Evans 5710dd32cdSBruce Evans typedef struct { 5810dd32cdSBruce Evans char type[2]; 5910dd32cdSBruce Evans rrt_func_t *func; 6089c9a483SAlfred Perlstein void (*func2)(struct iso_directory_record *isodir, ISO_RRIP_ANALYZE *ana); 6110dd32cdSBruce Evans int result; 6210dd32cdSBruce Evans } RRIP_TABLE; 6310dd32cdSBruce Evans 6489c9a483SAlfred Perlstein static int cd9660_rrip_altname(ISO_RRIP_ALTNAME *p, ISO_RRIP_ANALYZE *ana); 6589c9a483SAlfred Perlstein static int cd9660_rrip_attr(ISO_RRIP_ATTR *p, ISO_RRIP_ANALYZE *ana); 6689c9a483SAlfred Perlstein static int cd9660_rrip_cont(ISO_RRIP_CONT *p, ISO_RRIP_ANALYZE *ana); 6789c9a483SAlfred Perlstein static void cd9660_rrip_defattr(struct iso_directory_record *isodir, 6889c9a483SAlfred Perlstein ISO_RRIP_ANALYZE *ana); 6989c9a483SAlfred Perlstein static void cd9660_rrip_defname(struct iso_directory_record *isodir, 7089c9a483SAlfred Perlstein ISO_RRIP_ANALYZE *ana); 7189c9a483SAlfred Perlstein static void cd9660_rrip_deftstamp(struct iso_directory_record *isodir, 7289c9a483SAlfred Perlstein ISO_RRIP_ANALYZE *ana); 7389c9a483SAlfred Perlstein static int cd9660_rrip_device(ISO_RRIP_DEVICE *p, ISO_RRIP_ANALYZE *ana); 7489c9a483SAlfred Perlstein static int cd9660_rrip_extref(ISO_RRIP_EXTREF *p, ISO_RRIP_ANALYZE *ana); 7589c9a483SAlfred Perlstein static int cd9660_rrip_idflag(ISO_RRIP_IDFLAG *p, ISO_RRIP_ANALYZE *ana); 7689c9a483SAlfred Perlstein static int cd9660_rrip_loop(struct iso_directory_record *isodir, 7769c59d87SBruce Evans ISO_RRIP_ANALYZE *ana, RRIP_TABLE *table); 7889c9a483SAlfred Perlstein static int cd9660_rrip_pclink(ISO_RRIP_CLINK *p, ISO_RRIP_ANALYZE *ana); 7989c9a483SAlfred Perlstein static int cd9660_rrip_reldir(ISO_RRIP_RELDIR *p, ISO_RRIP_ANALYZE *ana); 8089c9a483SAlfred Perlstein static int cd9660_rrip_slink(ISO_RRIP_SLINK *p, ISO_RRIP_ANALYZE *ana); 8189c9a483SAlfred Perlstein static int cd9660_rrip_stop(ISO_SUSP_HEADER *p, ISO_RRIP_ANALYZE *ana); 8289c9a483SAlfred Perlstein static int cd9660_rrip_tstamp(ISO_RRIP_TSTAMP *p, ISO_RRIP_ANALYZE *ana); 8310dd32cdSBruce Evans 84df8bae1dSRodney W. Grimes /* 85df8bae1dSRodney W. Grimes * POSIX file attribute 86df8bae1dSRodney W. Grimes */ 87df8bae1dSRodney W. Grimes static int 88df8bae1dSRodney W. Grimes cd9660_rrip_attr(p,ana) 89df8bae1dSRodney W. Grimes ISO_RRIP_ATTR *p; 90df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 91df8bae1dSRodney W. Grimes { 92996c772fSJohn Dyson ana->inop->inode.iso_mode = isonum_733(p->mode); 93996c772fSJohn Dyson ana->inop->inode.iso_uid = isonum_733(p->uid); 94996c772fSJohn Dyson ana->inop->inode.iso_gid = isonum_733(p->gid); 95996c772fSJohn Dyson ana->inop->inode.iso_links = isonum_733(p->links); 96df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_ATTR; 97df8bae1dSRodney W. Grimes return ISO_SUSP_ATTR; 98df8bae1dSRodney W. Grimes } 99df8bae1dSRodney W. Grimes 100df8bae1dSRodney W. Grimes static void 101df8bae1dSRodney W. Grimes cd9660_rrip_defattr(isodir,ana) 102df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 103df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 104df8bae1dSRodney W. Grimes { 105df8bae1dSRodney W. Grimes /* But this is a required field! */ 106df8bae1dSRodney W. Grimes printf("RRIP without PX field?\n"); 107988fa8efSJoerg Wunsch cd9660_defattr(isodir,ana->inop,NULL,ISO_FTYPE_RRIP); 108df8bae1dSRodney W. Grimes } 109df8bae1dSRodney W. Grimes 110df8bae1dSRodney W. Grimes /* 111df8bae1dSRodney W. Grimes * Symbolic Links 112df8bae1dSRodney W. Grimes */ 113df8bae1dSRodney W. Grimes static int 114df8bae1dSRodney W. Grimes cd9660_rrip_slink(p,ana) 115df8bae1dSRodney W. Grimes ISO_RRIP_SLINK *p; 116df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 117df8bae1dSRodney W. Grimes { 118df8bae1dSRodney W. Grimes register ISO_RRIP_SLINK_COMPONENT *pcomp; 119df8bae1dSRodney W. Grimes register ISO_RRIP_SLINK_COMPONENT *pcompe; 120df8bae1dSRodney W. Grimes int len, wlen, cont; 121df8bae1dSRodney W. Grimes char *outbuf, *inbuf; 122df8bae1dSRodney W. Grimes 123df8bae1dSRodney W. Grimes pcomp = (ISO_RRIP_SLINK_COMPONENT *)p->component; 124df8bae1dSRodney W. Grimes pcompe = (ISO_RRIP_SLINK_COMPONENT *)((char *)p + isonum_711(p->h.length)); 125df8bae1dSRodney W. Grimes len = *ana->outlen; 126df8bae1dSRodney W. Grimes outbuf = ana->outbuf; 127df8bae1dSRodney W. Grimes cont = ana->cont; 128df8bae1dSRodney W. Grimes 129df8bae1dSRodney W. Grimes /* 130df8bae1dSRodney W. Grimes * Gathering a Symbolic name from each component with path 131df8bae1dSRodney W. Grimes */ 132df8bae1dSRodney W. Grimes for (; 133df8bae1dSRodney W. Grimes pcomp < pcompe; 134df8bae1dSRodney W. Grimes pcomp = (ISO_RRIP_SLINK_COMPONENT *)((char *)pcomp + ISO_RRIP_SLSIZ 135df8bae1dSRodney W. Grimes + isonum_711(pcomp->clen))) { 136df8bae1dSRodney W. Grimes 137df8bae1dSRodney W. Grimes if (!cont) { 138df8bae1dSRodney W. Grimes if (len < ana->maxlen) { 139df8bae1dSRodney W. Grimes len++; 140df8bae1dSRodney W. Grimes *outbuf++ = '/'; 141df8bae1dSRodney W. Grimes } 142df8bae1dSRodney W. Grimes } 143df8bae1dSRodney W. Grimes cont = 0; 144df8bae1dSRodney W. Grimes 145df8bae1dSRodney W. Grimes inbuf = ".."; 146df8bae1dSRodney W. Grimes wlen = 0; 147df8bae1dSRodney W. Grimes 148df8bae1dSRodney W. Grimes switch (*pcomp->cflag) { 149df8bae1dSRodney W. Grimes 150df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_CURRENT: 151df8bae1dSRodney W. Grimes /* Inserting Current */ 152df8bae1dSRodney W. Grimes wlen = 1; 153df8bae1dSRodney W. Grimes break; 154df8bae1dSRodney W. Grimes 155df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_PARENT: 156df8bae1dSRodney W. Grimes /* Inserting Parent */ 157df8bae1dSRodney W. Grimes wlen = 2; 158df8bae1dSRodney W. Grimes break; 159df8bae1dSRodney W. Grimes 160df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_ROOT: 161df8bae1dSRodney W. Grimes /* Inserting slash for ROOT */ 162df8bae1dSRodney W. Grimes /* start over from beginning(?) */ 163df8bae1dSRodney W. Grimes outbuf -= len; 164df8bae1dSRodney W. Grimes len = 0; 165df8bae1dSRodney W. Grimes break; 166df8bae1dSRodney W. Grimes 167df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_VOLROOT: 168df8bae1dSRodney W. Grimes /* Inserting a mount point i.e. "/cdrom" */ 169df8bae1dSRodney W. Grimes /* same as above */ 170df8bae1dSRodney W. Grimes outbuf -= len; 171df8bae1dSRodney W. Grimes len = 0; 172df8bae1dSRodney W. Grimes inbuf = ana->imp->im_mountp->mnt_stat.f_mntonname; 173df8bae1dSRodney W. Grimes wlen = strlen(inbuf); 174df8bae1dSRodney W. Grimes break; 175df8bae1dSRodney W. Grimes 176df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_HOST: 177df8bae1dSRodney W. Grimes /* Inserting hostname i.e. "kurt.tools.de" */ 178df8bae1dSRodney W. Grimes inbuf = hostname; 1799565c0e6SPoul-Henning Kamp wlen = strlen(hostname); 180df8bae1dSRodney W. Grimes break; 181df8bae1dSRodney W. Grimes 182df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_CONTINUE: 183df8bae1dSRodney W. Grimes cont = 1; 184df8bae1dSRodney W. Grimes /* fall thru */ 185df8bae1dSRodney W. Grimes case 0: 186df8bae1dSRodney W. Grimes /* Inserting component */ 187df8bae1dSRodney W. Grimes wlen = isonum_711(pcomp->clen); 188df8bae1dSRodney W. Grimes inbuf = pcomp->name; 189df8bae1dSRodney W. Grimes break; 190df8bae1dSRodney W. Grimes default: 191df8bae1dSRodney W. Grimes printf("RRIP with incorrect flags?"); 192df8bae1dSRodney W. Grimes wlen = ana->maxlen + 1; 193df8bae1dSRodney W. Grimes break; 194df8bae1dSRodney W. Grimes } 195df8bae1dSRodney W. Grimes 196df8bae1dSRodney W. Grimes if (len + wlen > ana->maxlen) { 197df8bae1dSRodney W. Grimes /* indicate error to caller */ 198df8bae1dSRodney W. Grimes ana->cont = 1; 199df8bae1dSRodney W. Grimes ana->fields = 0; 200df8bae1dSRodney W. Grimes ana->outbuf -= *ana->outlen; 201df8bae1dSRodney W. Grimes *ana->outlen = 0; 202df8bae1dSRodney W. Grimes return 0; 203df8bae1dSRodney W. Grimes } 204df8bae1dSRodney W. Grimes 205df8bae1dSRodney W. Grimes bcopy(inbuf,outbuf,wlen); 206df8bae1dSRodney W. Grimes outbuf += wlen; 207df8bae1dSRodney W. Grimes len += wlen; 208df8bae1dSRodney W. Grimes 209df8bae1dSRodney W. Grimes } 210df8bae1dSRodney W. Grimes ana->outbuf = outbuf; 211df8bae1dSRodney W. Grimes *ana->outlen = len; 212df8bae1dSRodney W. Grimes ana->cont = cont; 213df8bae1dSRodney W. Grimes 214df8bae1dSRodney W. Grimes if (!isonum_711(p->flags)) { 215df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_SLINK; 216df8bae1dSRodney W. Grimes return ISO_SUSP_SLINK; 217df8bae1dSRodney W. Grimes } 218df8bae1dSRodney W. Grimes return 0; 219df8bae1dSRodney W. Grimes } 220df8bae1dSRodney W. Grimes 221df8bae1dSRodney W. Grimes /* 222df8bae1dSRodney W. Grimes * Alternate name 223df8bae1dSRodney W. Grimes */ 224df8bae1dSRodney W. Grimes static int 225df8bae1dSRodney W. Grimes cd9660_rrip_altname(p,ana) 226df8bae1dSRodney W. Grimes ISO_RRIP_ALTNAME *p; 227df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 228df8bae1dSRodney W. Grimes { 229df8bae1dSRodney W. Grimes char *inbuf; 230df8bae1dSRodney W. Grimes int wlen; 231df8bae1dSRodney W. Grimes int cont; 232df8bae1dSRodney W. Grimes 233df8bae1dSRodney W. Grimes inbuf = ".."; 234df8bae1dSRodney W. Grimes wlen = 0; 235df8bae1dSRodney W. Grimes cont = 0; 236df8bae1dSRodney W. Grimes 237df8bae1dSRodney W. Grimes switch (*p->flags) { 238df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_CURRENT: 239df8bae1dSRodney W. Grimes /* Inserting Current */ 240df8bae1dSRodney W. Grimes wlen = 1; 241df8bae1dSRodney W. Grimes break; 242df8bae1dSRodney W. Grimes 243df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_PARENT: 244df8bae1dSRodney W. Grimes /* Inserting Parent */ 245df8bae1dSRodney W. Grimes wlen = 2; 246df8bae1dSRodney W. Grimes break; 247df8bae1dSRodney W. Grimes 248df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_HOST: 249df8bae1dSRodney W. Grimes /* Inserting hostname i.e. "kurt.tools.de" */ 250df8bae1dSRodney W. Grimes inbuf = hostname; 2519565c0e6SPoul-Henning Kamp wlen = strlen(hostname); 252df8bae1dSRodney W. Grimes break; 253df8bae1dSRodney W. Grimes 254df8bae1dSRodney W. Grimes case ISO_SUSP_CFLAG_CONTINUE: 255df8bae1dSRodney W. Grimes cont = 1; 256df8bae1dSRodney W. Grimes /* fall thru */ 257df8bae1dSRodney W. Grimes case 0: 258df8bae1dSRodney W. Grimes /* Inserting component */ 259df8bae1dSRodney W. Grimes wlen = isonum_711(p->h.length) - 5; 260df8bae1dSRodney W. Grimes inbuf = (char *)p + 5; 261df8bae1dSRodney W. Grimes break; 262df8bae1dSRodney W. Grimes 263df8bae1dSRodney W. Grimes default: 264df8bae1dSRodney W. Grimes printf("RRIP with incorrect NM flags?\n"); 265df8bae1dSRodney W. Grimes wlen = ana->maxlen + 1; 266df8bae1dSRodney W. Grimes break; 267df8bae1dSRodney W. Grimes } 268df8bae1dSRodney W. Grimes 269df8bae1dSRodney W. Grimes if ((*ana->outlen += wlen) > ana->maxlen) { 270df8bae1dSRodney W. Grimes /* treat as no name field */ 271df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_ALTNAME; 272df8bae1dSRodney W. Grimes ana->outbuf -= *ana->outlen - wlen; 273df8bae1dSRodney W. Grimes *ana->outlen = 0; 274df8bae1dSRodney W. Grimes return 0; 275df8bae1dSRodney W. Grimes } 276df8bae1dSRodney W. Grimes 277df8bae1dSRodney W. Grimes bcopy(inbuf,ana->outbuf,wlen); 278df8bae1dSRodney W. Grimes ana->outbuf += wlen; 279df8bae1dSRodney W. Grimes 280df8bae1dSRodney W. Grimes if (!cont) { 281df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_ALTNAME; 282df8bae1dSRodney W. Grimes return ISO_SUSP_ALTNAME; 283df8bae1dSRodney W. Grimes } 284df8bae1dSRodney W. Grimes return 0; 285df8bae1dSRodney W. Grimes } 286df8bae1dSRodney W. Grimes 287df8bae1dSRodney W. Grimes static void 288df8bae1dSRodney W. Grimes cd9660_rrip_defname(isodir,ana) 289df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 290df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 291df8bae1dSRodney W. Grimes { 292df8bae1dSRodney W. Grimes isofntrans(isodir->name,isonum_711(isodir->name_len), 293df8bae1dSRodney W. Grimes ana->outbuf,ana->outlen, 29444e568e2SDaniel C. Sobral 1,isonum_711(isodir->flags)&4, ana->imp->joliet_level); 29544e568e2SDaniel C. Sobral switch (*ana->outbuf) { 29644e568e2SDaniel C. Sobral default: 297df8bae1dSRodney W. Grimes break; 298df8bae1dSRodney W. Grimes case 1: 299df8bae1dSRodney W. Grimes *ana->outlen = 2; 30044e568e2SDaniel C. Sobral /* FALL THROUGH */ 30144e568e2SDaniel C. Sobral case 0: 30244e568e2SDaniel C. Sobral /* outlen is 1 already */ 30344e568e2SDaniel C. Sobral strcpy(ana->outbuf,".."); 304df8bae1dSRodney W. Grimes break; 305df8bae1dSRodney W. Grimes } 306df8bae1dSRodney W. Grimes } 307df8bae1dSRodney W. Grimes 308df8bae1dSRodney W. Grimes /* 309df8bae1dSRodney W. Grimes * Parent or Child Link 310df8bae1dSRodney W. Grimes */ 311df8bae1dSRodney W. Grimes static int 312df8bae1dSRodney W. Grimes cd9660_rrip_pclink(p,ana) 313df8bae1dSRodney W. Grimes ISO_RRIP_CLINK *p; 314df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 315df8bae1dSRodney W. Grimes { 316df8bae1dSRodney W. Grimes *ana->inump = isonum_733(p->dir_loc) << ana->imp->im_bshift; 317df8bae1dSRodney W. Grimes ana->fields &= ~(ISO_SUSP_CLINK|ISO_SUSP_PLINK); 318df8bae1dSRodney W. Grimes return *p->h.type == 'C' ? ISO_SUSP_CLINK : ISO_SUSP_PLINK; 319df8bae1dSRodney W. Grimes } 320df8bae1dSRodney W. Grimes 321df8bae1dSRodney W. Grimes /* 322df8bae1dSRodney W. Grimes * Relocated directory 323df8bae1dSRodney W. Grimes */ 324df8bae1dSRodney W. Grimes static int 325df8bae1dSRodney W. Grimes cd9660_rrip_reldir(p,ana) 326df8bae1dSRodney W. Grimes ISO_RRIP_RELDIR *p; 327df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 328df8bae1dSRodney W. Grimes { 329df8bae1dSRodney W. Grimes /* special hack to make caller aware of RE field */ 330df8bae1dSRodney W. Grimes *ana->outlen = 0; 331df8bae1dSRodney W. Grimes ana->fields = 0; 332df8bae1dSRodney W. Grimes return ISO_SUSP_RELDIR|ISO_SUSP_ALTNAME|ISO_SUSP_CLINK|ISO_SUSP_PLINK; 333df8bae1dSRodney W. Grimes } 334df8bae1dSRodney W. Grimes 335df8bae1dSRodney W. Grimes static int 336df8bae1dSRodney W. Grimes cd9660_rrip_tstamp(p,ana) 337df8bae1dSRodney W. Grimes ISO_RRIP_TSTAMP *p; 338df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 339df8bae1dSRodney W. Grimes { 340996c772fSJohn Dyson u_char *ptime; 341df8bae1dSRodney W. Grimes 342df8bae1dSRodney W. Grimes ptime = p->time; 343df8bae1dSRodney W. Grimes 344df8bae1dSRodney W. Grimes /* Check a format of time stamp (7bytes/17bytes) */ 345df8bae1dSRodney W. Grimes if (!(*p->flags&ISO_SUSP_TSTAMP_FORM17)) { 346df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_CREAT) 347df8bae1dSRodney W. Grimes ptime += 7; 348df8bae1dSRodney W. Grimes 349df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) { 350988fa8efSJoerg Wunsch cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime, 351988fa8efSJoerg Wunsch ISO_FTYPE_RRIP); 352df8bae1dSRodney W. Grimes ptime += 7; 353df8bae1dSRodney W. Grimes } else 3541dbaf90cSBruce Evans bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec)); 355df8bae1dSRodney W. Grimes 356df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) { 357988fa8efSJoerg Wunsch cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime, 358988fa8efSJoerg Wunsch ISO_FTYPE_RRIP); 359df8bae1dSRodney W. Grimes ptime += 7; 360df8bae1dSRodney W. Grimes } else 361df8bae1dSRodney W. Grimes ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime; 362df8bae1dSRodney W. Grimes 363df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_ATTR) 364988fa8efSJoerg Wunsch cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime, 365988fa8efSJoerg Wunsch ISO_FTYPE_RRIP); 366df8bae1dSRodney W. Grimes else 367df8bae1dSRodney W. Grimes ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; 368df8bae1dSRodney W. Grimes 369df8bae1dSRodney W. Grimes } else { 370df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_CREAT) 371df8bae1dSRodney W. Grimes ptime += 17; 372df8bae1dSRodney W. Grimes 373df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) { 374df8bae1dSRodney W. Grimes cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_mtime); 375df8bae1dSRodney W. Grimes ptime += 17; 376df8bae1dSRodney W. Grimes } else 3771dbaf90cSBruce Evans bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec)); 378df8bae1dSRodney W. Grimes 379df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) { 380df8bae1dSRodney W. Grimes cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_atime); 381df8bae1dSRodney W. Grimes ptime += 17; 382df8bae1dSRodney W. Grimes } else 383df8bae1dSRodney W. Grimes ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime; 384df8bae1dSRodney W. Grimes 385df8bae1dSRodney W. Grimes if (*p->flags&ISO_SUSP_TSTAMP_ATTR) 386df8bae1dSRodney W. Grimes cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_ctime); 387df8bae1dSRodney W. Grimes else 388df8bae1dSRodney W. Grimes ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; 389df8bae1dSRodney W. Grimes 390df8bae1dSRodney W. Grimes } 391df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_TSTAMP; 392df8bae1dSRodney W. Grimes return ISO_SUSP_TSTAMP; 393df8bae1dSRodney W. Grimes } 394df8bae1dSRodney W. Grimes 395df8bae1dSRodney W. Grimes static void 396df8bae1dSRodney W. Grimes cd9660_rrip_deftstamp(isodir,ana) 397df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 398df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 399df8bae1dSRodney W. Grimes { 400988fa8efSJoerg Wunsch cd9660_deftstamp(isodir,ana->inop,NULL,ISO_FTYPE_RRIP); 401df8bae1dSRodney W. Grimes } 402df8bae1dSRodney W. Grimes 403df8bae1dSRodney W. Grimes /* 404df8bae1dSRodney W. Grimes * POSIX device modes 405df8bae1dSRodney W. Grimes */ 406df8bae1dSRodney W. Grimes static int 407df8bae1dSRodney W. Grimes cd9660_rrip_device(p,ana) 408df8bae1dSRodney W. Grimes ISO_RRIP_DEVICE *p; 409df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 410df8bae1dSRodney W. Grimes { 411996c772fSJohn Dyson u_int high, low; 412df8bae1dSRodney W. Grimes 413996c772fSJohn Dyson high = isonum_733(p->dev_t_high); 414996c772fSJohn Dyson low = isonum_733(p->dev_t_low); 415df8bae1dSRodney W. Grimes 416996c772fSJohn Dyson if (high == 0) 417f008cfccSPoul-Henning Kamp ana->inop->inode.iso_rdev = makeudev(umajor(low), uminor(low)); 418996c772fSJohn Dyson else 419f008cfccSPoul-Henning Kamp ana->inop->inode.iso_rdev = makeudev(high, uminor(low)); 420df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_DEVICE; 421df8bae1dSRodney W. Grimes return ISO_SUSP_DEVICE; 422df8bae1dSRodney W. Grimes } 423df8bae1dSRodney W. Grimes 424df8bae1dSRodney W. Grimes /* 425df8bae1dSRodney W. Grimes * Flag indicating 426df8bae1dSRodney W. Grimes */ 427df8bae1dSRodney W. Grimes static int 428df8bae1dSRodney W. Grimes cd9660_rrip_idflag(p,ana) 429df8bae1dSRodney W. Grimes ISO_RRIP_IDFLAG *p; 430df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 431df8bae1dSRodney W. Grimes { 432df8bae1dSRodney W. Grimes ana->fields &= isonum_711(p->flags)|~0xff; /* don't touch high bits */ 433df8bae1dSRodney W. Grimes /* special handling of RE field */ 434df8bae1dSRodney W. Grimes if (ana->fields&ISO_SUSP_RELDIR) 43510dd32cdSBruce Evans return cd9660_rrip_reldir(/* XXX */ (ISO_RRIP_RELDIR *)p,ana); 436df8bae1dSRodney W. Grimes 437df8bae1dSRodney W. Grimes return ISO_SUSP_IDFLAG; 438df8bae1dSRodney W. Grimes } 439df8bae1dSRodney W. Grimes 440df8bae1dSRodney W. Grimes /* 441df8bae1dSRodney W. Grimes * Continuation pointer 442df8bae1dSRodney W. Grimes */ 443df8bae1dSRodney W. Grimes static int 444df8bae1dSRodney W. Grimes cd9660_rrip_cont(p,ana) 445df8bae1dSRodney W. Grimes ISO_RRIP_CONT *p; 446df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 447df8bae1dSRodney W. Grimes { 448df8bae1dSRodney W. Grimes ana->iso_ce_blk = isonum_733(p->location); 449df8bae1dSRodney W. Grimes ana->iso_ce_off = isonum_733(p->offset); 450df8bae1dSRodney W. Grimes ana->iso_ce_len = isonum_733(p->length); 451df8bae1dSRodney W. Grimes return ISO_SUSP_CONT; 452df8bae1dSRodney W. Grimes } 453df8bae1dSRodney W. Grimes 454df8bae1dSRodney W. Grimes /* 455df8bae1dSRodney W. Grimes * System Use end 456df8bae1dSRodney W. Grimes */ 457df8bae1dSRodney W. Grimes static int 458df8bae1dSRodney W. Grimes cd9660_rrip_stop(p,ana) 459df8bae1dSRodney W. Grimes ISO_SUSP_HEADER *p; 460df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 461df8bae1dSRodney W. Grimes { 462df8bae1dSRodney W. Grimes return ISO_SUSP_STOP; 463df8bae1dSRodney W. Grimes } 464df8bae1dSRodney W. Grimes 465df8bae1dSRodney W. Grimes /* 466df8bae1dSRodney W. Grimes * Extension reference 467df8bae1dSRodney W. Grimes */ 468df8bae1dSRodney W. Grimes static int 469df8bae1dSRodney W. Grimes cd9660_rrip_extref(p,ana) 470df8bae1dSRodney W. Grimes ISO_RRIP_EXTREF *p; 471df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 472df8bae1dSRodney W. Grimes { 473df8bae1dSRodney W. Grimes if (isonum_711(p->len_id) != 10 474df8bae1dSRodney W. Grimes || bcmp((char *)p + 8,"RRIP_1991A",10) 475df8bae1dSRodney W. Grimes || isonum_711(p->version) != 1) 476df8bae1dSRodney W. Grimes return 0; 477df8bae1dSRodney W. Grimes ana->fields &= ~ISO_SUSP_EXTREF; 478df8bae1dSRodney W. Grimes return ISO_SUSP_EXTREF; 479df8bae1dSRodney W. Grimes } 480df8bae1dSRodney W. Grimes 481df8bae1dSRodney W. Grimes static int 482df8bae1dSRodney W. Grimes cd9660_rrip_loop(isodir,ana,table) 483df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 484df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE *ana; 485df8bae1dSRodney W. Grimes RRIP_TABLE *table; 486df8bae1dSRodney W. Grimes { 487df8bae1dSRodney W. Grimes register RRIP_TABLE *ptable; 488df8bae1dSRodney W. Grimes register ISO_SUSP_HEADER *phead; 489df8bae1dSRodney W. Grimes register ISO_SUSP_HEADER *pend; 490df8bae1dSRodney W. Grimes struct buf *bp = NULL; 491df8bae1dSRodney W. Grimes char *pwhead; 49244e568e2SDaniel C. Sobral u_char c; 493df8bae1dSRodney W. Grimes int result; 494df8bae1dSRodney W. Grimes 495df8bae1dSRodney W. Grimes /* 496df8bae1dSRodney W. Grimes * Note: If name length is odd, 497df8bae1dSRodney W. Grimes * it will be padding 1 byte after the name 498df8bae1dSRodney W. Grimes */ 499df8bae1dSRodney W. Grimes pwhead = isodir->name + isonum_711(isodir->name_len); 500df8bae1dSRodney W. Grimes if (!(isonum_711(isodir->name_len)&1)) 501df8bae1dSRodney W. Grimes pwhead++; 50244e568e2SDaniel C. Sobral isochar(isodir->name, pwhead, ana->imp->joliet_level, &c); 503df8bae1dSRodney W. Grimes 504df8bae1dSRodney W. Grimes /* If it's not the '.' entry of the root dir obey SP field */ 50544e568e2SDaniel C. Sobral if (c != 0 || isonum_733(isodir->extent) != ana->imp->root_extent) 506df8bae1dSRodney W. Grimes pwhead += ana->imp->rr_skip; 507df8bae1dSRodney W. Grimes else 508df8bae1dSRodney W. Grimes pwhead += ana->imp->rr_skip0; 509df8bae1dSRodney W. Grimes 510df8bae1dSRodney W. Grimes phead = (ISO_SUSP_HEADER *)pwhead; 511df8bae1dSRodney W. Grimes pend = (ISO_SUSP_HEADER *)((char *)isodir + isonum_711(isodir->length)); 512df8bae1dSRodney W. Grimes 513df8bae1dSRodney W. Grimes result = 0; 514df8bae1dSRodney W. Grimes while (1) { 515df8bae1dSRodney W. Grimes ana->iso_ce_len = 0; 516df8bae1dSRodney W. Grimes /* 517df8bae1dSRodney W. Grimes * Note: "pend" should be more than one SUSP header 518df8bae1dSRodney W. Grimes */ 519df8bae1dSRodney W. Grimes while (pend >= phead + 1) { 520df8bae1dSRodney W. Grimes if (isonum_711(phead->version) == 1) { 521df8bae1dSRodney W. Grimes for (ptable = table; ptable->func; ptable++) { 522df8bae1dSRodney W. Grimes if (*phead->type == *ptable->type 523df8bae1dSRodney W. Grimes && phead->type[1] == ptable->type[1]) { 524df8bae1dSRodney W. Grimes result |= ptable->func(phead,ana); 525df8bae1dSRodney W. Grimes break; 526df8bae1dSRodney W. Grimes } 527df8bae1dSRodney W. Grimes } 528df8bae1dSRodney W. Grimes if (!ana->fields) 529df8bae1dSRodney W. Grimes break; 530df8bae1dSRodney W. Grimes } 531996c772fSJohn Dyson if (result&ISO_SUSP_STOP) { 532996c772fSJohn Dyson result &= ~ISO_SUSP_STOP; 533996c772fSJohn Dyson break; 534996c772fSJohn Dyson } 535996c772fSJohn Dyson /* plausibility check */ 536996c772fSJohn Dyson if (isonum_711(phead->length) < sizeof(*phead)) 537996c772fSJohn Dyson break; 538df8bae1dSRodney W. Grimes /* 539df8bae1dSRodney W. Grimes * move to next SUSP 540df8bae1dSRodney W. Grimes * Hopefully this works with newer versions, too 541df8bae1dSRodney W. Grimes */ 542df8bae1dSRodney W. Grimes phead = (ISO_SUSP_HEADER *)((char *)phead + isonum_711(phead->length)); 543df8bae1dSRodney W. Grimes } 544df8bae1dSRodney W. Grimes 545df8bae1dSRodney W. Grimes if (ana->fields && ana->iso_ce_len) { 546df8bae1dSRodney W. Grimes if (ana->iso_ce_blk >= ana->imp->volume_space_size 547df8bae1dSRodney W. Grimes || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size 548df8bae1dSRodney W. Grimes || bread(ana->imp->im_devvp, 549996c772fSJohn Dyson ana->iso_ce_blk << 550996c772fSJohn Dyson (ana->imp->im_bshift - DEV_BSHIFT), 551df8bae1dSRodney W. Grimes ana->imp->logical_block_size, NOCRED, &bp)) 552df8bae1dSRodney W. Grimes /* what to do now? */ 553df8bae1dSRodney W. Grimes break; 554996c772fSJohn Dyson phead = (ISO_SUSP_HEADER *)(bp->b_data + ana->iso_ce_off); 555df8bae1dSRodney W. Grimes pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len); 556df8bae1dSRodney W. Grimes } else 557df8bae1dSRodney W. Grimes break; 558df8bae1dSRodney W. Grimes } 559df8bae1dSRodney W. Grimes if (bp) 560df8bae1dSRodney W. Grimes brelse(bp); 561df8bae1dSRodney W. Grimes /* 562df8bae1dSRodney W. Grimes * If we don't find the Basic SUSP stuffs, just set default value 563df8bae1dSRodney W. Grimes * (attribute/time stamp) 564df8bae1dSRodney W. Grimes */ 565df8bae1dSRodney W. Grimes for (ptable = table; ptable->func2; ptable++) 566df8bae1dSRodney W. Grimes if (!(ptable->result&result)) 567df8bae1dSRodney W. Grimes ptable->func2(isodir,ana); 568df8bae1dSRodney W. Grimes 569df8bae1dSRodney W. Grimes return result; 570df8bae1dSRodney W. Grimes } 571df8bae1dSRodney W. Grimes 57210dd32cdSBruce Evans /* 573996c772fSJohn Dyson * Get Attributes. 574996c772fSJohn Dyson */ 575996c772fSJohn Dyson /* 57610dd32cdSBruce Evans * XXX the casts are bogus but will do for now. 57710dd32cdSBruce Evans */ 57810dd32cdSBruce Evans #define BC (rrt_func_t *) 579df8bae1dSRodney W. Grimes static RRIP_TABLE rrip_table_analyze[] = { 58010dd32cdSBruce Evans { "PX", BC cd9660_rrip_attr, cd9660_rrip_defattr, ISO_SUSP_ATTR }, 58110dd32cdSBruce Evans { "TF", BC cd9660_rrip_tstamp, cd9660_rrip_deftstamp, ISO_SUSP_TSTAMP }, 58210dd32cdSBruce Evans { "PN", BC cd9660_rrip_device, 0, ISO_SUSP_DEVICE }, 58310dd32cdSBruce Evans { "RR", BC cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, 58410dd32cdSBruce Evans { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 58510dd32cdSBruce Evans { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 586df8bae1dSRodney W. Grimes { "", 0, 0, 0 } 587df8bae1dSRodney W. Grimes }; 588df8bae1dSRodney W. Grimes 589df8bae1dSRodney W. Grimes int 590df8bae1dSRodney W. Grimes cd9660_rrip_analyze(isodir,inop,imp) 591df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 592df8bae1dSRodney W. Grimes struct iso_node *inop; 593df8bae1dSRodney W. Grimes struct iso_mnt *imp; 594df8bae1dSRodney W. Grimes { 595df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE analyze; 596df8bae1dSRodney W. Grimes 597df8bae1dSRodney W. Grimes analyze.inop = inop; 598df8bae1dSRodney W. Grimes analyze.imp = imp; 599df8bae1dSRodney W. Grimes analyze.fields = ISO_SUSP_ATTR|ISO_SUSP_TSTAMP|ISO_SUSP_DEVICE; 600df8bae1dSRodney W. Grimes 601df8bae1dSRodney W. Grimes return cd9660_rrip_loop(isodir,&analyze,rrip_table_analyze); 602df8bae1dSRodney W. Grimes } 603df8bae1dSRodney W. Grimes 604df8bae1dSRodney W. Grimes /* 605996c772fSJohn Dyson * Get Alternate Name. 606df8bae1dSRodney W. Grimes */ 607df8bae1dSRodney W. Grimes static RRIP_TABLE rrip_table_getname[] = { 60810dd32cdSBruce Evans { "NM", BC cd9660_rrip_altname, cd9660_rrip_defname, ISO_SUSP_ALTNAME }, 60910dd32cdSBruce Evans { "CL", BC cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK }, 61010dd32cdSBruce Evans { "PL", BC cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK }, 61110dd32cdSBruce Evans { "RE", BC cd9660_rrip_reldir, 0, ISO_SUSP_RELDIR }, 61210dd32cdSBruce Evans { "RR", BC cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, 61310dd32cdSBruce Evans { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 61410dd32cdSBruce Evans { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 615df8bae1dSRodney W. Grimes { "", 0, 0, 0 } 616df8bae1dSRodney W. Grimes }; 617df8bae1dSRodney W. Grimes 618df8bae1dSRodney W. Grimes int 619df8bae1dSRodney W. Grimes cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp) 620df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 621df8bae1dSRodney W. Grimes char *outbuf; 622df8bae1dSRodney W. Grimes u_short *outlen; 623df8bae1dSRodney W. Grimes ino_t *inump; 624df8bae1dSRodney W. Grimes struct iso_mnt *imp; 625df8bae1dSRodney W. Grimes { 626df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE analyze; 627df8bae1dSRodney W. Grimes RRIP_TABLE *tab; 62844e568e2SDaniel C. Sobral u_char c; 629df8bae1dSRodney W. Grimes 630df8bae1dSRodney W. Grimes analyze.outbuf = outbuf; 631df8bae1dSRodney W. Grimes analyze.outlen = outlen; 632df8bae1dSRodney W. Grimes analyze.maxlen = NAME_MAX; 633df8bae1dSRodney W. Grimes analyze.inump = inump; 634df8bae1dSRodney W. Grimes analyze.imp = imp; 635df8bae1dSRodney W. Grimes analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK; 636df8bae1dSRodney W. Grimes *outlen = 0; 637df8bae1dSRodney W. Grimes 63844e568e2SDaniel C. Sobral isochar(isodir->name, isodir->name + isonum_711(isodir->name_len), 63944e568e2SDaniel C. Sobral imp->joliet_level, &c); 640df8bae1dSRodney W. Grimes tab = rrip_table_getname; 64144e568e2SDaniel C. Sobral if (c == 0 || c == 1) { 642df8bae1dSRodney W. Grimes cd9660_rrip_defname(isodir,&analyze); 643df8bae1dSRodney W. Grimes 644df8bae1dSRodney W. Grimes analyze.fields &= ~ISO_SUSP_ALTNAME; 645df8bae1dSRodney W. Grimes tab++; 646df8bae1dSRodney W. Grimes } 647df8bae1dSRodney W. Grimes 648df8bae1dSRodney W. Grimes return cd9660_rrip_loop(isodir,&analyze,tab); 649df8bae1dSRodney W. Grimes } 650df8bae1dSRodney W. Grimes 651df8bae1dSRodney W. Grimes /* 652996c772fSJohn Dyson * Get Symbolic Link. 653df8bae1dSRodney W. Grimes */ 654df8bae1dSRodney W. Grimes static RRIP_TABLE rrip_table_getsymname[] = { 65510dd32cdSBruce Evans { "SL", BC cd9660_rrip_slink, 0, ISO_SUSP_SLINK }, 65610dd32cdSBruce Evans { "RR", BC cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, 65710dd32cdSBruce Evans { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 65810dd32cdSBruce Evans { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 659df8bae1dSRodney W. Grimes { "", 0, 0, 0 } 660df8bae1dSRodney W. Grimes }; 661df8bae1dSRodney W. Grimes 662df8bae1dSRodney W. Grimes int 663df8bae1dSRodney W. Grimes cd9660_rrip_getsymname(isodir,outbuf,outlen,imp) 664df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 665df8bae1dSRodney W. Grimes char *outbuf; 666df8bae1dSRodney W. Grimes u_short *outlen; 667df8bae1dSRodney W. Grimes struct iso_mnt *imp; 668df8bae1dSRodney W. Grimes { 669df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE analyze; 670df8bae1dSRodney W. Grimes 671df8bae1dSRodney W. Grimes analyze.outbuf = outbuf; 672df8bae1dSRodney W. Grimes analyze.outlen = outlen; 673df8bae1dSRodney W. Grimes *outlen = 0; 674df8bae1dSRodney W. Grimes analyze.maxlen = MAXPATHLEN; 675df8bae1dSRodney W. Grimes analyze.cont = 1; /* don't start with a slash */ 676df8bae1dSRodney W. Grimes analyze.imp = imp; 677df8bae1dSRodney W. Grimes analyze.fields = ISO_SUSP_SLINK; 678df8bae1dSRodney W. Grimes 679df8bae1dSRodney W. Grimes return (cd9660_rrip_loop(isodir,&analyze,rrip_table_getsymname)&ISO_SUSP_SLINK); 680df8bae1dSRodney W. Grimes } 681df8bae1dSRodney W. Grimes 682df8bae1dSRodney W. Grimes static RRIP_TABLE rrip_table_extref[] = { 68310dd32cdSBruce Evans { "ER", BC cd9660_rrip_extref, 0, ISO_SUSP_EXTREF }, 68410dd32cdSBruce Evans { "CE", BC cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 68510dd32cdSBruce Evans { "ST", BC cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 686df8bae1dSRodney W. Grimes { "", 0, 0, 0 } 687df8bae1dSRodney W. Grimes }; 688df8bae1dSRodney W. Grimes 689df8bae1dSRodney W. Grimes /* 690df8bae1dSRodney W. Grimes * Check for Rock Ridge Extension and return offset of its fields. 691996c772fSJohn Dyson * Note: We insist on the ER field. 692df8bae1dSRodney W. Grimes */ 693df8bae1dSRodney W. Grimes int 694df8bae1dSRodney W. Grimes cd9660_rrip_offset(isodir,imp) 695df8bae1dSRodney W. Grimes struct iso_directory_record *isodir; 696df8bae1dSRodney W. Grimes struct iso_mnt *imp; 697df8bae1dSRodney W. Grimes { 698df8bae1dSRodney W. Grimes ISO_RRIP_OFFSET *p; 699df8bae1dSRodney W. Grimes ISO_RRIP_ANALYZE analyze; 700df8bae1dSRodney W. Grimes 701df8bae1dSRodney W. Grimes imp->rr_skip0 = 0; 702df8bae1dSRodney W. Grimes p = (ISO_RRIP_OFFSET *)(isodir->name + 1); 703df8bae1dSRodney W. Grimes if (bcmp(p,"SP\7\1\276\357",6)) { 704df8bae1dSRodney W. Grimes /* Maybe, it's a CDROM XA disc? */ 705df8bae1dSRodney W. Grimes imp->rr_skip0 = 15; 706df8bae1dSRodney W. Grimes p = (ISO_RRIP_OFFSET *)((char *)p + 15); 707df8bae1dSRodney W. Grimes if (bcmp(p,"SP\7\1\276\357",6)) 708df8bae1dSRodney W. Grimes return -1; 709df8bae1dSRodney W. Grimes } 710df8bae1dSRodney W. Grimes 711df8bae1dSRodney W. Grimes analyze.imp = imp; 712df8bae1dSRodney W. Grimes analyze.fields = ISO_SUSP_EXTREF; 713df8bae1dSRodney W. Grimes if (!(cd9660_rrip_loop(isodir,&analyze,rrip_table_extref)&ISO_SUSP_EXTREF)) 714df8bae1dSRodney W. Grimes return -1; 715df8bae1dSRodney W. Grimes 716df8bae1dSRodney W. Grimes return isonum_711(p->skip); 717df8bae1dSRodney W. Grimes } 718