1 /*- 2 * Copyright (c) 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 * %sccs.include.redist.c% 11 * 12 * @(#)cd9660_vfsops.c 8.15 (Berkeley) 05/10/95 13 */ 14 15 #include <sys/param.h> 16 #include <sys/systm.h> 17 #include <sys/namei.h> 18 #include <sys/proc.h> 19 #include <sys/kernel.h> 20 #include <sys/vnode.h> 21 #include <miscfs/specfs/specdev.h> 22 #include <sys/mount.h> 23 #include <sys/buf.h> 24 #include <sys/file.h> 25 #include <sys/dkbad.h> 26 #include <sys/disklabel.h> 27 #include <sys/ioctl.h> 28 #include <sys/errno.h> 29 #include <sys/malloc.h> 30 #include <sys/stat.h> 31 32 #include <isofs/cd9660/iso.h> 33 #include <isofs/cd9660/cd9660_node.h> 34 #include <isofs/cd9660/cd9660_mount.h> 35 36 extern int enodev (); 37 38 struct vfsops cd9660_vfsops = { 39 cd9660_mount, 40 cd9660_start, 41 cd9660_unmount, 42 cd9660_root, 43 cd9660_quotactl, 44 cd9660_statfs, 45 cd9660_sync, 46 cd9660_vget, 47 cd9660_fhtovp, 48 cd9660_vptofh, 49 cd9660_init, 50 cd9660_sysctl 51 }; 52 53 /* 54 * Called by vfs_mountroot when iso is going to be mounted as root. 55 */ 56 57 static iso_mountfs(); 58 59 cd9660_mountroot() 60 { 61 struct mount *mp; 62 extern struct vnode *rootvp; 63 struct proc *p = curproc; /* XXX */ 64 struct iso_args args; 65 int error; 66 67 /* 68 * Get vnodes for swapdev and rootdev. 69 */ 70 if ((error = bdevvp(swapdev, &swapdev_vp)) || 71 (error = bdevvp(rootdev, &rootvp))) { 72 printf("cd9660_mountroot: can't setup bdevvp's"); 73 return (error); 74 } 75 76 if (error = vfs_rootmountalloc("cd9660", "root_device", &mp)) 77 return (error); 78 args.flags = ISOFSMNT_ROOT; 79 if (error = iso_mountfs(rootvp, mp, p, &args)) { 80 mp->mnt_vfc->vfc_refcount--; 81 free(mp, M_MOUNT); 82 return (error); 83 } 84 if (error = vfs_lock(mp)) { 85 (void)cd9660_unmount(mp, 0, p); 86 mp->mnt_vfc->vfc_refcount--; 87 free(mp, M_MOUNT); 88 return (error); 89 } 90 CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); 91 (void)cd9660_statfs(mp, &mp->mnt_stat, p); 92 vfs_unlock(mp); 93 return (0); 94 } 95 96 /* 97 * VFS Operations. 98 * 99 * mount system call 100 */ 101 cd9660_mount(mp, path, data, ndp, p) 102 register struct mount *mp; 103 char *path; 104 caddr_t data; 105 struct nameidata *ndp; 106 struct proc *p; 107 { 108 struct vnode *devvp; 109 struct iso_args args; 110 u_int size; 111 int error; 112 struct iso_mnt *imp; 113 114 if (error = copyin(data, (caddr_t)&args, sizeof (struct iso_args))) 115 return (error); 116 117 if ((mp->mnt_flag & MNT_RDONLY) == 0) 118 return (EROFS); 119 120 /* 121 * If updating, check whether changing from read-only to 122 * read/write; if there is no device name, that's all we do. 123 */ 124 if (mp->mnt_flag & MNT_UPDATE) { 125 imp = VFSTOISOFS(mp); 126 if (args.fspec == 0) 127 return (vfs_export(mp, &imp->im_export, &args.export)); 128 } 129 /* 130 * Not an update, or updating the name: look up the name 131 * and verify that it refers to a sensible block device. 132 */ 133 NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p); 134 if (error = namei(ndp)) 135 return (error); 136 devvp = ndp->ni_vp; 137 138 if (devvp->v_type != VBLK) { 139 vrele(devvp); 140 return ENOTBLK; 141 } 142 if (major(devvp->v_rdev) >= nblkdev) { 143 vrele(devvp); 144 return ENXIO; 145 } 146 if ((mp->mnt_flag & MNT_UPDATE) == 0) 147 error = iso_mountfs(devvp, mp, p, &args); 148 else { 149 if (devvp != imp->im_devvp) 150 error = EINVAL; /* needs translation */ 151 else 152 vrele(devvp); 153 } 154 if (error) { 155 vrele(devvp); 156 return error; 157 } 158 imp = VFSTOISOFS(mp); 159 (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); 160 bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); 161 (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 162 &size); 163 bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); 164 (void) cd9660_statfs(mp, &mp->mnt_stat, p); 165 return 0; 166 } 167 168 /* 169 * Common code for mount and mountroot 170 */ 171 static iso_mountfs(devvp, mp, p, argp) 172 register struct vnode *devvp; 173 struct mount *mp; 174 struct proc *p; 175 struct iso_args *argp; 176 { 177 register struct iso_mnt *isomp = (struct iso_mnt *)0; 178 struct buf *bp = NULL; 179 dev_t dev = devvp->v_rdev; 180 caddr_t base, space; 181 int havepart = 0, blks; 182 int error = EINVAL, i, size; 183 int needclose = 0; 184 int ronly = (mp->mnt_flag & MNT_RDONLY) != 0; 185 extern struct vnode *rootvp; 186 int j; 187 int iso_bsize; 188 int iso_blknum; 189 struct iso_volume_descriptor *vdp; 190 struct iso_primary_descriptor *pri; 191 struct iso_directory_record *rootp; 192 int logical_block_size; 193 194 if (!ronly) 195 return EROFS; 196 197 /* 198 * Disallow multiple mounts of the same device. 199 * Disallow mounting of a device that is currently in use 200 * (except for root, which might share swap device for miniroot). 201 * Flush out any old buffers remaining from a previous use. 202 */ 203 if (error = vfs_mountedon(devvp)) 204 return error; 205 if (vcount(devvp) > 1 && devvp != rootvp) 206 return EBUSY; 207 if (error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0)) 208 return (error); 209 210 if (error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p)) 211 return error; 212 needclose = 1; 213 214 /* This is the "logical sector size". The standard says this 215 * should be 2048 or the physical sector size on the device, 216 * whichever is greater. For now, we'll just use a constant. 217 */ 218 iso_bsize = ISO_DEFAULT_BLOCK_SIZE; 219 220 for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) { 221 if (error = bread(devvp, iso_blknum * btodb(iso_bsize), 222 iso_bsize, NOCRED, &bp)) 223 goto out; 224 225 vdp = (struct iso_volume_descriptor *)bp->b_data; 226 if (bcmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) != 0) { 227 error = EINVAL; 228 goto out; 229 } 230 231 if (isonum_711 (vdp->type) == ISO_VD_END) { 232 error = EINVAL; 233 goto out; 234 } 235 236 if (isonum_711 (vdp->type) == ISO_VD_PRIMARY) 237 break; 238 brelse(bp); 239 } 240 241 if (isonum_711 (vdp->type) != ISO_VD_PRIMARY) { 242 error = EINVAL; 243 goto out; 244 } 245 246 pri = (struct iso_primary_descriptor *)vdp; 247 248 logical_block_size = isonum_723 (pri->logical_block_size); 249 250 if (logical_block_size < DEV_BSIZE || logical_block_size > MAXBSIZE 251 || (logical_block_size & (logical_block_size - 1)) != 0) { 252 error = EINVAL; 253 goto out; 254 } 255 256 rootp = (struct iso_directory_record *)pri->root_directory_record; 257 258 isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK); 259 bzero((caddr_t)isomp, sizeof *isomp); 260 isomp->logical_block_size = logical_block_size; 261 isomp->volume_space_size = isonum_733 (pri->volume_space_size); 262 bcopy (rootp, isomp->root, sizeof isomp->root); 263 isomp->root_extent = isonum_733 (rootp->extent); 264 isomp->root_size = isonum_733 (rootp->size); 265 266 isomp->im_bmask = logical_block_size - 1; 267 isomp->im_bshift = 0; 268 while ((1 << isomp->im_bshift) < isomp->logical_block_size) 269 isomp->im_bshift++; 270 271 bp->b_flags |= B_AGE; 272 brelse(bp); 273 bp = NULL; 274 275 mp->mnt_data = (qaddr_t)isomp; 276 mp->mnt_stat.f_fsid.val[0] = (long)dev; 277 mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; 278 mp->mnt_maxsymlinklen = 0; 279 mp->mnt_flag |= MNT_LOCAL; 280 isomp->im_mountp = mp; 281 isomp->im_dev = dev; 282 isomp->im_devvp = devvp; 283 284 devvp->v_specflags |= SI_MOUNTEDON; 285 286 /* Check the Rock Ridge Extention support */ 287 if (!(argp->flags & ISOFSMNT_NORRIP)) { 288 if (error = bread(isomp->im_devvp, 289 (isomp->root_extent + isonum_711(rootp->ext_attr_length)) << 290 (isomp->im_bshift - DEV_BSHIFT), 291 isomp->logical_block_size, NOCRED, &bp)) 292 goto out; 293 294 rootp = (struct iso_directory_record *)bp->b_data; 295 296 if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) { 297 argp->flags |= ISOFSMNT_NORRIP; 298 } else { 299 argp->flags &= ~ISOFSMNT_GENS; 300 } 301 302 /* 303 * The contents are valid, 304 * but they will get reread as part of another vnode, so... 305 */ 306 bp->b_flags |= B_AGE; 307 brelse(bp); 308 bp = NULL; 309 } 310 isomp->im_flags = argp->flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS|ISOFSMNT_EXTATT); 311 switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) { 312 default: 313 isomp->iso_ftype = ISO_FTYPE_DEFAULT; 314 break; 315 case ISOFSMNT_GENS|ISOFSMNT_NORRIP: 316 isomp->iso_ftype = ISO_FTYPE_9660; 317 break; 318 case 0: 319 isomp->iso_ftype = ISO_FTYPE_RRIP; 320 break; 321 } 322 323 return 0; 324 out: 325 if (bp) 326 brelse(bp); 327 if (needclose) 328 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p); 329 if (isomp) { 330 free((caddr_t)isomp, M_ISOFSMNT); 331 mp->mnt_data = (qaddr_t)0; 332 } 333 return error; 334 } 335 336 /* 337 * Make a filesystem operational. 338 * Nothing to do at the moment. 339 */ 340 /* ARGSUSED */ 341 cd9660_start(mp, flags, p) 342 struct mount *mp; 343 int flags; 344 struct proc *p; 345 { 346 return 0; 347 } 348 349 /* 350 * unmount system call 351 */ 352 int 353 cd9660_unmount(mp, mntflags, p) 354 struct mount *mp; 355 int mntflags; 356 struct proc *p; 357 { 358 register struct iso_mnt *isomp; 359 int i, error, ronly, flags = 0; 360 361 if (mntflags & MNT_FORCE) 362 flags |= FORCECLOSE; 363 #if 0 364 mntflushbuf(mp, 0); 365 if (mntinvalbuf(mp)) 366 return EBUSY; 367 #endif 368 if (error = vflush(mp, NULLVP, flags)) 369 return (error); 370 371 isomp = VFSTOISOFS(mp); 372 373 #ifdef ISODEVMAP 374 if (isomp->iso_ftype == ISO_FTYPE_RRIP) 375 iso_dunmap(isomp->im_dev); 376 #endif 377 378 isomp->im_devvp->v_specflags &= ~SI_MOUNTEDON; 379 error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, p); 380 vrele(isomp->im_devvp); 381 free((caddr_t)isomp, M_ISOFSMNT); 382 mp->mnt_data = (qaddr_t)0; 383 mp->mnt_flag &= ~MNT_LOCAL; 384 return (error); 385 } 386 387 /* 388 * Return root of a filesystem 389 */ 390 cd9660_root(mp, vpp) 391 struct mount *mp; 392 struct vnode **vpp; 393 { 394 struct iso_mnt *imp = VFSTOISOFS(mp); 395 struct iso_directory_record *dp = 396 (struct iso_directory_record *)imp->root; 397 ino_t ino = isodirino(dp, imp); 398 399 /* 400 * With RRIP we must use the `.' entry of the root directory. 401 * Simply tell vget, that it's a relocated directory. 402 */ 403 return (cd9660_vget_internal(mp, ino, vpp, 404 imp->iso_ftype == ISO_FTYPE_RRIP, dp)); 405 } 406 407 /* 408 * Do operations associated with quotas, not supported 409 */ 410 /* ARGSUSED */ 411 int 412 cd9660_quotactl(mp, cmd, uid, arg, p) 413 struct mount *mp; 414 int cmd; 415 uid_t uid; 416 caddr_t arg; 417 struct proc *p; 418 { 419 420 return (EOPNOTSUPP); 421 } 422 423 /* 424 * Get file system statistics. 425 */ 426 cd9660_statfs(mp, sbp, p) 427 struct mount *mp; 428 register struct statfs *sbp; 429 struct proc *p; 430 { 431 register struct iso_mnt *isomp; 432 register struct fs *fs; 433 434 isomp = VFSTOISOFS(mp); 435 436 #ifdef COMPAT_09 437 sbp->f_type = 5; 438 #else 439 sbp->f_type = 0; 440 #endif 441 sbp->f_bsize = isomp->logical_block_size; 442 sbp->f_iosize = sbp->f_bsize; /* XXX */ 443 sbp->f_blocks = isomp->volume_space_size; 444 sbp->f_bfree = 0; /* total free blocks */ 445 sbp->f_bavail = 0; /* blocks free for non superuser */ 446 sbp->f_files = 0; /* total files */ 447 sbp->f_ffree = 0; /* free file nodes */ 448 if (sbp != &mp->mnt_stat) { 449 bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); 450 bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); 451 } 452 /* Use the first spare for flags: */ 453 sbp->f_spare[0] = isomp->im_flags; 454 return 0; 455 } 456 457 /* ARGSUSED */ 458 int 459 cd9660_sync(mp, waitfor, cred, p) 460 struct mount *mp; 461 int waitfor; 462 struct ucred *cred; 463 struct proc *p; 464 { 465 return (0); 466 } 467 468 /* 469 * File handle to vnode 470 * 471 * Have to be really careful about stale file handles: 472 * - check that the inode number is in range 473 * - call iget() to get the locked inode 474 * - check for an unallocated inode (i_mode == 0) 475 * - check that the generation number matches 476 */ 477 478 struct ifid { 479 ushort ifid_len; 480 ushort ifid_pad; 481 int ifid_ino; 482 long ifid_start; 483 }; 484 485 /* ARGSUSED */ 486 int 487 cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) 488 register struct mount *mp; 489 struct fid *fhp; 490 struct mbuf *nam; 491 struct vnode **vpp; 492 int *exflagsp; 493 struct ucred **credanonp; 494 { 495 struct ifid *ifhp = (struct ifid *)fhp; 496 register struct iso_node *ip; 497 register struct netcred *np; 498 register struct iso_mnt *imp = VFSTOISOFS(mp); 499 struct vnode *nvp; 500 int error; 501 502 #ifdef ISOFS_DBG 503 printf("fhtovp: ino %d, start %ld\n", 504 ifhp->ifid_ino, ifhp->ifid_start); 505 #endif 506 507 /* 508 * Get the export permission structure for this <mp, client> tuple. 509 */ 510 np = vfs_export_lookup(mp, &imp->im_export, nam); 511 if (np == NULL) 512 return (EACCES); 513 514 if (error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) { 515 *vpp = NULLVP; 516 return (error); 517 } 518 ip = VTOI(nvp); 519 if (ip->inode.iso_mode == 0) { 520 vput(nvp); 521 *vpp = NULLVP; 522 return (ESTALE); 523 } 524 *vpp = nvp; 525 *exflagsp = np->netc_exflags; 526 *credanonp = &np->netc_anon; 527 return (0); 528 } 529 530 int 531 cd9660_vget(mp, ino, vpp) 532 struct mount *mp; 533 ino_t ino; 534 struct vnode **vpp; 535 { 536 537 /* 538 * XXXX 539 * It would be nice if we didn't always set the `relocated' flag 540 * and force the extra read, but I don't want to think about fixing 541 * that right now. 542 */ 543 return (cd9660_vget_internal(mp, ino, vpp, 544 #if 0 545 VFSTOISOFS(mp)->iso_ftype == ISO_FTYPE_RRIP, 546 #else 547 0, 548 #endif 549 (struct iso_directory_entry *)0)); 550 } 551 552 int 553 cd9660_vget_internal(mp, ino, vpp, relocated, isodir) 554 struct mount *mp; 555 ino_t ino; 556 struct vnode **vpp; 557 int relocated; 558 struct iso_directory_record *isodir; 559 { 560 register struct iso_mnt *imp; 561 struct iso_node *ip; 562 struct buf *bp; 563 struct vnode *vp, *nvp; 564 dev_t dev; 565 int error; 566 567 imp = VFSTOISOFS(mp); 568 dev = imp->im_dev; 569 if ((*vpp = cd9660_ihashget(dev, ino)) != NULLVP) 570 return (0); 571 572 /* Allocate a new vnode/iso_node. */ 573 if (error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) { 574 *vpp = NULLVP; 575 return (error); 576 } 577 MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, 578 M_WAITOK); 579 bzero((caddr_t)ip, sizeof(struct iso_node)); 580 vp->v_data = ip; 581 ip->i_vnode = vp; 582 ip->i_dev = dev; 583 ip->i_number = ino; 584 585 /* 586 * Put it onto its hash chain and lock it so that other requests for 587 * this inode will block if they arrive while we are sleeping waiting 588 * for old data structures to be purged or for the contents of the 589 * disk portion of this inode to be read. 590 */ 591 cd9660_ihashins(ip); 592 593 if (isodir == 0) { 594 int lbn, off; 595 596 lbn = lblkno(imp, ino); 597 if (lbn >= imp->volume_space_size) { 598 vput(vp); 599 printf("fhtovp: lbn exceed volume space %d\n", lbn); 600 return (ESTALE); 601 } 602 603 off = blkoff(imp, ino); 604 if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) { 605 vput(vp); 606 printf("fhtovp: crosses block boundary %d\n", 607 off + ISO_DIRECTORY_RECORD_SIZE); 608 return (ESTALE); 609 } 610 611 error = bread(imp->im_devvp, 612 lbn << (imp->im_bshift - DEV_BSHIFT), 613 imp->logical_block_size, NOCRED, &bp); 614 if (error) { 615 vput(vp); 616 brelse(bp); 617 printf("fhtovp: bread error %d\n",error); 618 return (error); 619 } 620 isodir = (struct iso_directory_record *)(bp->b_data + off); 621 622 if (off + isonum_711(isodir->length) > 623 imp->logical_block_size) { 624 vput(vp); 625 if (bp != 0) 626 brelse(bp); 627 printf("fhtovp: directory crosses block boundary %d[off=%d/len=%d]\n", 628 off +isonum_711(isodir->length), off, 629 isonum_711(isodir->length)); 630 return (ESTALE); 631 } 632 633 #if 0 634 if (isonum_733(isodir->extent) + 635 isonum_711(isodir->ext_attr_length) != ifhp->ifid_start) { 636 if (bp != 0) 637 brelse(bp); 638 printf("fhtovp: file start miss %d vs %d\n", 639 isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length), 640 ifhp->ifid_start); 641 return (ESTALE); 642 } 643 #endif 644 } else 645 bp = 0; 646 647 ip->i_mnt = imp; 648 ip->i_devvp = imp->im_devvp; 649 VREF(ip->i_devvp); 650 651 if (relocated) { 652 /* 653 * On relocated directories we must 654 * read the `.' entry out of a dir. 655 */ 656 ip->iso_start = ino >> imp->im_bshift; 657 if (bp != 0) 658 brelse(bp); 659 if (error = VOP_BLKATOFF(vp, (off_t)0, NULL, &bp)) { 660 vput(vp); 661 return (error); 662 } 663 isodir = (struct iso_directory_record *)bp->b_data; 664 } 665 666 ip->iso_extent = isonum_733(isodir->extent); 667 ip->i_size = isonum_733(isodir->size); 668 ip->iso_start = isonum_711(isodir->ext_attr_length) + ip->iso_extent; 669 670 /* 671 * Setup time stamp, attribute 672 */ 673 vp->v_type = VNON; 674 switch (imp->iso_ftype) { 675 default: /* ISO_FTYPE_9660 */ 676 { 677 struct buf *bp2; 678 int off; 679 if ((imp->im_flags & ISOFSMNT_EXTATT) 680 && (off = isonum_711(isodir->ext_attr_length))) 681 VOP_BLKATOFF(vp, (off_t)-(off << imp->im_bshift), NULL, 682 &bp2); 683 else 684 bp2 = NULL; 685 cd9660_defattr(isodir, ip, bp2); 686 cd9660_deftstamp(isodir, ip, bp2); 687 if (bp2) 688 brelse(bp2); 689 break; 690 } 691 case ISO_FTYPE_RRIP: 692 cd9660_rrip_analyze(isodir, ip, imp); 693 break; 694 } 695 696 if (bp != 0) 697 brelse(bp); 698 699 /* 700 * Initialize the associated vnode 701 */ 702 switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) { 703 case VFIFO: 704 #ifdef FIFO 705 vp->v_op = cd9660_fifoop_p; 706 break; 707 #else 708 vput(vp); 709 return (EOPNOTSUPP); 710 #endif /* FIFO */ 711 case VCHR: 712 case VBLK: 713 /* 714 * if device, look at device number table for translation 715 */ 716 #ifdef ISODEVMAP 717 if (dp = iso_dmap(dev, ino, 0)) 718 ip->inode.iso_rdev = dp->d_dev; 719 #endif 720 vp->v_op = cd9660_specop_p; 721 if (nvp = checkalias(vp, ip->inode.iso_rdev, mp)) { 722 /* 723 * Discard unneeded vnode, but save its iso_node. 724 */ 725 cd9660_ihashrem(ip); 726 VOP_UNLOCK(vp); 727 nvp->v_data = vp->v_data; 728 vp->v_data = NULL; 729 vp->v_op = spec_vnodeop_p; 730 vrele(vp); 731 vgone(vp); 732 /* 733 * Reinitialize aliased inode. 734 */ 735 vp = nvp; 736 ip->i_vnode = vp; 737 cd9660_ihashins(ip); 738 } 739 break; 740 } 741 742 if (ip->iso_extent == imp->root_extent) 743 vp->v_flag |= VROOT; 744 745 /* 746 * XXX need generation number? 747 */ 748 749 *vpp = vp; 750 return (0); 751 } 752 753 /* 754 * Vnode pointer to File handle 755 */ 756 /* ARGSUSED */ 757 cd9660_vptofh(vp, fhp) 758 struct vnode *vp; 759 struct fid *fhp; 760 { 761 register struct iso_node *ip = VTOI(vp); 762 register struct ifid *ifhp; 763 register struct iso_mnt *mp = ip->i_mnt; 764 765 ifhp = (struct ifid *)fhp; 766 ifhp->ifid_len = sizeof(struct ifid); 767 768 ifhp->ifid_ino = ip->i_number; 769 ifhp->ifid_start = ip->iso_start; 770 771 #ifdef ISOFS_DBG 772 printf("vptofh: ino %d, start %ld\n", 773 ifhp->ifid_ino,ifhp->ifid_start); 774 #endif 775 return 0; 776 } 777