summaryrefslogtreecommitdiffstats
path: root/sys/fs/ntfs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-03 21:36:41 +0000
committerphk <phk@FreeBSD.org>2004-11-03 21:36:41 +0000
commit247b99a09435c4a5ab152e76016bcc11ba75dc91 (patch)
tree5a907d2f4120992200b963076bfd8ae9cd5ea454 /sys/fs/ntfs
parent34a530853df4fb3d027482ec079ec1aa17b0dffa (diff)
downloadFreeBSD-src-247b99a09435c4a5ab152e76016bcc11ba75dc91.zip
FreeBSD-src-247b99a09435c4a5ab152e76016bcc11ba75dc91.tar.gz
Make a more whole-hearted attempt at GEOM'ifying NTFS.
I must have been sleepy when I did the first pass. Spotted by: tegge
Diffstat (limited to 'sys/fs/ntfs')
-rw-r--r--sys/fs/ntfs/ntfs.h3
-rw-r--r--sys/fs/ntfs/ntfs_subr.c4
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c23
3 files changed, 21 insertions, 9 deletions
diff --git a/sys/fs/ntfs/ntfs.h b/sys/fs/ntfs/ntfs.h
index 1940ee9..05560b1 100644
--- a/sys/fs/ntfs/ntfs.h
+++ b/sys/fs/ntfs/ntfs.h
@@ -241,7 +241,8 @@ struct bootfile {
struct ntfsmount {
struct mount *ntm_mountp; /* filesystem vfs structure */
struct bootfile ntm_bootfile;
- struct cdev *ntm_dev; /* device mounted */
+ struct g_consumer *ntm_cp;
+ struct bufobj *ntm_bo;
struct vnode *ntm_devvp; /* block device mounted vnode */
struct vnode *ntm_sysvn[NTFS_SYSNODESNUM];
u_int32_t ntm_bpmftrec;
diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c
index 0b2b53e..1ca9ffa 100644
--- a/sys/fs/ntfs/ntfs_subr.c
+++ b/sys/fs/ntfs/ntfs_subr.c
@@ -382,7 +382,8 @@ ntfs_ntlookup(
dprintf(("ntfs_ntlookup: looking for ntnode %d\n", ino));
do {
- if ((ip = ntfs_nthashlookup(ntmp->ntm_dev, ino)) != NULL) {
+ ip = ntfs_nthashlookup(ntmp->ntm_devvp->v_rdev, ino);
+ if (ip != NULL) {
ntfs_ntget(ip);
dprintf(("ntfs_ntlookup: ntnode %d: %p, usecount: %d\n",
ino, ip, ip->i_usecount));
@@ -398,7 +399,6 @@ ntfs_ntlookup(
/* Generic initialization */
ip->i_devvp = ntmp->ntm_devvp;
- ip->i_dev = ntmp->ntm_dev;
ip->i_number = ino;
ip->i_mp = ntmp;
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 4b260cc..a1f5347 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -43,6 +43,9 @@
#include <sys/malloc.h>
#include <sys/systm.h>
+#include <geom/geom.h>
+#include <geom/geom_vfs.h>
+
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
@@ -277,10 +280,15 @@ ntfs_mountfs(devvp, mp, argsp, td)
struct cdev *dev = devvp->v_rdev;
int error, ronly, i;
struct vnode *vp;
+ struct g_consumer *cp;
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
+ DROP_GIANT();
+ g_topology_lock();
+ error = g_vfs_open(devvp, &cp, "ffs", ronly ? 0 : 1);
+ g_topology_unlock();
+ PICKUP_GIANT();
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
@@ -323,12 +331,13 @@ ntfs_mountfs(devvp, mp, argsp, td)
(u_int32_t)ntmp->ntm_mftcn,(u_int32_t)ntmp->ntm_mftmirrcn));
ntmp->ntm_mountp = mp;
- ntmp->ntm_dev = dev;
ntmp->ntm_devvp = devvp;
ntmp->ntm_uid = argsp->uid;
ntmp->ntm_gid = argsp->gid;
ntmp->ntm_mode = argsp->mode;
ntmp->ntm_flag = argsp->flag;
+ ntmp->ntm_cp = cp;
+ ntmp->ntm_bo = &devvp->v_bufobj;
/* Copy in the 8-bit to Unicode conversion table */
/* Initialize Unicode to 8-bit table from 8toU table */
@@ -456,7 +465,7 @@ ntfs_unmount(
struct thread *td)
{
struct ntfsmount *ntmp;
- int error, ronly, flags, i;
+ int error, flags, i;
dprintf(("ntfs_unmount: unmounting...\n"));
ntmp = VFSTONTFS(mp);
@@ -488,9 +497,11 @@ ntfs_unmount(
vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, td, 0, 0);
- ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
- error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE,
- NOCRED, td);
+ DROP_GIANT();
+ g_topology_lock();
+ g_wither_geom_close(ntmp->ntm_cp->geom, ENXIO);
+ g_topology_unlock();
+ PICKUP_GIANT();
vrele(ntmp->ntm_devvp);
OpenPOWER on IntegriCloud