1 /*- 2 * Copyright (c) 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley 6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7 * Support code is derived from software contributed to Berkeley 8 * by Atsushi Murai (amurai@spec.co.jp). 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the University of 21 * California, Berkeley and its contributors. 22 * 4. Neither the name of the University nor the names of its contributors 23 * may be used to endorse or promote products derived from this software 24 * without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)cd9660_rrip.c 8.2 (Berkeley) 1/23/94 39 * $Id: cd9660_rrip.c,v 1.4 1994/09/15 19:46:01 bde Exp $ 40 */ 41 42 #include <sys/param.h> 43 #include <sys/systm.h> 44 #include <sys/namei.h> 45 #include <sys/buf.h> 46 #include <sys/file.h> 47 #include <sys/vnode.h> 48 #include <sys/mount.h> 49 #include <sys/kernel.h> 50 #include <sys/stat.h> 51 #include <sys/types.h> 52 53 #include <sys/time.h> 54 55 #include <isofs/cd9660/iso.h> 56 #include <isofs/cd9660/cd9660_node.h> 57 #include <isofs/cd9660/cd9660_rrip.h> 58 #include <isofs/cd9660/iso_rrip.h> 59 60 /* 61 * POSIX file attribute 62 */ 63 static int 64 cd9660_rrip_attr(p,ana) 65 ISO_RRIP_ATTR *p; 66 ISO_RRIP_ANALYZE *ana; 67 { 68 ana->inop->inode.iso_mode = isonum_731(p->mode_l); 69 ana->inop->inode.iso_uid = (uid_t)isonum_731(p->uid_l); 70 ana->inop->inode.iso_gid = (gid_t)isonum_731(p->gid_l); 71 ana->inop->inode.iso_links = isonum_731(p->links_l); 72 ana->fields &= ~ISO_SUSP_ATTR; 73 return ISO_SUSP_ATTR; 74 } 75 76 static void 77 cd9660_rrip_defattr(isodir,ana) 78 struct iso_directory_record *isodir; 79 ISO_RRIP_ANALYZE *ana; 80 { 81 /* But this is a required field! */ 82 printf("RRIP without PX field?\n"); 83 cd9660_defattr(isodir,ana->inop,NULL); 84 } 85 86 /* 87 * Symbolic Links 88 */ 89 static int 90 cd9660_rrip_slink(p,ana) 91 ISO_RRIP_SLINK *p; 92 ISO_RRIP_ANALYZE *ana; 93 { 94 register ISO_RRIP_SLINK_COMPONENT *pcomp; 95 register ISO_RRIP_SLINK_COMPONENT *pcompe; 96 int len, wlen, cont; 97 char *outbuf, *inbuf; 98 99 pcomp = (ISO_RRIP_SLINK_COMPONENT *)p->component; 100 pcompe = (ISO_RRIP_SLINK_COMPONENT *)((char *)p + isonum_711(p->h.length)); 101 len = *ana->outlen; 102 outbuf = ana->outbuf; 103 cont = ana->cont; 104 105 /* 106 * Gathering a Symbolic name from each component with path 107 */ 108 for (; 109 pcomp < pcompe; 110 pcomp = (ISO_RRIP_SLINK_COMPONENT *)((char *)pcomp + ISO_RRIP_SLSIZ 111 + isonum_711(pcomp->clen))) { 112 113 if (!cont) { 114 if (len < ana->maxlen) { 115 len++; 116 *outbuf++ = '/'; 117 } 118 } 119 cont = 0; 120 121 inbuf = ".."; 122 wlen = 0; 123 124 switch (*pcomp->cflag) { 125 126 case ISO_SUSP_CFLAG_CURRENT: 127 /* Inserting Current */ 128 wlen = 1; 129 break; 130 131 case ISO_SUSP_CFLAG_PARENT: 132 /* Inserting Parent */ 133 wlen = 2; 134 break; 135 136 case ISO_SUSP_CFLAG_ROOT: 137 /* Inserting slash for ROOT */ 138 /* start over from beginning(?) */ 139 outbuf -= len; 140 len = 0; 141 break; 142 143 case ISO_SUSP_CFLAG_VOLROOT: 144 /* Inserting a mount point i.e. "/cdrom" */ 145 /* same as above */ 146 outbuf -= len; 147 len = 0; 148 inbuf = ana->imp->im_mountp->mnt_stat.f_mntonname; 149 wlen = strlen(inbuf); 150 break; 151 152 case ISO_SUSP_CFLAG_HOST: 153 /* Inserting hostname i.e. "kurt.tools.de" */ 154 inbuf = hostname; 155 wlen = hostnamelen; 156 break; 157 158 case ISO_SUSP_CFLAG_CONTINUE: 159 cont = 1; 160 /* fall thru */ 161 case 0: 162 /* Inserting component */ 163 wlen = isonum_711(pcomp->clen); 164 inbuf = pcomp->name; 165 break; 166 default: 167 printf("RRIP with incorrect flags?"); 168 wlen = ana->maxlen + 1; 169 break; 170 } 171 172 if (len + wlen > ana->maxlen) { 173 /* indicate error to caller */ 174 ana->cont = 1; 175 ana->fields = 0; 176 ana->outbuf -= *ana->outlen; 177 *ana->outlen = 0; 178 return 0; 179 } 180 181 bcopy(inbuf,outbuf,wlen); 182 outbuf += wlen; 183 len += wlen; 184 185 } 186 ana->outbuf = outbuf; 187 *ana->outlen = len; 188 ana->cont = cont; 189 190 if (!isonum_711(p->flags)) { 191 ana->fields &= ~ISO_SUSP_SLINK; 192 return ISO_SUSP_SLINK; 193 } 194 return 0; 195 } 196 197 /* 198 * Alternate name 199 */ 200 static int 201 cd9660_rrip_altname(p,ana) 202 ISO_RRIP_ALTNAME *p; 203 ISO_RRIP_ANALYZE *ana; 204 { 205 char *inbuf; 206 int wlen; 207 int cont; 208 209 inbuf = ".."; 210 wlen = 0; 211 cont = 0; 212 213 switch (*p->flags) { 214 case ISO_SUSP_CFLAG_CURRENT: 215 /* Inserting Current */ 216 wlen = 1; 217 break; 218 219 case ISO_SUSP_CFLAG_PARENT: 220 /* Inserting Parent */ 221 wlen = 2; 222 break; 223 224 case ISO_SUSP_CFLAG_HOST: 225 /* Inserting hostname i.e. "kurt.tools.de" */ 226 inbuf = hostname; 227 wlen = hostnamelen; 228 break; 229 230 case ISO_SUSP_CFLAG_CONTINUE: 231 cont = 1; 232 /* fall thru */ 233 case 0: 234 /* Inserting component */ 235 wlen = isonum_711(p->h.length) - 5; 236 inbuf = (char *)p + 5; 237 break; 238 239 default: 240 printf("RRIP with incorrect NM flags?\n"); 241 wlen = ana->maxlen + 1; 242 break; 243 } 244 245 if ((*ana->outlen += wlen) > ana->maxlen) { 246 /* treat as no name field */ 247 ana->fields &= ~ISO_SUSP_ALTNAME; 248 ana->outbuf -= *ana->outlen - wlen; 249 *ana->outlen = 0; 250 return 0; 251 } 252 253 bcopy(inbuf,ana->outbuf,wlen); 254 ana->outbuf += wlen; 255 256 if (!cont) { 257 ana->fields &= ~ISO_SUSP_ALTNAME; 258 return ISO_SUSP_ALTNAME; 259 } 260 return 0; 261 } 262 263 static void 264 cd9660_rrip_defname(isodir,ana) 265 struct iso_directory_record *isodir; 266 ISO_RRIP_ANALYZE *ana; 267 { 268 strcpy(ana->outbuf,".."); 269 switch (*isodir->name) { 270 default: 271 isofntrans(isodir->name,isonum_711(isodir->name_len), 272 ana->outbuf,ana->outlen, 273 1,isonum_711(isodir->flags)&4); 274 break; 275 case 0: 276 *ana->outlen = 1; 277 break; 278 case 1: 279 *ana->outlen = 2; 280 break; 281 } 282 } 283 284 /* 285 * Parent or Child Link 286 */ 287 static int 288 cd9660_rrip_pclink(p,ana) 289 ISO_RRIP_CLINK *p; 290 ISO_RRIP_ANALYZE *ana; 291 { 292 *ana->inump = isonum_733(p->dir_loc) << ana->imp->im_bshift; 293 ana->fields &= ~(ISO_SUSP_CLINK|ISO_SUSP_PLINK); 294 return *p->h.type == 'C' ? ISO_SUSP_CLINK : ISO_SUSP_PLINK; 295 } 296 297 /* 298 * Relocated directory 299 */ 300 static int 301 cd9660_rrip_reldir(p,ana) 302 ISO_RRIP_RELDIR *p; 303 ISO_RRIP_ANALYZE *ana; 304 { 305 /* special hack to make caller aware of RE field */ 306 *ana->outlen = 0; 307 ana->fields = 0; 308 return ISO_SUSP_RELDIR|ISO_SUSP_ALTNAME|ISO_SUSP_CLINK|ISO_SUSP_PLINK; 309 } 310 311 static int 312 cd9660_rrip_tstamp(p,ana) 313 ISO_RRIP_TSTAMP *p; 314 ISO_RRIP_ANALYZE *ana; 315 { 316 unsigned char *ptime; 317 318 ptime = p->time; 319 320 /* Check a format of time stamp (7bytes/17bytes) */ 321 if (!(*p->flags&ISO_SUSP_TSTAMP_FORM17)) { 322 if (*p->flags&ISO_SUSP_TSTAMP_CREAT) 323 ptime += 7; 324 325 if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) { 326 cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_mtime); 327 ptime += 7; 328 } else 329 bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec)); 330 331 if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) { 332 cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_atime); 333 ptime += 7; 334 } else 335 ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime; 336 337 if (*p->flags&ISO_SUSP_TSTAMP_ATTR) 338 cd9660_tstamp_conv7(ptime,&ana->inop->inode.iso_ctime); 339 else 340 ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; 341 342 } else { 343 if (*p->flags&ISO_SUSP_TSTAMP_CREAT) 344 ptime += 17; 345 346 if (*p->flags&ISO_SUSP_TSTAMP_MODIFY) { 347 cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_mtime); 348 ptime += 17; 349 } else 350 bzero(&ana->inop->inode.iso_mtime,sizeof(struct timespec)); 351 352 if (*p->flags&ISO_SUSP_TSTAMP_ACCESS) { 353 cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_atime); 354 ptime += 17; 355 } else 356 ana->inop->inode.iso_atime = ana->inop->inode.iso_mtime; 357 358 if (*p->flags&ISO_SUSP_TSTAMP_ATTR) 359 cd9660_tstamp_conv17(ptime,&ana->inop->inode.iso_ctime); 360 else 361 ana->inop->inode.iso_ctime = ana->inop->inode.iso_mtime; 362 363 } 364 ana->fields &= ~ISO_SUSP_TSTAMP; 365 return ISO_SUSP_TSTAMP; 366 } 367 368 static void 369 cd9660_rrip_deftstamp(isodir,ana) 370 struct iso_directory_record *isodir; 371 ISO_RRIP_ANALYZE *ana; 372 { 373 cd9660_deftstamp(isodir,ana->inop,NULL); 374 } 375 376 /* 377 * POSIX device modes 378 */ 379 static int 380 cd9660_rrip_device(p,ana) 381 ISO_RRIP_DEVICE *p; 382 ISO_RRIP_ANALYZE *ana; 383 { 384 unsigned high, low; 385 386 high = isonum_733(p->dev_t_high_l); 387 low = isonum_733(p->dev_t_low_l); 388 389 if ( high == 0 ) { 390 ana->inop->inode.iso_rdev = makedev( major(low), minor(low) ); 391 } else { 392 ana->inop->inode.iso_rdev = makedev( high, minor(low) ); 393 } 394 ana->fields &= ~ISO_SUSP_DEVICE; 395 return ISO_SUSP_DEVICE; 396 } 397 398 /* 399 * Flag indicating 400 */ 401 static int 402 cd9660_rrip_idflag(p,ana) 403 ISO_RRIP_IDFLAG *p; 404 ISO_RRIP_ANALYZE *ana; 405 { 406 ana->fields &= isonum_711(p->flags)|~0xff; /* don't touch high bits */ 407 /* special handling of RE field */ 408 if (ana->fields&ISO_SUSP_RELDIR) 409 return cd9660_rrip_reldir(p,ana); 410 411 return ISO_SUSP_IDFLAG; 412 } 413 414 /* 415 * Continuation pointer 416 */ 417 static int 418 cd9660_rrip_cont(p,ana) 419 ISO_RRIP_CONT *p; 420 ISO_RRIP_ANALYZE *ana; 421 { 422 ana->iso_ce_blk = isonum_733(p->location); 423 ana->iso_ce_off = isonum_733(p->offset); 424 ana->iso_ce_len = isonum_733(p->length); 425 return ISO_SUSP_CONT; 426 } 427 428 /* 429 * System Use end 430 */ 431 static int 432 cd9660_rrip_stop(p,ana) 433 ISO_SUSP_HEADER *p; 434 ISO_RRIP_ANALYZE *ana; 435 { 436 /* stop analyzing */ 437 ana->fields = 0; 438 return ISO_SUSP_STOP; 439 } 440 441 /* 442 * Extension reference 443 */ 444 static int 445 cd9660_rrip_extref(p,ana) 446 ISO_RRIP_EXTREF *p; 447 ISO_RRIP_ANALYZE *ana; 448 { 449 if (isonum_711(p->len_id) != 10 450 || bcmp((char *)p + 8,"RRIP_1991A",10) 451 || isonum_711(p->version) != 1) 452 return 0; 453 ana->fields &= ~ISO_SUSP_EXTREF; 454 return ISO_SUSP_EXTREF; 455 } 456 457 typedef struct { 458 char type[2]; 459 int (*func)(); 460 void (*func2)(); 461 int result; 462 } RRIP_TABLE; 463 464 static int 465 cd9660_rrip_loop(isodir,ana,table) 466 struct iso_directory_record *isodir; 467 ISO_RRIP_ANALYZE *ana; 468 RRIP_TABLE *table; 469 { 470 register RRIP_TABLE *ptable; 471 register ISO_SUSP_HEADER *phead; 472 register ISO_SUSP_HEADER *pend; 473 struct buf *bp = NULL; 474 char *pwhead; 475 int result; 476 477 /* 478 * Note: If name length is odd, 479 * it will be padding 1 byte after the name 480 */ 481 pwhead = isodir->name + isonum_711(isodir->name_len); 482 if (!(isonum_711(isodir->name_len)&1)) 483 pwhead++; 484 485 /* If it's not the '.' entry of the root dir obey SP field */ 486 if (*isodir->name != 0 487 || isonum_733(isodir->extent) != ana->imp->root_extent) 488 pwhead += ana->imp->rr_skip; 489 else 490 pwhead += ana->imp->rr_skip0; 491 492 phead = (ISO_SUSP_HEADER *)pwhead; 493 pend = (ISO_SUSP_HEADER *)((char *)isodir + isonum_711(isodir->length)); 494 495 result = 0; 496 while (1) { 497 ana->iso_ce_len = 0; 498 /* 499 * Note: "pend" should be more than one SUSP header 500 */ 501 while (pend >= phead + 1) { 502 if (isonum_711(phead->version) == 1) { 503 for (ptable = table; ptable->func; ptable++) { 504 if (*phead->type == *ptable->type 505 && phead->type[1] == ptable->type[1]) { 506 result |= ptable->func(phead,ana); 507 break; 508 } 509 } 510 if (!ana->fields) 511 break; 512 } 513 /* 514 * move to next SUSP 515 * Hopefully this works with newer versions, too 516 */ 517 phead = (ISO_SUSP_HEADER *)((char *)phead + isonum_711(phead->length)); 518 } 519 520 if ( ana->fields && ana->iso_ce_len ) { 521 if (ana->iso_ce_blk >= ana->imp->volume_space_size 522 || ana->iso_ce_off + ana->iso_ce_len > ana->imp->logical_block_size 523 || bread(ana->imp->im_devvp, 524 iso_lblktodaddr(ana->imp, ana->iso_ce_blk), 525 ana->imp->logical_block_size,NOCRED,&bp)) 526 /* what to do now? */ 527 break; 528 phead = (ISO_SUSP_HEADER *)(bp->b_un.b_addr + ana->iso_ce_off); 529 pend = (ISO_SUSP_HEADER *) ((char *)phead + ana->iso_ce_len); 530 } else 531 break; 532 } 533 if (bp) 534 brelse(bp); 535 /* 536 * If we don't find the Basic SUSP stuffs, just set default value 537 * ( attribute/time stamp ) 538 */ 539 for (ptable = table; ptable->func2; ptable++) 540 if (!(ptable->result&result)) 541 ptable->func2(isodir,ana); 542 543 return result; 544 } 545 546 static RRIP_TABLE rrip_table_analyze[] = { 547 { "PX", cd9660_rrip_attr, cd9660_rrip_defattr, ISO_SUSP_ATTR }, 548 { "TF", cd9660_rrip_tstamp, cd9660_rrip_deftstamp, ISO_SUSP_TSTAMP }, 549 { "PN", cd9660_rrip_device, 0, ISO_SUSP_DEVICE }, 550 { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, 551 { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 552 { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 553 { "", 0, 0, 0 } 554 }; 555 556 int 557 cd9660_rrip_analyze(isodir,inop,imp) 558 struct iso_directory_record *isodir; 559 struct iso_node *inop; 560 struct iso_mnt *imp; 561 { 562 ISO_RRIP_ANALYZE analyze; 563 564 analyze.inop = inop; 565 analyze.imp = imp; 566 analyze.fields = ISO_SUSP_ATTR|ISO_SUSP_TSTAMP|ISO_SUSP_DEVICE; 567 568 return cd9660_rrip_loop(isodir,&analyze,rrip_table_analyze); 569 } 570 571 /* 572 * Get Alternate Name from 'AL' record 573 * If either no AL record or 0 length, 574 * it will be return the translated ISO9660 name, 575 */ 576 static RRIP_TABLE rrip_table_getname[] = { 577 { "NM", cd9660_rrip_altname, cd9660_rrip_defname, ISO_SUSP_ALTNAME }, 578 { "CL", cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK }, 579 { "PL", cd9660_rrip_pclink, 0, ISO_SUSP_CLINK|ISO_SUSP_PLINK }, 580 { "RE", cd9660_rrip_reldir, 0, ISO_SUSP_RELDIR }, 581 { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, 582 { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 583 { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 584 { "", 0, 0, 0 } 585 }; 586 587 int 588 cd9660_rrip_getname(isodir,outbuf,outlen,inump,imp) 589 struct iso_directory_record *isodir; 590 char *outbuf; 591 u_short *outlen; 592 ino_t *inump; 593 struct iso_mnt *imp; 594 { 595 ISO_RRIP_ANALYZE analyze; 596 RRIP_TABLE *tab; 597 598 analyze.outbuf = outbuf; 599 analyze.outlen = outlen; 600 analyze.maxlen = NAME_MAX; 601 analyze.inump = inump; 602 analyze.imp = imp; 603 analyze.fields = ISO_SUSP_ALTNAME|ISO_SUSP_RELDIR|ISO_SUSP_CLINK|ISO_SUSP_PLINK; 604 *outlen = 0; 605 606 tab = rrip_table_getname; 607 if (*isodir->name == 0 608 || *isodir->name == 1) { 609 cd9660_rrip_defname(isodir,&analyze); 610 611 analyze.fields &= ~ISO_SUSP_ALTNAME; 612 tab++; 613 } 614 615 return cd9660_rrip_loop(isodir,&analyze,tab); 616 } 617 618 /* 619 * Get Symbolic Name from 'SL' record 620 * 621 * Note: isodir should contains SL record! 622 */ 623 static RRIP_TABLE rrip_table_getsymname[] = { 624 { "SL", cd9660_rrip_slink, 0, ISO_SUSP_SLINK }, 625 { "RR", cd9660_rrip_idflag, 0, ISO_SUSP_IDFLAG }, 626 { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 627 { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 628 { "", 0, 0, 0 } 629 }; 630 631 int 632 cd9660_rrip_getsymname(isodir,outbuf,outlen,imp) 633 struct iso_directory_record *isodir; 634 char *outbuf; 635 u_short *outlen; 636 struct iso_mnt *imp; 637 { 638 ISO_RRIP_ANALYZE analyze; 639 640 analyze.outbuf = outbuf; 641 analyze.outlen = outlen; 642 *outlen = 0; 643 analyze.maxlen = MAXPATHLEN; 644 analyze.cont = 1; /* don't start with a slash */ 645 analyze.imp = imp; 646 analyze.fields = ISO_SUSP_SLINK; 647 648 return (cd9660_rrip_loop(isodir,&analyze,rrip_table_getsymname)&ISO_SUSP_SLINK); 649 } 650 651 static RRIP_TABLE rrip_table_extref[] = { 652 { "ER", cd9660_rrip_extref, 0, ISO_SUSP_EXTREF }, 653 { "CE", cd9660_rrip_cont, 0, ISO_SUSP_CONT }, 654 { "ST", cd9660_rrip_stop, 0, ISO_SUSP_STOP }, 655 { "", 0, 0, 0 } 656 }; 657 658 /* 659 * Check for Rock Ridge Extension and return offset of its fields. 660 * Note: We require the ER field. 661 */ 662 int 663 cd9660_rrip_offset(isodir,imp) 664 struct iso_directory_record *isodir; 665 struct iso_mnt *imp; 666 { 667 ISO_RRIP_OFFSET *p; 668 ISO_RRIP_ANALYZE analyze; 669 670 imp->rr_skip0 = 0; 671 p = (ISO_RRIP_OFFSET *)(isodir->name + 1); 672 if (bcmp(p,"SP\7\1\276\357",6)) { 673 /* Maybe, it's a CDROM XA disc? */ 674 imp->rr_skip0 = 15; 675 p = (ISO_RRIP_OFFSET *)((char *)p + 15); 676 if (bcmp(p,"SP\7\1\276\357",6)) 677 return -1; 678 } 679 680 analyze.imp = imp; 681 analyze.fields = ISO_SUSP_EXTREF; 682 if (!(cd9660_rrip_loop(isodir,&analyze,rrip_table_extref)&ISO_SUSP_EXTREF)) 683 return -1; 684 685 return isonum_711(p->skip); 686 } 687