hfs_vfsops.c revision 1.16 1 /* $NetBSD: hfs_vfsops.c,v 1.16 2008/01/28 14:31:16 dholland Exp $ */
2
3 /*-
4 * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Yevgeny Binder and Dieter Baron.
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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /*
33 * Copyright (c) 1991, 1993, 1994
34 * The Regents of the University of California. All rights reserved.
35 * (c) UNIX System Laboratories, Inc.
36 * All or some portions of this file are derived from material licensed
37 * to the University of California by American Telephone and Telegraph
38 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
39 * the permission of UNIX System Laboratories, Inc.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. Neither the name of the University nor the names of its contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 */
65
66 /*
67 * Copyright (c) 1989, 1991, 1993, 1994
68 * The Regents of the University of California. All rights reserved.
69 *
70 * Redistribution and use in source and binary forms, with or without
71 * modification, are permitted provided that the following conditions
72 * are met:
73 * 1. Redistributions of source code must retain the above copyright
74 * notice, this list of conditions and the following disclaimer.
75 * 2. Redistributions in binary form must reproduce the above copyright
76 * notice, this list of conditions and the following disclaimer in the
77 * documentation and/or other materials provided with the distribution.
78 * 3. Neither the name of the University nor the names of its contributors
79 * may be used to endorse or promote products derived from this software
80 * without specific prior written permission.
81 *
82 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
83 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
84 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
85 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
86 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
87 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
88 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
89 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
90 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
91 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
92 * SUCH DAMAGE.
93 */
94
95
96
97 /*
98 * Apple HFS+ filesystem
99 */
100
101 #include <sys/cdefs.h>
102 __KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.16 2008/01/28 14:31:16 dholland Exp $");
103
104 #ifdef _KERNEL_OPT
105 #include "opt_compat_netbsd.h"
106 #endif
107
108 #include <sys/param.h>
109 #include <sys/systm.h>
110 #include <sys/namei.h>
111 #include <sys/proc.h>
112 #include <sys/kernel.h>
113 #include <sys/vnode.h>
114 #include <sys/socket.h>
115 #include <sys/mount.h>
116 #include <sys/buf.h>
117 #include <sys/device.h>
118 #include <sys/mbuf.h>
119 #include <sys/file.h>
120 #include <sys/disklabel.h>
121 #include <sys/ioctl.h>
122 #include <sys/errno.h>
123 #include <sys/malloc.h>
124 #include <sys/pool.h>
125 #include <sys/lock.h>
126 #include <sys/sysctl.h>
127 #include <sys/conf.h>
128 #include <sys/kauth.h>
129 #include <sys/stat.h>
130
131 #include <miscfs/genfs/genfs.h>
132 #include <miscfs/specfs/specdev.h>
133
134 #include <fs/hfs/hfs.h>
135 #include <fs/hfs/libhfs.h>
136
137 MALLOC_JUSTDEFINE(M_HFSMNT, "hfs mount", "hfs mount structures");
138
139 extern kmutex_t hfs_hashlock;
140
141 const struct vnodeopv_desc * const hfs_vnodeopv_descs[] = {
142 &hfs_vnodeop_opv_desc,
143 &hfs_specop_opv_desc,
144 &hfs_fifoop_opv_desc,
145 NULL,
146 };
147
148 struct vfsops hfs_vfsops = {
149 MOUNT_HFS,
150 sizeof (struct hfs_args),
151 hfs_mount,
152 hfs_start,
153 hfs_unmount,
154 hfs_root,
155 (void *)eopnotsupp, /* vfs_quotactl */
156 hfs_statvfs,
157 hfs_sync,
158 hfs_vget,
159 hfs_fhtovp,
160 hfs_vptofh,
161 hfs_init,
162 hfs_reinit,
163 hfs_done,
164 NULL, /* vfs_mountroot */
165 NULL, /* vfs_snapshot */
166 vfs_stdextattrctl,
167 (void *)eopnotsupp, /* vfs_suspendctl */
168 genfs_renamelock_enter,
169 genfs_renamelock_exit,
170 hfs_vnodeopv_descs,
171 0,
172 { NULL, NULL },
173 };
174 VFS_ATTACH(hfs_vfsops); /* XXX Is this needed? */
175
176 static const struct genfs_ops hfs_genfsops = {
177 .gop_size = genfs_size,
178 };
179
180 int
181 hfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
182 {
183 struct lwp *l = curlwp;
184 struct nameidata nd;
185 struct hfs_args *args = data;
186 struct vnode *devvp;
187 struct hfsmount *hmp;
188 int error;
189 int update;
190 mode_t accessmode;
191
192 if (*data_len < sizeof *args)
193 return EINVAL;
194
195 #ifdef HFS_DEBUG
196 printf("vfsop = hfs_mount()\n");
197 #endif /* HFS_DEBUG */
198
199 if (mp->mnt_flag & MNT_GETARGS) {
200 hmp = VFSTOHFS(mp);
201 if (hmp == NULL)
202 return EIO;
203 args->fspec = NULL;
204 *data_len = sizeof *args;
205 return 0;
206 }
207
208 if (data == NULL)
209 return EINVAL;
210
211 /* FIXME: For development ONLY - disallow remounting for now */
212 #if 0
213 update = mp->mnt_flag & MNT_UPDATE;
214 #else
215 update = 0;
216 #endif
217
218 /* Check arguments */
219 if (args->fspec != NULL) {
220 /*
221 * Look up the name and verify that it's sane.
222 */
223 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec);
224 if ((error = namei(&nd)) != 0)
225 return error;
226 devvp = nd.ni_vp;
227
228 if (!update) {
229 /*
230 * Be sure this is a valid block device
231 */
232 if (devvp->v_type != VBLK)
233 error = ENOTBLK;
234 else if (bdevsw_lookup(devvp->v_rdev) == NULL)
235 error = ENXIO;
236 } else {
237 /*
238 * Be sure we're still naming the same device
239 * used for our initial mount
240 */
241 hmp = VFSTOHFS(mp);
242 if (devvp != hmp->hm_devvp)
243 error = EINVAL;
244 }
245 } else {
246 if (update) {
247 /* Use the extant mount */
248 hmp = VFSTOHFS(mp);
249 devvp = hmp->hm_devvp;
250 vref(devvp);
251 } else {
252 /* New mounts must have a filename for the device */
253 return EINVAL;
254 }
255 }
256
257
258 /*
259 * If mount by non-root, then verify that user has necessary
260 * permissions on the device.
261 */
262 if (error == 0 && kauth_authorize_generic(l->l_cred,
263 KAUTH_GENERIC_ISSUSER, NULL) != 0) {
264 accessmode = VREAD;
265 if (update ?
266 (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
267 (mp->mnt_flag & MNT_RDONLY) == 0)
268 accessmode |= VWRITE;
269 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
270 error = VOP_ACCESS(devvp, accessmode, l->l_cred);
271 VOP_UNLOCK(devvp, 0);
272 }
273
274 if (error != 0)
275 goto error;
276
277 if (update) {
278 printf("HFS: live remounting not yet supported!\n");
279 error = EINVAL;
280 goto error;
281 }
282
283 if ((error = hfs_mountfs(devvp, mp, l, args->fspec)) != 0)
284 goto error;
285
286 error = set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
287 mp->mnt_op->vfs_name, mp, l);
288
289 #ifdef HFS_DEBUG
290 if(!update) {
291 char* volname;
292
293 hmp = VFSTOHFS(mp);
294 volname = malloc(hmp->hm_vol.name.length + 1, M_TEMP, M_WAITOK);
295 if (volname == NULL)
296 printf("could not allocate volname; ignored\n");
297 else {
298 if (hfs_unicode_to_ascii(hmp->hm_vol.name.unicode,
299 hmp->hm_vol.name.length, volname) == NULL)
300 printf("could not convert volume name to ascii; ignored\n");
301 else
302 printf("mounted volume \"%s\"\n", volname);
303 free(volname, M_TEMP);
304 }
305 }
306 #endif /* HFS_DEBUG */
307
308 return error;
309
310 error:
311 vrele(devvp);
312 return error;
313 }
314
315 int
316 hfs_start(struct mount *mp, int flags)
317 {
318
319 #ifdef HFS_DEBUG
320 printf("vfsop = hfs_start()\n");
321 #endif /* HFS_DEBUG */
322
323 return 0;
324 }
325
326 int
327 hfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l,
328 const char *devpath)
329 {
330 hfs_callback_args cbargs;
331 hfs_libcb_argsopen argsopen;
332 hfs_libcb_argsread argsread;
333 struct hfsmount *hmp;
334 kauth_cred_t cred;
335 int error;
336
337 cred = l ? l->l_cred : NOCRED;
338 error = 0;
339 hmp = NULL;
340
341 /* Create mounted volume structure. */
342 hmp = (struct hfsmount*)malloc(sizeof(struct hfsmount),
343 M_HFSMNT, M_WAITOK);
344 if (hmp == NULL) {
345 error = ENOMEM;
346 goto error;
347 }
348 memset(hmp, 0, sizeof(struct hfsmount));
349
350 mp->mnt_data = hmp;
351 mp->mnt_flag |= MNT_LOCAL;
352 vfs_getnewfsid(mp);
353
354 hmp->hm_mountp = mp;
355 hmp->hm_dev = devvp->v_rdev;
356 hmp->hm_devvp = devvp;
357
358 /*
359 * Use libhfs to open the volume and read the volume header and other
360 * useful information.
361 */
362
363 hfslib_init_cbargs(&cbargs);
364 argsopen.cred = argsread.cred = cred;
365 argsopen.l = argsread.l = l;
366 argsopen.devvp = devvp;
367 cbargs.read = (void*)&argsread;
368 cbargs.openvol = (void*)&argsopen;
369
370 if ((error = hfslib_open_volume(devpath, mp->mnt_flag & MNT_RDONLY,
371 &hmp->hm_vol, &cbargs)) != 0)
372 goto error;
373
374 /* Make sure this is not a journaled volume whose journal is dirty. */
375 if (!hfslib_is_journal_clean(&hmp->hm_vol)) {
376 printf("volume journal is dirty; not mounting\n");
377 error = EIO;
378 goto error;
379 }
380
381 mp->mnt_fs_bshift = 0;
382 while ((1 << mp->mnt_fs_bshift) < hmp->hm_vol.vh.block_size)
383 mp->mnt_fs_bshift++;
384 mp->mnt_dev_bshift = DEV_BSHIFT;
385
386 return 0;
387
388 error:
389 if (hmp != NULL)
390 free(hmp, M_HFSMNT);
391
392 return error;
393 }
394
395 int
396 hfs_unmount(struct mount *mp, int mntflags)
397 {
398 hfs_callback_args cbargs;
399 hfs_libcb_argsread argsclose;
400 struct hfsmount* hmp;
401 int error;
402 int flags;
403
404 #ifdef HFS_DEBUG
405 printf("vfsop = hfs_unmount()\n");
406 #endif /* HFS_DEBUG */
407
408 hmp = VFSTOHFS(mp);
409
410 flags = 0;
411 if (mntflags & MNT_FORCE)
412 flags |= FORCECLOSE;
413
414 if ((error = vflush(mp, NULLVP, flags)) != 0)
415 return error;
416
417 hfslib_init_cbargs(&cbargs);
418 argsclose.l = curlwp;
419 cbargs.closevol = (void*)&argsclose;
420 hfslib_close_volume(&hmp->hm_vol, &cbargs);
421
422 vput(hmp->hm_devvp);
423
424 free(hmp, M_HFSMNT);
425 mp->mnt_data = NULL;
426 mp->mnt_flag &= ~MNT_LOCAL;
427
428 return error;
429 }
430
431 int
432 hfs_root(struct mount *mp, struct vnode **vpp)
433 {
434 struct vnode *nvp;
435 int error;
436
437 #ifdef HFS_DEBUG
438 printf("vfsop = hfs_root()\n");
439 #endif /* HFS_DEBUG */
440
441 if ((error = VFS_VGET(mp, HFS_CNID_ROOT_FOLDER, &nvp)) != 0)
442 return error;
443 *vpp = nvp;
444
445 return 0;
446 }
447
448 int
449 hfs_statvfs(struct mount *mp, struct statvfs *sbp)
450 {
451 hfs_volume_header_t *vh;
452
453 #ifdef HFS_DEBUG
454 printf("vfsop = hfs_statvfs()\n");
455 #endif /* HFS_DEBUG */
456
457 vh = &VFSTOHFS(mp)->hm_vol.vh;
458
459 sbp->f_bsize = vh->block_size;
460 sbp->f_frsize = sbp->f_bsize;
461 sbp->f_iosize = 4096;/* mac os x uses a 4 kb io size, so do the same */
462 sbp->f_blocks = vh->total_blocks;
463 sbp->f_bfree = vh->free_blocks; /* total free blocks */
464 sbp->f_bavail = vh->free_blocks; /* blocks free for non superuser */
465 sbp->f_bresvd = 0;
466 sbp->f_files = vh->file_count; /* total files */
467 sbp->f_ffree = (1<<31) - vh->file_count; /* free file nodes */
468 copy_statvfs_info(sbp, mp);
469
470 return 0;
471 }
472
473 int
474 hfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
475 {
476
477 #ifdef HFS_DEBUG
478 printf("vfsop = hfs_sync()\n");
479 #endif /* HFS_DEBUG */
480
481 return 0;
482 }
483
484 /*
485 * an ino_t corresponds directly to a CNID in our particular case,
486 * since both are conveniently 32-bit numbers
487 */
488 int
489 hfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
490 {
491 return hfs_vget_internal(mp, ino, HFS_DATAFORK, vpp);
492 }
493
494 /*
495 * internal version with extra arguments to allow accessing resource fork
496 */
497 int
498 hfs_vget_internal(struct mount *mp, ino_t ino, uint8_t fork,
499 struct vnode **vpp)
500 {
501 struct hfsmount *hmp;
502 struct hfsnode *hnode;
503 struct vnode *vp;
504 hfs_callback_args cbargs;
505 hfs_cnid_t cnid;
506 hfs_catalog_keyed_record_t rec;
507 hfs_catalog_key_t key; /* the search key used to find this file on disk */
508 dev_t dev;
509 int error;
510
511 #ifdef HFS_DEBUG
512 printf("vfsop = hfs_vget()\n");
513 #endif /* HFS_DEBUG */
514
515 hnode = NULL;
516 vp = NULL;
517 hmp = VFSTOHFS(mp);
518 dev = hmp->hm_dev;
519 cnid = (hfs_cnid_t)ino;
520
521 if (fork != HFS_RSRCFORK)
522 fork = HFS_DATAFORK;
523
524 retry:
525 /* Check if this vnode has already been allocated. If so, just return it. */
526 if ((*vpp = hfs_nhashget(dev, cnid, fork, LK_EXCLUSIVE)) != NULL)
527 return 0;
528
529 /* Allocate a new vnode/inode. */
530 if ((error = getnewvnode(VT_HFS, mp, hfs_vnodeop_p, &vp)) != 0)
531 goto error;
532 MALLOC(hnode, struct hfsnode *, sizeof(struct hfsnode), M_TEMP,
533 M_WAITOK + M_ZERO);
534
535 /*
536 * If someone beat us to it while sleeping in getnewvnode(),
537 * push back the freshly allocated vnode we don't need, and return.
538 */
539 mutex_enter(&hfs_hashlock);
540 if (hfs_nhashget(dev, cnid, fork, 0) != NULL) {
541 mutex_exit(&hfs_hashlock);
542 ungetnewvnode(vp);
543 FREE(hnode, M_TEMP);
544 goto retry;
545 }
546
547 vp->v_vflag |= VV_LOCKSWORK;
548 vp->v_data = hnode;
549 genfs_node_init(vp, &hfs_genfsops);
550
551 hnode->h_vnode = vp;
552 hnode->h_hmp = hmp;
553 hnode->dummy = 0x1337BABE;
554
555 /*
556 * We need to put this vnode into the hash chain and lock it so that other
557 * requests for this inode will block if they arrive while we are sleeping
558 * waiting for old data structures to be purged or for the contents of the
559 * disk portion of this inode to be read. The hash chain requires the node's
560 * device and cnid to be known. Since this information was passed in the
561 * arguments, fill in the appropriate hfsnode fields without reading having
562 * to read the disk.
563 */
564 hnode->h_dev = dev;
565 hnode->h_rec.cnid = cnid;
566 hnode->h_fork = fork;
567
568 hfs_nhashinsert(hnode);
569 mutex_exit(&hfs_hashlock);
570
571
572 /*
573 * Read catalog record from disk.
574 */
575 hfslib_init_cbargs(&cbargs);
576
577 if (hfslib_find_catalog_record_with_cnid(&hmp->hm_vol, cnid,
578 &rec, &key, &cbargs) != 0) {
579 vput(vp);
580 error = EBADF;
581 goto error;
582 }
583
584 memcpy(&hnode->h_rec, &rec, sizeof(hnode->h_rec));
585 hnode->h_parent = key.parent_cnid;
586
587 /* XXX Eventually need to add an "ignore permissions" mount option */
588
589 /*
590 * Now convert some of the catalog record's fields into values that make
591 * sense on this system.
592 */
593 /* DATE AND TIME */
594
595 /*
596 * Initialize the vnode from the hfsnode, check for aliases.
597 * Note that the underlying vnode may change.
598 */
599 hfs_vinit(mp, hfs_specop_p, hfs_fifoop_p, &vp);
600
601 hnode->h_devvp = hmp->hm_devvp;
602 VREF(hnode->h_devvp); /* Increment the ref count to the volume's device. */
603
604 /* Make sure UVM has allocated enough memory. (?) */
605 if (hnode->h_rec.rec_type == HFS_REC_FILE) {
606 if (hnode->h_fork == HFS_DATAFORK)
607 uvm_vnp_setsize(vp,
608 hnode->h_rec.file.data_fork.logical_size);
609 else
610 uvm_vnp_setsize(vp,
611 hnode->h_rec.file.rsrc_fork.logical_size);
612 }
613 else
614 uvm_vnp_setsize(vp, 0); /* no directly reading directories */
615
616 *vpp = vp;
617
618 return 0;
619
620 error:
621 *vpp = NULL;
622 return error;
623 }
624
625 int
626 hfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
627 {
628
629 #ifdef HFS_DEBUG
630 printf("vfsop = hfs_fhtovp()\n");
631 #endif /* HFS_DEBUG */
632
633 return EOPNOTSUPP;
634 }
635
636 int
637 hfs_vptofh(struct vnode *vp, struct fid *fhp, size_t *fh_size)
638 {
639
640 #ifdef HFS_DEBUG
641 printf("vfsop = hfs_vptofh()\n");
642 #endif /* HFS_DEBUG */
643
644 return EOPNOTSUPP;
645 }
646
647 void
648 hfs_init(void)
649 {
650 hfs_callbacks callbacks;
651
652 #ifdef HFS_DEBUG
653 printf("vfsop = hfs_init()\n");
654 #endif /* HFS_DEBUG */
655
656 malloc_type_attach(M_HFSMNT);
657
658 callbacks.error = hfs_libcb_error;
659 callbacks.allocmem = hfs_libcb_malloc;
660 callbacks.reallocmem = hfs_libcb_realloc;
661 callbacks.freemem = hfs_libcb_free;
662 callbacks.openvol = hfs_libcb_opendev;
663 callbacks.closevol = hfs_libcb_closedev;
664 callbacks.read = hfs_libcb_read;
665
666 hfs_nhashinit();
667 hfslib_init(&callbacks);
668 }
669
670 void
671 hfs_reinit(void)
672 {
673
674 #ifdef HFS_DEBUG
675 printf("vfsop = hfs_reinit()\n");
676 #endif /* HFS_DEBUG */
677
678 return;
679 }
680
681 void
682 hfs_done(void)
683 {
684
685 #ifdef HFS_DEBUG
686 printf("vfsop = hfs_done()\n");
687 #endif /* HFS_DEBUG */
688
689 malloc_type_detach(M_HFSMNT);
690
691 hfslib_done();
692 hfs_nhashdone();
693 }
694
695 int
696 hfs_mountroot(void)
697 {
698
699 #ifdef HFS_DEBUG
700 printf("vfsop = hfs_mountroot()\n");
701 #endif /* HFS_DEBUG */
702
703 return EOPNOTSUPP;
704 }
705