#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
#endif
#include <sys/kobj.h>
-
+#ifdef AFS_SUN58_ENV
+# include <sys/mount.h>
+#endif
struct vfs *afs_globalVFS = 0;
struct vcache *afs_globalVp = 0;
int
afs_mount(struct vfs *afsp, struct vnode *amvp, struct mounta *uap,
- struct AFS_UCRED *credp)
+ afs_ucred_t *credp)
{
AFS_GLOCK();
#if defined(AFS_SUN58_ENV)
int
-afs_unmount(struct vfs *afsp, int flag, struct AFS_UCRED *credp)
+afs_unmount(struct vfs *afsp, int flag, afs_ucred_t *credp)
#else
int
-afs_unmount(struct vfs *afsp, struct AFS_UCRED *credp)
+afs_unmount(struct vfs *afsp, afs_ucred_t *credp)
#endif
{
+ struct vcache *rootvp = NULL;
+
AFS_GLOCK();
AFS_STATCNT(afs_unmount);
AFS_GUNLOCK();
return (EPERM);
}
+
+#ifdef AFS_SUN58_ENV
+ if (flag & MS_FORCE) {
+ AFS_GUNLOCK();
+ return ENOTSUP;
+ }
+
+ /* We should have one reference from the caller, and one reference for the
+ * root vnode; any more and someone is still referencing something */
+ if (afsp->vfs_count > 2) {
+ AFS_GUNLOCK();
+ return EBUSY;
+ }
+
+ /* The root vnode should have one ref for the mount; any more, and someone
+ * else is using the root vnode */
+ if (afs_globalVp && VREFCOUNT_GT(afs_globalVp, 1)) {
+ AFS_GUNLOCK();
+ return EBUSY;
+ }
+
+ afsp->vfs_flag |= VFS_UNMOUNTED;
+#endif /* AFS_SUN58_ENV */
+
+ /* release the root vnode, which should be the last reference to us
+ * besides the caller of afs_unmount */
+ rootvp = afs_globalVp;
+ afs_globalVp = NULL;
+ AFS_RELE(rootvp);
+
+#ifndef AFS_SUN58_ENV
+ /* shutdown now, since afs_freevfs() will not be called */
afs_globalVFS = 0;
afs_shutdown();
+#endif /* !AFS_SUN58_ENV */
AFS_GUNLOCK();
return 0;
}
+#ifdef AFS_SUN58_ENV
+void
+afs_freevfs(struct vfs *afsp)
+{
+ AFS_GLOCK();
+
+ afs_globalVFS = 0;
+ afs_shutdown();
+
+ AFS_GUNLOCK();
+}
+#endif /* AFS_SUN58_ENV */
+
int
afs_root(struct vfs *afsp, struct vnode **avpp)
{
}
int
-afs_sync(struct vfs *afsp, short flags, struct AFS_UCRED *credp)
+afs_sync(struct vfs *afsp, short flags, afs_ucred_t *credp)
{
return 0;
}
VFSNAME_SYNC, { .vfs_sync = afs_sync },
VFSNAME_VGET, { .vfs_vget = afs_vget },
VFSNAME_MOUNTROOT, { .vfs_mountroot = afs_mountroot },
- VFSNAME_FREEVFS, { .vfs_freevfs = fs_freevfs },
+ VFSNAME_FREEVFS, { .vfs_freevfs = afs_freevfs },
NULL, NULL
};
struct vfsops *afs_vfsopsp;
VFSNAME_SYNC, afs_sync,
VFSNAME_VGET, afs_vget,
VFSNAME_MOUNTROOT, afs_mountroot,
- VFSNAME_FREEVFS, fs_freevfs,
+ VFSNAME_FREEVFS, afs_freevfs,
NULL, NULL
};
struct vfsops *afs_vfsopsp;
afs_mountroot,
afs_swapvp,
#if defined(AFS_SUN58_ENV)
- fs_freevfs,
+ afs_freevfs,
#endif
};
#endif