1 /* $NetBSD: udf_vfsops.c,v 1.33 2007/12/11 12:05:28 lukem Exp $ */ 2 3 /* 4 * Copyright (c) 2006 Reinoud Zandijk 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed for the 18 * NetBSD Project. See http://www.NetBSD.org/ for 19 * information about NetBSD. 20 * 4. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * 34 */ 35 36 37 #include <sys/cdefs.h> 38 #ifndef lint 39 __KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.33 2007/12/11 12:05:28 lukem Exp $"); 40 #endif /* not lint */ 41 42 43 #if defined(_KERNEL_OPT) 44 #include "opt_quota.h" 45 #include "opt_compat_netbsd.h" 46 #endif 47 48 #include <sys/param.h> 49 #include <sys/systm.h> 50 #include <sys/sysctl.h> 51 #include <sys/namei.h> 52 #include <sys/proc.h> 53 #include <sys/kernel.h> 54 #include <sys/vnode.h> 55 #include <miscfs/specfs/specdev.h> 56 #include <sys/mount.h> 57 #include <sys/buf.h> 58 #include <sys/file.h> 59 #include <sys/device.h> 60 #include <sys/disklabel.h> 61 #include <sys/ioctl.h> 62 #include <sys/malloc.h> 63 #include <sys/dirent.h> 64 #include <sys/stat.h> 65 #include <sys/conf.h> 66 #include <sys/kauth.h> 67 68 #include <fs/udf/ecma167-udf.h> 69 #include <fs/udf/udf_mount.h> 70 71 #include "udf.h" 72 #include "udf_subr.h" 73 #include "udf_bswap.h" 74 75 76 /* verbose levels of the udf filingsystem */ 77 int udf_verbose = UDF_DEBUGGING; 78 79 /* malloc regions */ 80 MALLOC_JUSTDEFINE(M_UDFMNT, "UDF mount", "UDF mount structures"); 81 MALLOC_JUSTDEFINE(M_UDFVOLD, "UDF volspace", "UDF volume space descriptors"); 82 MALLOC_JUSTDEFINE(M_UDFTEMP, "UDF temp", "UDF scrap space"); 83 struct pool udf_node_pool; 84 85 /* supported functions predefined */ 86 VFS_PROTOS(udf); 87 88 89 /* internal functions */ 90 static int udf_mountfs(struct vnode *, struct mount *, struct lwp *, struct udf_args *); 91 #if 0 92 static int update_mp(struct mount *, struct udf_args *); 93 #endif 94 95 96 /* handies */ 97 #define VFSTOUDF(mp) ((struct udf_mount *)mp->mnt_data) 98 99 100 /* --------------------------------------------------------------------- */ 101 102 /* predefine vnode-op list descriptor */ 103 extern const struct vnodeopv_desc udf_vnodeop_opv_desc; 104 105 const struct vnodeopv_desc * const udf_vnodeopv_descs[] = { 106 &udf_vnodeop_opv_desc, 107 NULL, 108 }; 109 110 111 /* vfsops descriptor linked in as anchor point for the filingsystem */ 112 struct vfsops udf_vfsops = { 113 MOUNT_UDF, /* vfs_name */ 114 sizeof (struct udf_args), 115 udf_mount, 116 udf_start, 117 udf_unmount, 118 udf_root, 119 (void *)eopnotsupp, /* vfs_quotactl */ 120 udf_statvfs, 121 udf_sync, 122 udf_vget, 123 udf_fhtovp, 124 udf_vptofh, 125 udf_init, 126 udf_reinit, 127 udf_done, 128 udf_mountroot, 129 udf_snapshot, 130 vfs_stdextattrctl, 131 (void *)eopnotsupp, /* vfs_suspendctl */ 132 udf_vnodeopv_descs, 133 0, /* int vfs_refcount */ 134 { NULL, NULL, }, /* LIST_ENTRY(vfsops) */ 135 }; 136 VFS_ATTACH(udf_vfsops); 137 138 139 /* --------------------------------------------------------------------- */ 140 141 /* file system starts here */ 142 void 143 udf_init(void) 144 { 145 size_t size; 146 147 malloc_type_attach(M_UDFMNT); 148 malloc_type_attach(M_UDFVOLD); 149 malloc_type_attach(M_UDFTEMP); 150 151 /* init hashtables and pools */ 152 size = sizeof(struct udf_node); 153 pool_init(&udf_node_pool, size, 0, 0, 0, "udf_node_pool", NULL, 154 IPL_NONE); 155 } 156 157 /* --------------------------------------------------------------------- */ 158 159 void 160 udf_reinit(void) 161 { 162 /* recreate hashtables */ 163 /* reinit pool? */ 164 } 165 166 /* --------------------------------------------------------------------- */ 167 168 void 169 udf_done(void) 170 { 171 /* remove hashtables and pools */ 172 pool_destroy(&udf_node_pool); 173 174 malloc_type_detach(M_UDFMNT); 175 malloc_type_detach(M_UDFVOLD); 176 malloc_type_detach(M_UDFTEMP); 177 } 178 179 /* --------------------------------------------------------------------- */ 180 181 int 182 udf_mountroot(void) 183 { 184 return EOPNOTSUPP; 185 } 186 187 /* --------------------------------------------------------------------- */ 188 189 #define MPFREE(a, lst) \ 190 if ((a)) free((a), lst); 191 static void 192 free_udf_mountinfo(struct mount *mp) 193 { 194 struct udf_mount *ump; 195 int i; 196 197 if (!mp) 198 return; 199 200 ump = VFSTOUDF(mp); 201 if (ump) { 202 /* dereference all system nodes */ 203 if (ump->metadata_file) 204 vrele(ump->metadata_file->vnode); 205 if (ump->metadatamirror_file) 206 vrele(ump->metadatamirror_file->vnode); 207 if (ump->metadatabitmap_file) 208 vrele(ump->metadatabitmap_file->vnode); 209 210 /* vflush all (system) nodes if any */ 211 (void) vflush(mp, NULLVP, FORCECLOSE); 212 213 /* dispose of our descriptor pool */ 214 if (ump->desc_pool) { 215 pool_destroy(ump->desc_pool); 216 free(ump->desc_pool, M_UDFMNT); 217 } 218 219 /* clear our data */ 220 for (i = 0; i < UDF_ANCHORS; i++) 221 MPFREE(ump->anchors[i], M_UDFVOLD); 222 MPFREE(ump->primary_vol, M_UDFVOLD); 223 MPFREE(ump->logical_vol, M_UDFVOLD); 224 MPFREE(ump->unallocated, M_UDFVOLD); 225 MPFREE(ump->implementation, M_UDFVOLD); 226 MPFREE(ump->logvol_integrity, M_UDFVOLD); 227 for (i = 0; i < UDF_PARTITIONS; i++) 228 MPFREE(ump->partitions[i], M_UDFVOLD); 229 MPFREE(ump->fileset_desc, M_UDFVOLD); 230 MPFREE(ump->vat_table, M_UDFVOLD); 231 MPFREE(ump->sparing_table, M_UDFVOLD); 232 233 mutex_destroy(&ump->ihash_lock); 234 mutex_destroy(&ump->get_node_lock); 235 free(ump, M_UDFMNT); 236 } 237 } 238 #undef MPFREE 239 240 /* --------------------------------------------------------------------- */ 241 242 int 243 udf_mount(struct mount *mp, const char *path, 244 void *data, size_t *data_len) 245 { 246 struct lwp *l = curlwp; 247 struct nameidata nd; 248 struct udf_args *args = data; 249 struct udf_mount *ump; 250 struct vnode *devvp; 251 int openflags, accessmode, error; 252 253 DPRINTF(CALL, ("udf_mount called\n")); 254 255 if (*data_len < sizeof *args) 256 return EINVAL; 257 258 if (mp->mnt_flag & MNT_GETARGS) { 259 /* request for the mount arguments */ 260 ump = VFSTOUDF(mp); 261 if (ump == NULL) 262 return EINVAL; 263 *args = ump->mount_args; 264 *data_len = sizeof *args; 265 return 0; 266 } 267 268 /* handle request for updating mount parameters */ 269 /* TODO can't update my mountpoint yet */ 270 if (mp->mnt_flag & MNT_UPDATE) { 271 return EOPNOTSUPP; 272 } 273 274 /* OK, so we are asked to mount the device */ 275 276 /* check/translate struct version */ 277 /* TODO sanity checking other mount arguments */ 278 if (args->version != 1) { 279 printf("mount_udf: unrecognized argument structure version\n"); 280 return EINVAL; 281 } 282 283 /* lookup name to get its vnode */ 284 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec); 285 error = namei(&nd); 286 if (error) 287 return error; 288 devvp = nd.ni_vp; 289 290 #ifdef DEBUG 291 if (udf_verbose & UDF_DEBUG_VOLUMES) 292 vprint("UDF mount, trying to mount \n", devvp); 293 #endif 294 295 /* check if its a block device specified */ 296 if (devvp->v_type != VBLK) { 297 vrele(devvp); 298 return ENOTBLK; 299 } 300 if (bdevsw_lookup(devvp->v_rdev) == NULL) { 301 vrele(devvp); 302 return ENXIO; 303 } 304 305 /* force read-only for now */ 306 mp->mnt_flag |= MNT_RDONLY; 307 308 /* 309 * If mount by non-root, then verify that user has necessary 310 * permissions on the device. 311 */ 312 if (kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL)) { 313 accessmode = VREAD; 314 if ((mp->mnt_flag & MNT_RDONLY) == 0) 315 accessmode |= VWRITE; 316 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); 317 error = VOP_ACCESS(devvp, accessmode, l->l_cred); 318 VOP_UNLOCK(devvp, 0); 319 if (error) { 320 vrele(devvp); 321 return error; 322 } 323 } 324 325 /* 326 * Disallow multiple mounts of the same device. Disallow mounting of 327 * a device that is currently in use (except for root, which might 328 * share swap device for miniroot). 329 */ 330 error = vfs_mountedon(devvp); 331 if (error) { 332 vrele(devvp); 333 return error; 334 } 335 if ((vcount(devvp) > 1) && (devvp != rootvp)) { 336 vrele(devvp); 337 return EBUSY; 338 } 339 340 /* 341 * Open device and try to mount it! 342 */ 343 if (mp->mnt_flag & MNT_RDONLY) { 344 openflags = FREAD; 345 } else { 346 openflags = FREAD | FWRITE; 347 } 348 error = VOP_OPEN(devvp, openflags, FSCRED); 349 if (error == 0) { 350 /* opened ok, try mounting */ 351 error = udf_mountfs(devvp, mp, l, args); 352 if (error) { 353 free_udf_mountinfo(mp); 354 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); 355 (void) VOP_CLOSE(devvp, openflags, NOCRED); 356 VOP_UNLOCK(devvp, 0); 357 } 358 } 359 if (error) { 360 /* devvp is still locked */ 361 vrele(devvp); 362 return error; 363 } 364 365 /* register our mountpoint being on this device */ 366 devvp->v_specmountpoint = mp; 367 368 /* successfully mounted */ 369 DPRINTF(VOLUMES, ("udf_mount() successfull\n")); 370 371 return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE, 372 mp->mnt_op->vfs_name, mp, l); 373 } 374 375 /* --------------------------------------------------------------------- */ 376 377 #ifdef DEBUG 378 static void 379 udf_unmount_sanity_check(struct mount *mp) 380 { 381 struct vnode *vp; 382 383 printf("On unmount, i found the following nodes:\n"); 384 TAILQ_FOREACH(vp, &mp->mnt_vnodelist, v_mntvnodes) { 385 vprint("", vp); 386 if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) { 387 printf(" is locked\n"); 388 } 389 if (vp->v_usecount > 1) 390 printf(" more than one usecount %d\n", vp->v_usecount); 391 } 392 } 393 #endif 394 395 396 int 397 udf_unmount(struct mount *mp, int mntflags) 398 { 399 struct udf_mount *ump; 400 int error, flags, closeflags; 401 402 DPRINTF(CALL, ("udf_umount called\n")); 403 404 ump = VFSTOUDF(mp); 405 if (!ump) 406 panic("UDF unmount: empty ump\n"); 407 408 flags = (mntflags & MNT_FORCE) ? FORCECLOSE : 0; 409 /* TODO remove these paranoid functions */ 410 #ifdef DEBUG 411 if (udf_verbose & UDF_DEBUG_LOCKING) 412 udf_unmount_sanity_check(mp); 413 #endif 414 415 /* 416 * By specifying SKIPSYSTEM we can skip vnodes marked with VV_SYSTEM. 417 * This hardly documented feature allows us to exempt certain files 418 * from being flushed. 419 */ 420 if ((error = vflush(mp, NULLVP, flags | SKIPSYSTEM)) != 0) 421 return error; 422 423 #ifdef DEBUG 424 if (udf_verbose & UDF_DEBUG_LOCKING) 425 udf_unmount_sanity_check(mp); 426 #endif 427 428 DPRINTF(VOLUMES, ("flush OK\n")); 429 430 /* 431 * TODO close logical volume and close session if requested. 432 */ 433 434 /* close device */ 435 DPRINTF(VOLUMES, ("closing device\n")); 436 if (mp->mnt_flag & MNT_RDONLY) { 437 closeflags = FREAD; 438 } else { 439 closeflags = FREAD | FWRITE; 440 } 441 442 /* devvp is still locked by us */ 443 vn_lock(ump->devvp, LK_EXCLUSIVE | LK_RETRY); 444 error = VOP_CLOSE(ump->devvp, closeflags, NOCRED); 445 if (error) 446 printf("Error during closure of device! error %d, " 447 "device might stay locked\n", error); 448 DPRINTF(VOLUMES, ("device close ok\n")); 449 450 /* clear our mount reference and release device node */ 451 ump->devvp->v_specmountpoint = NULL; 452 vput(ump->devvp); 453 454 /* free up umt structure */ 455 free_udf_mountinfo(mp); 456 457 /* free ump struct reference */ 458 mp->mnt_data = NULL; 459 mp->mnt_flag &= ~MNT_LOCAL; 460 461 DPRINTF(VOLUMES, ("Fin unmount\n")); 462 return error; 463 } 464 465 /* --------------------------------------------------------------------- */ 466 467 /* 468 * Helper function of udf_mount() that actually mounts the disc. 469 */ 470 471 static int 472 udf_mountfs(struct vnode *devvp, struct mount *mp, 473 struct lwp *l, struct udf_args *args) 474 { 475 struct udf_mount *ump; 476 uint32_t sector_size, lb_size, bshift; 477 int num_anchors, error, lst; 478 479 /* flush out any old buffers remaining from a previous use. */ 480 if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0))) 481 return error; 482 483 /* allocate udf part of mount structure; malloc always succeeds */ 484 ump = malloc(sizeof(struct udf_mount), M_UDFMNT, M_WAITOK | M_ZERO); 485 486 /* init locks */ 487 mutex_init(&ump->ihash_lock, MUTEX_DEFAULT, IPL_NONE); 488 mutex_init(&ump->get_node_lock, MUTEX_DEFAULT, IPL_NONE); 489 490 /* init `ino_t' to udf_node hash table */ 491 for (lst = 0; lst < UDF_INODE_HASHSIZE; lst++) { 492 LIST_INIT(&ump->udf_nodes[lst]); 493 } 494 495 /* set up linkage */ 496 mp->mnt_data = ump; 497 ump->vfs_mountp = mp; 498 499 /* set up arguments and device */ 500 ump->mount_args = *args; 501 ump->devvp = devvp; 502 if ((error = udf_update_discinfo(ump))) { 503 printf("UDF mount: error inspecting fs node\n"); 504 return error; 505 } 506 507 /* inspect sector size */ 508 sector_size = ump->discinfo.sector_size; 509 bshift = 1; 510 while ((1 << bshift) < sector_size) 511 bshift++; 512 if ((1 << bshift) != sector_size) { 513 printf("UDF mount: " 514 "hit NetBSD implementation fence on sector size\n"); 515 return EIO; 516 } 517 518 /* read all anchors to get volume descriptor sequence */ 519 num_anchors = udf_read_anchors(ump, args); 520 if (num_anchors == 0) 521 return ENOENT; 522 523 DPRINTF(VOLUMES, ("Read %d anchors on this disc, session %d\n", 524 num_anchors, args->sessionnr)); 525 526 /* read in volume descriptor sequence */ 527 if ((error = udf_read_vds_space(ump))) { 528 printf("UDF mount: error reading volume space\n"); 529 return error; 530 } 531 532 /* check consistency and completeness */ 533 if ((error = udf_process_vds(ump, args))) { 534 printf( "UDF mount: disc not properly formatted" 535 "(bad VDS)\n"); 536 return error; 537 } 538 539 /* 540 * Initialise pool for descriptors associated with nodes. This is done 541 * in lb_size units though currently lb_size is dictated to be 542 * sector_size. 543 */ 544 lb_size = udf_rw32(ump->logical_vol->lb_size); 545 ump->desc_pool = malloc(sizeof(struct pool), M_UDFMNT, M_WAITOK); 546 memset(ump->desc_pool, 0, sizeof(struct pool)); 547 pool_init(ump->desc_pool, lb_size, 0, 0, 0, "udf_desc_pool", NULL, 548 IPL_NONE); 549 550 /* read vds support tables like VAT, sparable etc. */ 551 if ((error = udf_read_vds_tables(ump, args))) { 552 printf( "UDF mount: error in format or damaged disc " 553 "(VDS tables failing)\n"); 554 return error; 555 } 556 557 if ((error = udf_read_rootdirs(ump, args))) { 558 printf( "UDF mount: " 559 "disc not properly formatted or damaged disc " 560 "(rootdirs failing)\n"); 561 return error; 562 } 563 564 /* setup rest of mount information */ 565 mp->mnt_data = ump; 566 mp->mnt_stat.f_fsidx.__fsid_val[0] = (uint32_t) devvp->v_rdev; 567 mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_UDF); 568 mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0]; 569 mp->mnt_stat.f_namemax = UDF_MAX_NAMELEN; 570 mp->mnt_flag |= MNT_LOCAL; 571 572 /* bshift is always equal to disc sector size */ 573 mp->mnt_dev_bshift = bshift; 574 mp->mnt_fs_bshift = bshift; 575 576 /* do we have to set this? */ 577 devvp->v_specmountpoint = mp; 578 579 /* success! */ 580 return 0; 581 } 582 583 /* --------------------------------------------------------------------- */ 584 585 int 586 udf_start(struct mount *mp, int flags) 587 { 588 /* do we have to do something here? */ 589 return 0; 590 } 591 592 /* --------------------------------------------------------------------- */ 593 594 int 595 udf_root(struct mount *mp, struct vnode **vpp) 596 { 597 struct vnode *vp; 598 struct long_ad *dir_loc; 599 struct udf_mount *ump = VFSTOUDF(mp); 600 struct udf_node *root_dir; 601 int error; 602 603 DPRINTF(CALL, ("udf_root called\n")); 604 605 dir_loc = &ump->fileset_desc->rootdir_icb; 606 error = udf_get_node(ump, dir_loc, &root_dir); 607 608 if (!root_dir) 609 error = ENOENT; 610 if (error) 611 return error; 612 613 vp = root_dir->vnode; 614 root_dir->vnode->v_vflag |= VV_ROOT; 615 616 *vpp = vp; 617 return 0; 618 } 619 620 /* --------------------------------------------------------------------- */ 621 622 int 623 udf_statvfs(struct mount *mp, struct statvfs *sbp) 624 { 625 struct udf_mount *ump = VFSTOUDF(mp); 626 struct logvol_int_desc *lvid; 627 struct udf_logvol_info *impl; 628 uint64_t freeblks, sizeblks; 629 uint32_t *pos1, *pos2; 630 int part, num_part; 631 632 DPRINTF(CALL, ("udf_statvfs called\n")); 633 sbp->f_flag = mp->mnt_flag; 634 sbp->f_bsize = ump->discinfo.sector_size; 635 sbp->f_frsize = ump->discinfo.sector_size; 636 sbp->f_iosize = ump->discinfo.sector_size; 637 638 /* TODO integrity locking */ 639 /* free and used space for mountpoint based on logvol integrity */ 640 lvid = ump->logvol_integrity; 641 if (lvid) { 642 num_part = udf_rw32(lvid->num_part); 643 impl = (struct udf_logvol_info *) (lvid->tables + 2*num_part); 644 645 freeblks = sizeblks = 0; 646 for (part=0; part < num_part; part++) { 647 pos1 = &lvid->tables[0] + part; 648 pos2 = &lvid->tables[0] + num_part + part; 649 if (udf_rw32(*pos1) != (uint32_t) -1) { 650 freeblks += udf_rw32(*pos1); 651 sizeblks += udf_rw32(*pos2); 652 } 653 } 654 sbp->f_blocks = sizeblks; 655 sbp->f_bfree = freeblks; 656 sbp->f_files = udf_rw32(impl->num_files); 657 sbp->f_files += udf_rw32(impl->num_directories); 658 659 /* XXX read only for now XXX */ 660 sbp->f_bavail = 0; 661 sbp->f_bresvd = 0; 662 663 /* tricky, next only aplies to ffs i think, so set to zero */ 664 sbp->f_ffree = 0; 665 sbp->f_favail = 0; 666 sbp->f_fresvd = 0; 667 } 668 669 copy_statvfs_info(sbp, mp); 670 return 0; 671 } 672 673 /* --------------------------------------------------------------------- */ 674 675 int 676 udf_sync(struct mount *mp, int waitfor, 677 kauth_cred_t cred) 678 { 679 DPRINTF(CALL, ("udf_sync called\n")); 680 /* nothing to be done as upto now read-only */ 681 return 0; 682 } 683 684 /* --------------------------------------------------------------------- */ 685 686 /* 687 * Get vnode for the file system type specific file id ino for the fs. Its 688 * used for reference to files by unique ID and for NFSv3. 689 * (optional) TODO lookup why some sources state NFSv3 690 */ 691 int 692 udf_vget(struct mount *mp, ino_t ino, 693 struct vnode **vpp) 694 { 695 DPRINTF(NOTIMPL, ("udf_vget called\n")); 696 return EOPNOTSUPP; 697 } 698 699 /* --------------------------------------------------------------------- */ 700 701 /* 702 * Lookup vnode for file handle specified 703 */ 704 int 705 udf_fhtovp(struct mount *mp, struct fid *fhp, 706 struct vnode **vpp) 707 { 708 DPRINTF(NOTIMPL, ("udf_fhtovp called\n")); 709 return EOPNOTSUPP; 710 } 711 712 /* --------------------------------------------------------------------- */ 713 714 /* 715 * Create an unique file handle. Its structure is opaque and won't be used by 716 * other subsystems. It should uniquely identify the file in the filingsystem 717 * and enough information to know if a file has been removed and/or resources 718 * have been recycled. 719 */ 720 int 721 udf_vptofh(struct vnode *vp, struct fid *fid, 722 size_t *fh_size) 723 { 724 DPRINTF(NOTIMPL, ("udf_vptofh called\n")); 725 return EOPNOTSUPP; 726 } 727 728 /* --------------------------------------------------------------------- */ 729 730 /* 731 * Create a filingsystem snapshot at the specified timestamp. Could be 732 * implemented by explicitly creating a new session or with spare room in the 733 * integrity descriptor space 734 */ 735 int 736 udf_snapshot(struct mount *mp, struct vnode *vp, 737 struct timespec *tm) 738 { 739 DPRINTF(NOTIMPL, ("udf_snapshot called\n")); 740 return EOPNOTSUPP; 741 } 742 743 /* --------------------------------------------------------------------- */ 744 745 /* 746 * If running a DEBUG kernel, provide an easy way to set the debug flags when 747 * running into a problem. 748 */ 749 750 #ifdef DEBUG 751 #define UDF_VERBOSE_SYSCTLOPT 1 752 753 SYSCTL_SETUP(sysctl_vfs_udf_setup, "sysctl vfs.udf subtree setup") 754 { 755 /* 756 * XXX the "24" below could be dynamic, thereby eliminating one 757 * more instance of the "number to vfs" mapping problem, but 758 * "24" is the order as taken from sys/mount.h 759 */ 760 761 sysctl_createv(clog, 0, NULL, NULL, 762 CTLFLAG_PERMANENT, 763 CTLTYPE_NODE, "vfs", NULL, 764 NULL, 0, NULL, 0, 765 CTL_VFS, CTL_EOL); 766 sysctl_createv(clog, 0, NULL, NULL, 767 CTLFLAG_PERMANENT, 768 CTLTYPE_NODE, "udf", 769 SYSCTL_DESCR("OSTA Universal File System"), 770 NULL, 0, NULL, 0, 771 CTL_VFS, 24, CTL_EOL); 772 773 sysctl_createv(clog, 0, NULL, NULL, 774 CTLFLAG_PERMANENT|CTLFLAG_READWRITE, 775 CTLTYPE_INT, "verbose", 776 SYSCTL_DESCR("Bitmask for filesystem debugging"), 777 NULL, 0, &udf_verbose, 0, 778 CTL_VFS, 24, UDF_VERBOSE_SYSCTLOPT, CTL_EOL); 779 } 780 781 #endif /* DEBUG */ 782 783