struct objcache *tm_node_pool;
int tm_flags;
+
+ struct netexport tm_export;
};
#define TMPFS_LOCK(tm) lockmgr(&(tm)->allnode_lock, LK_EXCLUSIVE|LK_RETRY)
/* --------------------------------------------------------------------- */
+static int
+tmpfs_checkexp(struct mount *mp, struct sockaddr *nam, int *exflagsp,
+ struct ucred **credanonp)
+{
+ struct tmpfs_mount *tmp;
+ struct netcred *nc;
+
+ tmp = (struct tmpfs_mount *) mp->mnt_data;
+ nc = vfs_export_lookup(mp, &tmp->tm_export, nam);
+ if (nc == NULL)
+ return (EACCES);
+
+ *exflagsp = nc->netc_exflags;
+ *credanonp = &nc->netc_anon;
+
+ return (0);
+}
+
+/* --------------------------------------------------------------------- */
+
/*
* tmpfs vfs operations.
*/
.vfs_statfs = tmpfs_statfs,
.vfs_fhtovp = tmpfs_fhtovp,
.vfs_vptofh = tmpfs_vptofh,
- .vfs_sync = vfs_stdsync
+ .vfs_sync = vfs_stdsync,
+ .vfs_checkexp = tmpfs_checkexp,
};
VFS_SET(tmpfs_vfsops, tmpfs, 0);
#include <sys/unistd.h>
#include <sys/vfsops.h>
#include <sys/vnode.h>
+#include <sys/mountctl.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
return 0;
}
+/* --------------------------------------------------------------------- */
+
+static int
+tmpfs_mountctl(struct vop_mountctl_args *ap)
+{
+ struct tmpfs_mount *tmp;
+ struct mount *mp;
+ int rc;
+
+ switch (ap->a_op) {
+ case (MOUNTCTL_SET_EXPORT):
+ mp = ap->a_head.a_ops->head.vv_mount;
+ tmp = (struct tmpfs_mount *) mp->mnt_data;
+
+ if (ap->a_ctllen != sizeof(struct export_args))
+ rc = (EINVAL);
+ else
+ rc = vfs_export(mp, &tmp->tm_export,
+ (const struct export_args *) ap->a_ctl);
+ break;
+ default:
+ rc = vop_stdmountctl(ap);
+ break;
+ }
+ return (rc);
+}
+
/* --------------------------------------------------------------------- */
static int
.vop_read = tmpfs_read,
.vop_write = tmpfs_write,
.vop_fsync = tmpfs_fsync,
+ .vop_mountctl = tmpfs_mountctl,
.vop_nremove = tmpfs_nremove,
.vop_nlink = tmpfs_nlink,
.vop_nrename = tmpfs_nrename,