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