1 /* $NetBSD: ntfs_vfsops.c,v 1.23 1999/11/15 19:38:14 jdolecek Exp $ */
4 * Copyright (c) 1998, 1999 Semen Ustimenko
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/namei.h>
37 #include <sys/kernel.h>
38 #include <sys/vnode.h>
39 #include <sys/mount.h>
41 #include <sys/fcntl.h>
42 #include <sys/malloc.h>
43 #include <sys/systm.h>
44 #if defined(__NetBSD__)
45 #include <sys/device.h>
49 #include <vm/vm_param.h>
50 #if defined(__NetBSD__)
51 #include <vm/vm_prot.h>
53 #include <vm/vm_page.h>
54 #include <vm/vm_object.h>
55 #include <vm/vm_extern.h>
56 #include <vm/vm_zone.h>
58 #if defined(__NetBSD__)
59 #include <miscfs/specfs/specdev.h>
62 /*#define NTFS_DEBUG 1*/
63 #include <ntfs/ntfs.h>
64 #include <ntfs/ntfs_inode.h>
65 #include <ntfs/ntfs_subr.h>
66 #include <ntfs/ntfs_vfsops.h>
67 #include <ntfs/ntfs_ihash.h>
68 #include <ntfs/ntfsmount.h>
70 #if defined(__FreeBSD__)
71 MALLOC_DEFINE(M_NTFSMNT, "NTFS mount", "NTFS mount structure");
72 MALLOC_DEFINE(M_NTFSNTNODE,"NTFS ntnode", "NTFS ntnode information");
73 MALLOC_DEFINE(M_NTFSFNODE,"NTFS fnode", "NTFS fnode information");
74 MALLOC_DEFINE(M_NTFSDIR,"NTFS dir", "NTFS dir buffer");
77 static int ntfs_root __P((struct mount *, struct vnode **));
78 static int ntfs_statfs __P((struct mount *, struct statfs *,
80 static int ntfs_unmount __P((struct mount *, int, struct proc *));
81 static int ntfs_vget __P((struct mount *mp, ino_t ino,
83 static int ntfs_mountfs __P((register struct vnode *, struct mount *,
84 struct ntfs_args *, struct proc *));
85 static int ntfs_vptofh __P((struct vnode *, struct fid *));
86 static int ntfs_fhtovp __P((struct mount *, struct fid *,
89 #if !defined (__FreeBSD__)
90 static int ntfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
92 static int ntfs_start __P((struct mount *, int, struct proc *));
93 static int ntfs_sync __P((struct mount *, int, struct ucred *,
97 #if defined(__FreeBSD__)
99 static int ntfs_mount __P((struct mount *, char *, caddr_t,
100 struct nameidata *, struct proc *));
101 static int ntfs_init __P((struct vfsconf *));
102 static int ntfs_checkexp __P((struct mount *, struct sockaddr *,
103 int *, struct ucred **));
104 #elif defined(__NetBSD__)
105 static int ntfs_mount __P((struct mount *, const char *, void *,
106 struct nameidata *, struct proc *));
107 static void ntfs_init __P((void));
108 static int ntfs_mountroot __P((void));
109 static int ntfs_sysctl __P((int *, u_int, void *, size_t *, void *,
110 size_t, struct proc *));
111 static int ntfs_checkexp __P((struct mount *, struct mbuf *,
112 int *, struct ucred **));
116 * Verify a remote client has export rights and return these rights via.
117 * exflagsp and credanonp.
120 ntfs_checkexp(mp, nam, exflagsp, credanonp)
121 #if defined(__FreeBSD__)
122 register struct mount *mp;
123 struct sockaddr *nam;
125 struct ucred **credanonp;
126 #else /* defined(__NetBSD__) */
127 register struct mount *mp;
130 struct ucred **credanonp;
133 register struct netcred *np;
134 register struct ntfsmount *ntm = VFSTONTFS(mp);
137 * Get the export permission structure for this <mp, client> tuple.
139 np = vfs_export_lookup(mp, &ntm->ntm_export, nam);
143 *exflagsp = np->netc_exflags;
144 *credanonp = &np->netc_anon;
148 #if defined(__NetBSD__)
151 ntfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
167 extern struct vnode *rootvp;
168 struct proc *p = curproc; /* XXX */
170 struct ntfs_args args;
172 if (root_device->dv_class != DV_DISK)
176 * Get vnodes for rootdev.
178 if (bdevvp(rootdev, &rootvp))
179 panic("ntfs_mountroot: can't setup rootvp");
181 if ((error = vfs_rootmountalloc(MOUNT_NTFS, "root_device", &mp))) {
191 if ((error = ntfs_mountfs(rootvp, mp, &args, p)) != 0) {
192 mp->mnt_op->vfs_refcount--;
199 simple_lock(&mountlist_slock);
200 CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
201 simple_unlock(&mountlist_slock);
202 (void)ntfs_statfs(mp, &mp->mnt_stat, p);
214 #elif defined(__FreeBSD__)
218 struct vfsconf *vcp )
230 #if defined(__FreeBSD__)
237 struct nameidata *ndp,
243 struct ntfs_args args;
247 * Use NULL path to flag a root mount
252 * Mounting root file system
256 /* Get vnode for root device*/
257 if( bdevvp( rootdev, &rootvp))
258 panic("ffs_mountroot: can't setup bdevvp for root");
261 * FS specific handling
263 mp->mnt_flag |= MNT_RDONLY; /* XXX globally applicable?*/
268 if( ( err = ntfs_mountfs(rootvp, mp, &args, p)) != 0) {
269 /* fs specific cleanup (if any)*/
273 goto dostatfs; /* success*/
280 * Mounting non-root file system or updating a file system
284 /* copy in user arguments*/
285 err = copyin(data, (caddr_t)&args, sizeof (struct ntfs_args));
287 goto error_1; /* can't get arguments*/
290 * If updating, check whether changing from read-only to
291 * read/write; if there is no device name, that's all we do.
293 if (mp->mnt_flag & MNT_UPDATE) {
294 /* if not updating name...*/
295 if (args.fspec == 0) {
297 * Process export requests. Jumping to "success"
298 * will return the vfs_export() error code.
300 struct ntfsmount *ntm = VFSTONTFS(mp);
301 err = vfs_export(mp, &ntm->ntm_export, &args.export);
305 printf("ntfs_mount(): MNT_UPDATE not supported\n");
311 * Not an update, or updating the name: look up the name
312 * and verify that it refers to a sensible block device.
314 NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
317 /* can't get devvp!*/
320 NDFREE(ndp, NDF_ONLY_PNBUF);
323 #if defined(__FreeBSD__)
324 if (!vn_isdisk(devvp)) {
329 if (devvp->v_type != VBLK) {
333 if (major(devvp->v_rdev) >= nblkdev) {
338 if (mp->mnt_flag & MNT_UPDATE) {
346 if (devvp != ntmp->um_devvp)
347 err = EINVAL; /* needs translation */
351 * Update device name only on success
354 /* Save "mounted from" info for mount point (NULL pad)*/
355 copyinstr( args.fspec,
356 mp->mnt_stat.f_mntfromname,
359 bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
370 * Since this is a new mount, we want the names for
371 * the device and the mount point copied in. If an
372 * error occurs, the mountpoint is discarded by the
375 /* Save "last mounted on" info for mount point (NULL pad)*/
376 copyinstr( path, /* mount point*/
377 mp->mnt_stat.f_mntonname, /* save area*/
378 MNAMELEN - 1, /* max size*/
379 &size); /* real size*/
380 bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
382 /* Save "mounted from" info for mount point (NULL pad)*/
383 copyinstr( args.fspec, /* device name*/
384 mp->mnt_stat.f_mntfromname, /* save area*/
385 MNAMELEN - 1, /* max size*/
386 &size); /* real size*/
387 bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
389 err = ntfs_mountfs(devvp, mp, &args, p);
399 * Initialize FS stat information in mount struct; uses both
400 * mp->mnt_stat.f_mntonname and mp->mnt_stat.f_mntfromname
402 * This code is common to root and non-root mounts
404 (void)VFS_STATFS(mp, &mp->mnt_stat, p);
409 error_2: /* error with devvp held*/
411 /* release devvp before failing*/
414 error_1: /* no state to back out*/
421 * Common code for mount and mountroot
424 ntfs_mountfs(devvp, mp, argsp, p)
425 register struct vnode *devvp;
427 struct ntfs_args *argsp;
431 struct ntfsmount *ntmp;
432 dev_t dev = devvp->v_rdev;
433 int error, ronly, ncount, i;
437 * Disallow multiple mounts of the same device.
438 * Disallow mounting of a device that is currently in use
439 * (except for root, which might share swap device for miniroot).
440 * Flush out any old buffers remaining from a previous use.
442 error = vfs_mountedon(devvp);
445 ncount = vcount(devvp);
446 #if defined(__FreeBSD__)
450 if (ncount > 1 && devvp != rootvp)
452 #if defined(__FreeBSD__)
453 VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p);
454 error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0);
455 VOP__UNLOCK(devvp, 0, p);
457 error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0);
462 ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
463 VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p);
464 error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p);
465 VOP__UNLOCK(devvp, 0, p);
471 error = bread(devvp, BBLOCK, BBSIZE, NOCRED, &bp);
474 ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK );
475 bzero( ntmp, sizeof *ntmp );
476 bcopy( bp->b_data, &ntmp->ntm_bootfile, sizeof(struct bootfile) );
480 if (strncmp(ntmp->ntm_bootfile.bf_sysid, NTFS_BBID, NTFS_BBIDLEN)) {
482 dprintf(("ntfs_mountfs: invalid boot block\n"));
487 int8_t cpr = ntmp->ntm_mftrecsz;
489 ntmp->ntm_bpmftrec = ntmp->ntm_spc * cpr;
491 ntmp->ntm_bpmftrec = (1 << (-cpr)) / ntmp->ntm_bps;
493 dprintf(("ntfs_mountfs(): bps: %d, spc: %d, media: %x, mftrecsz: %d (%d sects)\n",
494 ntmp->ntm_bps,ntmp->ntm_spc,ntmp->ntm_bootfile.bf_media,
495 ntmp->ntm_mftrecsz,ntmp->ntm_bpmftrec));
496 dprintf(("ntfs_mountfs(): mftcn: 0x%x|0x%x\n",
497 (u_int32_t)ntmp->ntm_mftcn,(u_int32_t)ntmp->ntm_mftmirrcn));
499 ntmp->ntm_mountp = mp;
501 ntmp->ntm_devvp = devvp;
502 ntmp->ntm_uid = argsp->uid;
503 ntmp->ntm_gid = argsp->gid;
504 ntmp->ntm_mode = argsp->mode;
505 ntmp->ntm_flag = argsp->flag;
506 mp->mnt_data = (qaddr_t)ntmp;
508 dprintf(("ntfs_mountfs(): case-%s,%s uid: %d, gid: %d, mode: %o\n",
509 (ntmp->ntm_flag & NTFS_MFLAG_CASEINS)?"insens.":"sens.",
510 (ntmp->ntm_flag & NTFS_MFLAG_ALLNAMES)?" allnames,":"",
511 ntmp->ntm_uid, ntmp->ntm_gid, ntmp->ntm_mode));
514 * We read in some system nodes to do not allow
515 * reclaim them and to have everytime access to them.
518 int pi[3] = { NTFS_MFTINO, NTFS_ROOTINO, NTFS_BITMAPINO };
519 for (i=0; i<3; i++) {
520 error = VFS_VGET(mp, pi[i], &(ntmp->ntm_sysvn[pi[i]]));
523 ntmp->ntm_sysvn[pi[i]]->v_flag |= VSYSTEM;
524 VREF(ntmp->ntm_sysvn[pi[i]]);
525 vput(ntmp->ntm_sysvn[pi[i]]);
529 /* read the Unicode lowercase --> uppercase translation table,
531 if ((error = ntfs_toupper_use(mp, ntmp)))
535 * Scan $BitMap and count free clusters
537 error = ntfs_calccfree(ntmp, &ntmp->ntm_cfree);
542 * Read and translate to internal format attribute
550 error = VFS_VGET(mp, NTFS_ATTRDEFINO, &vp );
554 /* Count valid entries */
556 error = ntfs_readattr(ntmp, VTONT(vp),
558 num * sizeof(ad), sizeof(ad),
562 if (ad.ad_name[0] == 0)
566 /* Alloc memory for attribute definitions */
567 MALLOC(ntmp->ntm_ad, struct ntvattrdef *,
568 num * sizeof(struct ntvattrdef),
569 M_NTFSMNT, M_WAITOK);
571 ntmp->ntm_adnum = num;
573 /* Read them and translate */
575 error = ntfs_readattr(ntmp, VTONT(vp),
577 i * sizeof(ad), sizeof(ad),
583 ntmp->ntm_ad[i].ad_name[j] = ad.ad_name[j];
584 } while(ad.ad_name[j++]);
585 ntmp->ntm_ad[i].ad_namelen = j - 1;
586 ntmp->ntm_ad[i].ad_type = ad.ad_type;
592 #if defined(__FreeBSD__)
593 mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
594 mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
596 mp->mnt_stat.f_fsid.val[0] = dev;
597 mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_NTFS);
599 mp->mnt_maxsymlinklen = 0;
600 mp->mnt_flag |= MNT_LOCAL;
601 devvp->v_specmountpoint = mp;
605 for(i=0;i<NTFS_SYSNODESNUM;i++)
606 if(ntmp->ntm_sysvn[i]) vrele(ntmp->ntm_sysvn[i]);
608 if (vflush(mp,NULLVP,0))
609 dprintf(("ntfs_mountfs: vflush failed\n"));
612 devvp->v_specmountpoint = NULL;
616 #if defined __NetBSD__
617 /* lock the device vnode before calling VOP_CLOSE() */
618 VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p);
619 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
620 VOP__UNLOCK(devvp, 0, p);
622 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
628 #if !defined(__FreeBSD__)
645 register struct ntfsmount *ntmp;
646 int error, ronly = 0, flags, i;
648 dprintf(("ntfs_unmount: unmounting...\n"));
649 ntmp = VFSTONTFS(mp);
652 if(mntflags & MNT_FORCE)
655 dprintf(("ntfs_unmount: vflushing...\n"));
656 error = vflush(mp,NULLVP,flags | SKIPSYSTEM);
658 printf("ntfs_unmount: vflush failed: %d\n",error);
662 /* Check if only system vnodes are rest */
663 for(i=0;i<NTFS_SYSNODESNUM;i++)
664 if((ntmp->ntm_sysvn[i]) &&
665 (ntmp->ntm_sysvn[i]->v_usecount > 1)) return (EBUSY);
667 /* Dereference all system vnodes */
668 for(i=0;i<NTFS_SYSNODESNUM;i++)
669 if(ntmp->ntm_sysvn[i]) vrele(ntmp->ntm_sysvn[i]);
671 /* vflush system vnodes */
672 error = vflush(mp,NULLVP,flags);
674 printf("ntfs_unmount: vflush failed(sysnodes): %d\n",error);
676 /* Check if the type of device node isn't VBAD before
677 * touching v_specinfo. If the device vnode is revoked, the
678 * field is NULL and touching it causes null pointer derefercence.
680 if (ntmp->ntm_devvp->v_type != VBAD)
681 ntmp->ntm_devvp->v_specmountpoint = NULL;
683 vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, p, 0, 0);
685 #if defined(__NetBSD__)
686 /* lock the device vnode before calling VOP_CLOSE() */
687 VOP_LOCK(ntmp->ntm_devvp, LK_EXCLUSIVE | LK_RETRY);
688 error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE,
690 VOP__UNLOCK(ntmp->ntm_devvp, 0, p);
692 error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE,
696 vrele(ntmp->ntm_devvp);
698 /* free the toupper table, if this has been last mounted ntfs volume */
699 ntfs_toupper_unuse();
701 dprintf(("ntfs_umount: freeing memory...\n"));
702 mp->mnt_data = (qaddr_t)0;
703 mp->mnt_flag &= ~MNT_LOCAL;
704 FREE(ntmp->ntm_ad, M_NTFSMNT);
705 FREE(ntmp, M_NTFSMNT);
717 dprintf(("ntfs_root(): sysvn: %p\n",
718 VFSTONTFS(mp)->ntm_sysvn[NTFS_ROOTINO]));
719 error = VFS_VGET(mp, (ino_t)NTFS_ROOTINO, &nvp);
721 printf("ntfs_root: VFS_VGET failed: %d\n",error);
729 #if !defined(__FreeBSD__)
738 printf("\nntfs_quotactl():\n");
745 struct ntfsmount *ntmp,
754 vp = ntmp->ntm_sysvn[NTFS_BITMAPINO];
756 bmsize = VTOF(vp)->f_size;
758 MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK);
760 error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL,
761 0, bmsize, tmp, NULL);
765 for(i=0;i<bmsize;i++)
767 if(~tmp[i] & (1 << j)) cfree++;
781 struct ntfsmount *ntmp = VFSTONTFS(mp);
782 u_int64_t mftsize,mftallocated;
784 dprintf(("ntfs_statfs():\n"));
786 mftsize = VTOF(ntmp->ntm_sysvn[NTFS_MFTINO])->f_size;
787 mftallocated = VTOF(ntmp->ntm_sysvn[NTFS_MFTINO])->f_allocated;
789 #if defined(__FreeBSD__)
790 sbp->f_type = mp->mnt_vfc->vfc_typenum;
791 #elif defined(__NetBSD__)
794 sbp->f_type = MOUNT_NTFS;
796 sbp->f_bsize = ntmp->ntm_bps;
797 sbp->f_iosize = ntmp->ntm_bps * ntmp->ntm_spc;
798 sbp->f_blocks = ntmp->ntm_bootfile.bf_spv;
799 sbp->f_bfree = sbp->f_bavail = ntfs_cntobn(ntmp->ntm_cfree);
800 sbp->f_ffree = sbp->f_bfree / ntmp->ntm_bpmftrec;
801 sbp->f_files = mftallocated / ntfs_bntob(ntmp->ntm_bpmftrec) +
803 if (sbp != &mp->mnt_stat) {
804 bcopy((caddr_t)mp->mnt_stat.f_mntonname,
805 (caddr_t)&sbp->f_mntonname[0], MNAMELEN);
806 bcopy((caddr_t)mp->mnt_stat.f_mntfromname,
807 (caddr_t)&sbp->f_mntfromname[0], MNAMELEN);
809 sbp->f_flags = mp->mnt_flag;
811 strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN);
817 #if !defined(__FreeBSD__)
825 /*dprintf(("ntfs_sync():\n"));*/
838 struct ntfid *ntfhp = (struct ntfid *)fhp;
841 ddprintf(("ntfs_fhtovp(): %s: %d\n", mp->mnt_stat->f_mntonname,
844 if ((error = VFS_VGET(mp, ntfhp->ntfid_ino, &nvp)) != 0) {
848 /* XXX as unlink/rmdir/mkdir/creat are not currently possible
849 * with NTFS, we don't need to check anything else for now */
860 register struct ntnode *ntp;
861 register struct ntfid *ntfhp;
863 ddprintf(("ntfs_fhtovp(): %s: %p\n", vp->v_mount->mnt_stat->f_mntonname,
867 ntfhp = (struct ntfid *)fhp;
868 ntfhp->ntfid_len = sizeof(struct ntfid);
869 ntfhp->ntfid_ino = ntp->i_number;
870 /* ntfhp->ntfid_gen = ntp->i_gen; */
886 register struct ntfsmount *ntmp;
892 dprintf(("ntfs_vgetex: ino: %d, attr: 0x%x:%s, lkf: 0x%lx, f: 0x%lx\n",
893 ino, attrtype, attrname?attrname:"", (u_long)lkflags,
896 ntmp = VFSTONTFS(mp);
900 error = ntfs_ntlookup(ntmp, ino, &ip);
902 printf("ntfs_vget: ntfs_ntget failed\n");
906 /* It may be not initialized fully, so force load it */
907 if (!(flags & VG_DONTLOADIN) && !(ip->i_flag & IN_LOADED)) {
908 error = ntfs_loadntnode(ntmp, ip);
910 printf("ntfs_vget: CAN'T LOAD ATTRIBUTES FOR INO: %d\n",
917 error = ntfs_fget(ntmp, ip, attrtype, attrname, &fp);
919 printf("ntfs_vget: ntfs_fget failed\n");
925 if (!(flags & VG_DONTVALIDFN) && !(fp->f_flag & FN_VALID)) {
926 if ((ip->i_frflag & NTFS_FRFLAG_DIR) &&
927 (fp->f_attrtype == NTFS_A_DATA && fp->f_attrname == NULL)) {
929 } else if (flags & VG_EXT) {
931 fp->f_size = fp->f_allocated = 0;
935 error = ntfs_filesize(ntmp, fp,
936 &fp->f_size, &fp->f_allocated);
943 fp->f_flag |= FN_VALID;
947 VGET(FTOV(fp), lkflags, p);
953 error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, ntfs_vnodeop_p, &vp);
959 dprintf(("ntfs_vget: vnode: %p for ntnode: %d\n", vp,ino));
962 lockinit(&fp->f_lock, PINOD, "fnode", 0, 0);
968 if (ino == NTFS_ROOTINO)
973 if (lkflags & LK_TYPE_MASK) {
974 error = VN_LOCK(vp, lkflags, p);
993 return ntfs_vgetex(mp, ino, NTFS_A_DATA, NULL,
994 LK_EXCLUSIVE | LK_RETRY, 0, curproc, vpp);
997 #if defined(__FreeBSD__)
998 static struct vfsops ntfs_vfsops = {
1013 VFS_SET(ntfs_vfsops, ntfs, 0);
1014 #elif defined(__NetBSD__)
1015 extern struct vnodeopv_desc ntfs_vnodeop_opv_desc;
1017 struct vnodeopv_desc *ntfs_vnodeopv_descs[] = {
1018 &ntfs_vnodeop_opv_desc,
1022 struct vfsops ntfs_vfsops = {
1038 ntfs_vnodeopv_descs,
1040 #else /* !NetBSD && !FreeBSD */
1041 static struct vfsops ntfs_vfsops = {
1054 VFS_SET(ntfs_vfsops, ntfs, MOUNT_NTFS, 0);