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