udf_vfsops.c revision 1.30 1 /* $NetBSD: udf_vfsops.c,v 1.30 2007/10/10 20:42:26 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 __RCSID("$NetBSD: udf_vfsops.c,v 1.30 2007/10/10 20:42:26 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/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 udf_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, struct lwp *l)
245 {
246 struct nameidata nd;
247 struct udf_args *args = data;
248 struct udf_mount *ump;
249 struct vnode *devvp;
250 int openflags, accessmode, error;
251
252 DPRINTF(CALL, ("udf_mount called\n"));
253
254 if (*data_len < sizeof *args)
255 return EINVAL;
256
257 if (mp->mnt_flag & MNT_GETARGS) {
258 /* request for the mount arguments */
259 ump = VFSTOUDF(mp);
260 if (ump == NULL)
261 return EINVAL;
262 *args = ump->mount_args;
263 *data_len = sizeof *args;
264 return 0;
265 }
266
267 /* handle request for updating mount parameters */
268 /* TODO can't update my mountpoint yet */
269 if (mp->mnt_flag & MNT_UPDATE) {
270 return EOPNOTSUPP;
271 }
272
273 /* OK, so we are asked to mount the device */
274
275 /* check/translate struct version */
276 /* TODO sanity checking other mount arguments */
277 if (args->version != 1) {
278 printf("mount_udf: unrecognized argument structure version\n");
279 return EINVAL;
280 }
281
282 /* lookup name to get its vnode */
283 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec, l);
284 error = namei(&nd);
285 if (error)
286 return error;
287 devvp = nd.ni_vp;
288
289 #ifdef DEBUG
290 if (udf_verbose & UDF_DEBUG_VOLUMES)
291 vprint("UDF mount, trying to mount \n", devvp);
292 #endif
293
294 /* check if its a block device specified */
295 if (devvp->v_type != VBLK) {
296 vrele(devvp);
297 return ENOTBLK;
298 }
299 if (bdevsw_lookup(devvp->v_rdev) == NULL) {
300 vrele(devvp);
301 return ENXIO;
302 }
303
304 /* force read-only for now */
305 mp->mnt_flag |= MNT_RDONLY;
306
307 /*
308 * If mount by non-root, then verify that user has necessary
309 * permissions on the device.
310 */
311 if (kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL)) {
312 accessmode = VREAD;
313 if ((mp->mnt_flag & MNT_RDONLY) == 0)
314 accessmode |= VWRITE;
315 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
316 error = VOP_ACCESS(devvp, accessmode, l->l_cred, l);
317 VOP_UNLOCK(devvp, 0);
318 if (error) {
319 vrele(devvp);
320 return error;
321 }
322 }
323
324 /*
325 * Disallow multiple mounts of the same device. Disallow mounting of
326 * a device that is currently in use (except for root, which might
327 * share swap device for miniroot).
328 */
329 error = vfs_mountedon(devvp);
330 if (error) {
331 vrele(devvp);
332 return error;
333 }
334 if ((vcount(devvp) > 1) && (devvp != rootvp)) {
335 vrele(devvp);
336 return EBUSY;
337 }
338
339 /*
340 * Open device and try to mount it!
341 */
342 if (mp->mnt_flag & MNT_RDONLY) {
343 openflags = FREAD;
344 } else {
345 openflags = FREAD | FWRITE;
346 }
347 error = VOP_OPEN(devvp, openflags, FSCRED, l);
348 if (error == 0) {
349 /* opened ok, try mounting */
350 error = udf_mountfs(devvp, mp, l, args);
351 if (error) {
352 free_udf_mountinfo(mp);
353 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
354 (void) VOP_CLOSE(devvp, openflags, NOCRED, l);
355 VOP_UNLOCK(devvp, 0);
356 }
357 }
358 if (error) {
359 /* devvp is still locked */
360 vrele(devvp);
361 return error;
362 }
363
364 /* register our mountpoint being on this device */
365 devvp->v_specmountpoint = mp;
366
367 /* successfully mounted */
368 DPRINTF(VOLUMES, ("udf_mount() successfull\n"));
369
370 return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
371 mp->mnt_op->vfs_name, mp, l);
372 }
373
374 /* --------------------------------------------------------------------- */
375
376 #ifdef DEBUG
377 static void
378 udf_unmount_sanity_check(struct mount *mp)
379 {
380 struct vnode *vp;
381
382 printf("On unmount, i found the following nodes:\n");
383 TAILQ_FOREACH(vp, &mp->mnt_vnodelist, v_mntvnodes) {
384 vprint("", vp);
385 if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) {
386 printf(" is locked\n");
387 }
388 if (vp->v_usecount > 1)
389 printf(" more than one usecount %d\n", vp->v_usecount);
390 }
391 }
392 #endif
393
394
395 int
396 udf_unmount(struct mount *mp, int mntflags, struct lwp *l)
397 {
398 struct udf_mount *ump;
399 int error, flags, closeflags;
400
401 DPRINTF(CALL, ("udf_umount called\n"));
402
403 ump = VFSTOUDF(mp);
404 if (!ump)
405 panic("UDF unmount: empty ump\n");
406
407 flags = (mntflags & MNT_FORCE) ? FORCECLOSE : 0;
408 /* TODO remove these paranoid functions */
409 #ifdef DEBUG
410 if (udf_verbose & UDF_DEBUG_LOCKING)
411 udf_unmount_sanity_check(mp);
412 #endif
413
414 /*
415 * By specifying SKIPSYSTEM we can skip vnodes marked with VV_SYSTEM.
416 * This hardly documented feature allows us to exempt certain files
417 * from being flushed.
418 */
419 if ((error = vflush(mp, NULLVP, flags | SKIPSYSTEM)) != 0)
420 return error;
421
422 #ifdef DEBUG
423 if (udf_verbose & UDF_DEBUG_LOCKING)
424 udf_unmount_sanity_check(mp);
425 #endif
426
427 DPRINTF(VOLUMES, ("flush OK\n"));
428
429 /*
430 * TODO close logical volume and close session if requested.
431 */
432
433 /* close device */
434 DPRINTF(VOLUMES, ("closing device\n"));
435 if (mp->mnt_flag & MNT_RDONLY) {
436 closeflags = FREAD;
437 } else {
438 closeflags = FREAD | FWRITE;
439 }
440
441 /* devvp is still locked by us */
442 vn_lock(ump->devvp, LK_EXCLUSIVE | LK_RETRY);
443 error = VOP_CLOSE(ump->devvp, closeflags, NOCRED, l);
444 if (error)
445 printf("Error during closure of device! error %d, "
446 "device might stay locked\n", error);
447 DPRINTF(VOLUMES, ("device close ok\n"));
448
449 /* clear our mount reference and release device node */
450 ump->devvp->v_specmountpoint = NULL;
451 vput(ump->devvp);
452
453 /* free up umt structure */
454 free_udf_mountinfo(mp);
455
456 /* free ump struct reference */
457 mp->mnt_data = NULL;
458 mp->mnt_flag &= ~MNT_LOCAL;
459
460 DPRINTF(VOLUMES, ("Fin unmount\n"));
461 return error;
462 }
463
464 /* --------------------------------------------------------------------- */
465
466 /*
467 * Helper function of udf_mount() that actually mounts the disc.
468 */
469
470 static int
471 udf_mountfs(struct vnode *devvp, struct mount *mp,
472 struct lwp *l, struct udf_args *args)
473 {
474 struct udf_mount *ump;
475 uint32_t sector_size, lb_size, bshift;
476 int num_anchors, error, lst;
477
478 /* flush out any old buffers remaining from a previous use. */
479 if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)))
480 return error;
481
482 /* allocate udf part of mount structure; malloc always succeeds */
483 ump = malloc(sizeof(struct udf_mount), M_UDFMNT, M_WAITOK | M_ZERO);
484
485 /* init locks */
486 mutex_init(&ump->ihash_lock, MUTEX_DEFAULT, IPL_NONE);
487 mutex_init(&ump->get_node_lock, MUTEX_DEFAULT, IPL_NONE);
488
489 /* init `ino_t' to udf_node hash table */
490 for (lst = 0; lst < UDF_INODE_HASHSIZE; lst++) {
491 LIST_INIT(&ump->udf_nodes[lst]);
492 }
493
494 /* set up linkage */
495 mp->mnt_data = ump;
496 ump->vfs_mountp = mp;
497
498 /* set up arguments and device */
499 ump->mount_args = *args;
500 ump->devvp = devvp;
501 if ((error = udf_update_discinfo(ump))) {
502 printf("UDF mount: error inspecting fs node\n");
503 return error;
504 }
505
506 /* inspect sector size */
507 sector_size = ump->discinfo.sector_size;
508 bshift = 1;
509 while ((1 << bshift) < sector_size)
510 bshift++;
511 if ((1 << bshift) != sector_size) {
512 printf("UDF mount: "
513 "hit NetBSD implementation fence on sector size\n");
514 return EIO;
515 }
516
517 /* read all anchors to get volume descriptor sequence */
518 num_anchors = udf_read_anchors(ump, args);
519 if (num_anchors == 0)
520 return ENOENT;
521
522 DPRINTF(VOLUMES, ("Read %d anchors on this disc, session %d\n",
523 num_anchors, args->sessionnr));
524
525 /* read in volume descriptor sequence */
526 if ((error = udf_read_vds_space(ump))) {
527 printf("UDF mount: error reading volume space\n");
528 return error;
529 }
530
531 /* check consistency and completeness */
532 if ((error = udf_process_vds(ump, args))) {
533 printf( "UDF mount: disc not properly formatted"
534 "(bad VDS)\n");
535 return error;
536 }
537
538 /*
539 * Initialise pool for descriptors associated with nodes. This is done
540 * in lb_size units though currently lb_size is dictated to be
541 * sector_size.
542 */
543 lb_size = udf_rw32(ump->logical_vol->lb_size);
544 ump->desc_pool = malloc(sizeof(struct pool), M_UDFMNT, M_WAITOK);
545 memset(ump->desc_pool, 0, sizeof(struct pool));
546 pool_init(ump->desc_pool, lb_size, 0, 0, 0, "udf_desc_pool", NULL,
547 IPL_NONE);
548
549 /* read vds support tables like VAT, sparable etc. */
550 if ((error = udf_read_vds_tables(ump, args))) {
551 printf( "UDF mount: error in format or damaged disc "
552 "(VDS tables failing)\n");
553 return error;
554 }
555
556 if ((error = udf_read_rootdirs(ump, args))) {
557 printf( "UDF mount: "
558 "disc not properly formatted or damaged disc "
559 "(rootdirs failing)\n");
560 return error;
561 }
562
563 /* setup rest of mount information */
564 mp->mnt_data = ump;
565 mp->mnt_stat.f_fsidx.__fsid_val[0] = (uint32_t) devvp->v_rdev;
566 mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_UDF);
567 mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
568 mp->mnt_stat.f_namemax = UDF_MAX_NAMELEN;
569 mp->mnt_flag |= MNT_LOCAL;
570
571 /* bshift is always equal to disc sector size */
572 mp->mnt_dev_bshift = bshift;
573 mp->mnt_fs_bshift = bshift;
574
575 /* do we have to set this? */
576 devvp->v_specmountpoint = mp;
577
578 /* success! */
579 return 0;
580 }
581
582 /* --------------------------------------------------------------------- */
583
584 int
585 udf_start(struct mount *mp, int flags, struct lwp *l)
586 {
587 /* do we have to do something here? */
588 return 0;
589 }
590
591 /* --------------------------------------------------------------------- */
592
593 int
594 udf_root(struct mount *mp, struct vnode **vpp)
595 {
596 struct vnode *vp;
597 struct long_ad *dir_loc;
598 struct udf_mount *ump = VFSTOUDF(mp);
599 struct udf_node *root_dir;
600 int error;
601
602 DPRINTF(CALL, ("udf_root called\n"));
603
604 dir_loc = &ump->fileset_desc->rootdir_icb;
605 error = udf_get_node(ump, dir_loc, &root_dir);
606
607 if (!root_dir)
608 error = ENOENT;
609 if (error)
610 return error;
611
612 vp = root_dir->vnode;
613 root_dir->vnode->v_vflag |= VV_ROOT;
614
615 *vpp = vp;
616 return 0;
617 }
618
619 /* --------------------------------------------------------------------- */
620
621 int
622 udf_quotactl(struct mount *mp, int cmds, uid_t uid,
623 void *arg, struct lwp *l)
624 {
625 DPRINTF(NOTIMPL, ("udf_quotactl called\n"));
626 return EOPNOTSUPP;
627 }
628
629 /* --------------------------------------------------------------------- */
630
631 int
632 udf_statvfs(struct mount *mp, struct statvfs *sbp, struct lwp *l)
633 {
634 struct udf_mount *ump = VFSTOUDF(mp);
635 struct logvol_int_desc *lvid;
636 struct udf_logvol_info *impl;
637 uint64_t freeblks, sizeblks;
638 uint32_t *pos1, *pos2;
639 int part, num_part;
640
641 DPRINTF(CALL, ("udf_statvfs called\n"));
642 sbp->f_flag = mp->mnt_flag;
643 sbp->f_bsize = ump->discinfo.sector_size;
644 sbp->f_frsize = ump->discinfo.sector_size;
645 sbp->f_iosize = ump->discinfo.sector_size;
646
647 /* TODO integrity locking */
648 /* free and used space for mountpoint based on logvol integrity */
649 lvid = ump->logvol_integrity;
650 if (lvid) {
651 num_part = udf_rw32(lvid->num_part);
652 impl = (struct udf_logvol_info *) (lvid->tables + 2*num_part);
653
654 freeblks = sizeblks = 0;
655 for (part=0; part < num_part; part++) {
656 pos1 = &lvid->tables[0] + part;
657 pos2 = &lvid->tables[0] + num_part + part;
658 if (udf_rw32(*pos1) != (uint32_t) -1) {
659 freeblks += udf_rw32(*pos1);
660 sizeblks += udf_rw32(*pos2);
661 }
662 }
663 sbp->f_blocks = sizeblks;
664 sbp->f_bfree = freeblks;
665 sbp->f_files = udf_rw32(impl->num_files);
666 sbp->f_files += udf_rw32(impl->num_directories);
667
668 /* XXX read only for now XXX */
669 sbp->f_bavail = 0;
670 sbp->f_bresvd = 0;
671
672 /* tricky, next only aplies to ffs i think, so set to zero */
673 sbp->f_ffree = 0;
674 sbp->f_favail = 0;
675 sbp->f_fresvd = 0;
676 }
677
678 copy_statvfs_info(sbp, mp);
679 return 0;
680 }
681
682 /* --------------------------------------------------------------------- */
683
684 int
685 udf_sync(struct mount *mp, int waitfor,
686 kauth_cred_t cred, struct lwp *p)
687 {
688 DPRINTF(CALL, ("udf_sync called\n"));
689 /* nothing to be done as upto now read-only */
690 return 0;
691 }
692
693 /* --------------------------------------------------------------------- */
694
695 /*
696 * Get vnode for the file system type specific file id ino for the fs. Its
697 * used for reference to files by unique ID and for NFSv3.
698 * (optional) TODO lookup why some sources state NFSv3
699 */
700 int
701 udf_vget(struct mount *mp, ino_t ino,
702 struct vnode **vpp)
703 {
704 DPRINTF(NOTIMPL, ("udf_vget called\n"));
705 return EOPNOTSUPP;
706 }
707
708 /* --------------------------------------------------------------------- */
709
710 /*
711 * Lookup vnode for file handle specified
712 */
713 int
714 udf_fhtovp(struct mount *mp, struct fid *fhp,
715 struct vnode **vpp)
716 {
717 DPRINTF(NOTIMPL, ("udf_fhtovp called\n"));
718 return EOPNOTSUPP;
719 }
720
721 /* --------------------------------------------------------------------- */
722
723 /*
724 * Create an unique file handle. Its structure is opaque and won't be used by
725 * other subsystems. It should uniquely identify the file in the filingsystem
726 * and enough information to know if a file has been removed and/or resources
727 * have been recycled.
728 */
729 int
730 udf_vptofh(struct vnode *vp, struct fid *fid,
731 size_t *fh_size)
732 {
733 DPRINTF(NOTIMPL, ("udf_vptofh called\n"));
734 return EOPNOTSUPP;
735 }
736
737 /* --------------------------------------------------------------------- */
738
739 /*
740 * Create a filingsystem snapshot at the specified timestamp. Could be
741 * implemented by explicitly creating a new session or with spare room in the
742 * integrity descriptor space
743 */
744 int
745 udf_snapshot(struct mount *mp, struct vnode *vp,
746 struct timespec *tm)
747 {
748 DPRINTF(NOTIMPL, ("udf_snapshot called\n"));
749 return EOPNOTSUPP;
750 }
751
752 /* --------------------------------------------------------------------- */
753
754 /*
755 * If running a DEBUG kernel, provide an easy way to set the debug flags when
756 * running into a problem.
757 */
758
759 #ifdef DEBUG
760 #define UDF_VERBOSE_SYSCTLOPT 1
761
762 SYSCTL_SETUP(sysctl_vfs_udf_setup, "sysctl vfs.udf subtree setup")
763 {
764 /*
765 * XXX the "24" below could be dynamic, thereby eliminating one
766 * more instance of the "number to vfs" mapping problem, but
767 * "24" is the order as taken from sys/mount.h
768 */
769
770 sysctl_createv(clog, 0, NULL, NULL,
771 CTLFLAG_PERMANENT,
772 CTLTYPE_NODE, "vfs", NULL,
773 NULL, 0, NULL, 0,
774 CTL_VFS, CTL_EOL);
775 sysctl_createv(clog, 0, NULL, NULL,
776 CTLFLAG_PERMANENT,
777 CTLTYPE_NODE, "udf",
778 SYSCTL_DESCR("OSTA Universal File System"),
779 NULL, 0, NULL, 0,
780 CTL_VFS, 24, CTL_EOL);
781
782 sysctl_createv(clog, 0, NULL, NULL,
783 CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
784 CTLTYPE_INT, "verbose",
785 SYSCTL_DESCR("Bitmask for filesystem debugging"),
786 NULL, 0, &udf_verbose, 0,
787 CTL_VFS, 24, UDF_VERBOSE_SYSCTLOPT, CTL_EOL);
788 }
789
790 #endif /* DEBUG */
791
792