Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ntfs make NTFS NFS exportable - that also means getfh(2)...
details: https://anonhg.NetBSD.org/src/rev/952bd60ff904
branches: trunk
changeset: 476249:952bd60ff904
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Fri Sep 10 16:14:02 1999 +0000
description:
make NTFS NFS exportable - that also means getfh(2) and other syscalls
using filehandles should work now for NTFS filesystem
some other misc cleanup
diffstat:
sys/ntfs/TODO | 2 -
sys/ntfs/ntfs_inode.h | 10 +++-
sys/ntfs/ntfs_vfsops.c | 131 +++++++++++++++++++++++++-----------------------
3 files changed, 77 insertions(+), 66 deletions(-)
diffs (274 lines):
diff -r 93c33ffd93e5 -r 952bd60ff904 sys/ntfs/TODO
--- a/sys/ntfs/TODO Fri Sep 10 15:41:51 1999 +0000
+++ b/sys/ntfs/TODO Fri Sep 10 16:14:02 1999 +0000
@@ -28,8 +28,6 @@
- working VOP_BALLOC()
(from Chuq)
-- make ntfs nfs exportable, for the completeness sake
-
- mountroot support
- implement writing into resident attributes, so it would be possible
diff -r 93c33ffd93e5 -r 952bd60ff904 sys/ntfs/ntfs_inode.h
--- a/sys/ntfs/ntfs_inode.h Fri Sep 10 15:41:51 1999 +0000
+++ b/sys/ntfs/ntfs_inode.h Fri Sep 10 16:14:02 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntfs_inode.h,v 1.3 1999/07/26 14:02:31 jdolecek Exp $ */
+/* $NetBSD: ntfs_inode.h,v 1.4 1999/09/10 16:14:03 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@@ -115,3 +115,11 @@
caddr_t f_dirblbuf;
u_int32_t f_dirblsz;
};
+
+/* This overlays the fid structure (see <sys/mount.h>) */
+struct ntfid {
+ u_int16_t ntfid_len; /* Length of structure. */
+ u_int16_t ntfid_pad; /* Force 32-bit alignment. */
+ ino_t ntfid_ino; /* File number (ino). */
+ int32_t ntfid_gen; /* Generation number. */
+};
diff -r 93c33ffd93e5 -r 952bd60ff904 sys/ntfs/ntfs_vfsops.c
--- a/sys/ntfs/ntfs_vfsops.c Fri Sep 10 15:41:51 1999 +0000
+++ b/sys/ntfs/ntfs_vfsops.c Fri Sep 10 16:14:02 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntfs_vfsops.c,v 1.9 1999/09/05 10:45:03 jdolecek Exp $ */
+/* $NetBSD: ntfs_vfsops.c,v 1.10 1999/09/10 16:14:03 jdolecek Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@@ -40,6 +40,8 @@
#include <sys/buf.h>
#include <sys/fcntl.h>
#include <sys/malloc.h>
+#include <sys/systm.h>
+#include <sys/device.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -110,7 +112,10 @@
#endif
#ifdef __NetBSD__
-/*ARGSUSED*/
+/*
+ * Verify a remote client has export rights and return these rights via.
+ * exflagsp and credanonp.
+ */
static int
ntfs_checkexp(mp, nam, exflagsp, credanonp)
register struct mount *mp;
@@ -118,8 +123,19 @@
int *exflagsp;
struct ucred **credanonp;
{
+ register struct netcred *np;
+ register struct ntfsmount *ntm = VFSTONTFS(mp);
- return (EINVAL);
+ /*
+ * Get the export permission structure for this <mp, client> tuple.
+ */
+ np = vfs_export_lookup(mp, &ntm->ntm_export, nam);
+ if (np == NULL)
+ return (EACCES);
+
+ *exflagsp = np->netc_exflags;
+ *credanonp = &np->netc_anon;
+ return (0);
}
/*ARGSUSED*/
@@ -141,26 +157,25 @@
{
return (EINVAL);
}
-#endif
-#if defined(__FreeBSD__)
+static void
+ntfs_init ()
+{
+ ntfs_nthashinit();
+}
+
+#elif defined(__FreeBSD__)
+
static int
ntfs_init (
struct vfsconf *vcp )
-#elif defined(__NetBSD__)
-static void
-ntfs_init ()
-#else
-static int
-ntfs_init ()
-#endif
{
ntfs_nthashinit();
-#if !defined(__NetBSD__)
return 0;
-#endif
}
+#endif /* NetBSD */
+
static int
ntfs_mount (
struct mount *mp,
@@ -179,6 +194,7 @@
struct vnode *devvp;
struct ntfs_args args;
+#ifdef __FreeBSD__
/*
* Use NULL path to flag a root mount
*/
@@ -209,6 +225,7 @@
goto dostatfs; /* success*/
}
+#endif /* FreeBSD */
/*
***
@@ -226,57 +243,20 @@
* read/write; if there is no device name, that's all we do.
*/
if (mp->mnt_flag & MNT_UPDATE) {
- printf("ntfs_mount(): MNT_UPDATE not supported\n");
- err = EINVAL;
- goto error_1;
-
-#if 0
- ump = VFSTOUFS(mp);
- fs = ump->um_fs;
- err = 0;
- if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
- flags = WRITECLOSE;
- if (mp->mnt_flag & MNT_FORCE)
- flags |= FORCECLOSE;
- if (vfs_busy(mp)) {
- err = EBUSY;
- goto error_1;
- }
- err = ffs_flushfiles(mp, flags, p);
- vfs_unbusy(mp);
- }
- if (!err && (mp->mnt_flag & MNT_RELOAD))
- err = ffs_reload(mp, ndp->ni_cnd.cn_cred, p);
- if (err) {
- goto error_1;
- }
- if (fs->fs_ronly && (mp->mnt_flag & MNT_WANTRDWR)) {
- if (!fs->fs_clean) {
- if (mp->mnt_flag & MNT_FORCE) {
- printf("WARNING: %s was not properly dismounted.\n",fs->fs_fsmnt);
- } else {
- printf("WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck.\n",
- fs->fs_fsmnt);
- err = EPERM;
- goto error_1;
- }
- }
- fs->fs_ronly = 0;
- }
- if (fs->fs_ronly == 0) {
- fs->fs_clean = 0;
- ffs_sbupdate(ump, MNT_WAIT);
- }
/* if not updating name...*/
if (args.fspec == 0) {
/*
* Process export requests. Jumping to "success"
* will return the vfs_export() error code.
*/
- err = vfs_export(mp, &ump->um_export, &args.export);
+ struct ntfsmount *ntm = VFSTONTFS(mp);
+ err = vfs_export(mp, &ntm->ntm_export, &args.export);
goto success;
}
-#endif
+
+ printf("ntfs_mount(): MNT_UPDATE not supported\n");
+ err = EINVAL;
+ goto error_1;
}
/*
@@ -361,7 +341,9 @@
goto error_2;
}
+#ifdef __FreeBSD__
dostatfs:
+#endif
/*
* Initialize FS stat information in mount struct; uses both
* mp->mnt_stat.f_mntonname and mp->mnt_stat.f_mntfromname
@@ -381,7 +363,7 @@
error_1: /* no state to back out*/
success:
- return( err);
+ return(err);
}
/*
@@ -804,8 +786,21 @@
struct ucred **credanonp)
#endif
{
- printf("\ntfs_fhtovp():\n");
- return 0;
+ struct vnode *nvp;
+ struct ntfid *ntfhp = (struct ntfid *)fhp;
+ int error;
+
+ ddprintf(("ntfs_fhtovp(): %s: %d\n", mp->mnt_stat->f_mntonname,
+ ntfhp->ntfid_ino));
+
+ if ((error = VFS_VGET(mp, ntfhp->ntfid_ino, &nvp)) != 0) {
+ *vpp = NULLVP;
+ return (error);
+ }
+ /* XXX as unlink/rmdir/mkdir/creat are not currently possible
+ * with NTFS, we don't need to check anything else for now */
+ *vpp = nvp;
+ return (0);
}
static int
@@ -813,8 +808,18 @@
struct vnode *vp,
struct fid *fhp)
{
- printf("ntfs_vptofh():\n");
- return EOPNOTSUPP;
+ register struct ntnode *ntp;
+ register struct ntfid *ntfhp;
+
+ ddprintf(("ntfs_fhtovp(): %s: %p\n", vp->v_mount->mnt_stat->f_mntonname,
+ vp));
+
+ ntp = VTONT(vp);
+ ntfhp = (struct ntfid *)fhp;
+ ntfhp->ntfid_len = sizeof(struct ntfid);
+ ntfhp->ntfid_ino = ntp->i_number;
+ /* ntfhp->ntfid_gen = ntp->i_gen; */
+ return (0);
}
int
@@ -979,7 +984,7 @@
ntfs_checkexp,
ntfs_vnodeopv_descs,
};
-#else
+#else /* !NetBSD && !FreeBSD */
static struct vfsops ntfs_vfsops = {
ntfs_mount,
ntfs_start,
Home |
Main Index |
Thread Index |
Old Index