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