#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/dirent.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/vmmeter.h>
#include <sys/vnode.h>
#include <sys/vfsops.h>
#include <sys/sysmsg.h>
#include <machine/limits.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
#include <vm/vnode_pager.h>
#include <vm/vm_zone.h>
#include <sys/buf2.h>
int
vfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
if (!mp->mnt_cred)
mp->mnt_cred = crhold(cred);
error = (mp->mnt_op->vfs_mount)(mp, path, data, cred);
VFS_MPUNLOCK();
return (error);
}
int
vfs_start(struct mount *mp, int flags)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK_FLAG(mp, MNTK_ST_MPSAFE);
error = (mp->mnt_op->vfs_start)(mp, flags);
if (error == 0) {
if ((mp->mnt_flag & MNT_UPDATE) == 0)
VFS_ACINIT(mp,error);
}
VFS_MPUNLOCK();
if (error == EMOUNTEXIT)
error = 0;
return (error);
}
int
vfs_unmount(struct mount *mp, int mntflags)
{
VFS_MPLOCK_DECLARE;
int error;
int flags;
VFS_MPLOCK(mp);
VFS_ACDONE(mp);
flags = mp->mnt_kern_flag;
error = (mp->mnt_op->vfs_unmount)(mp, mntflags);
if (error == 0)
vn_syncer_thr_stop(mp);
VFS_MPUNLOCK();
return (error);
}
int
vfs_root(struct mount *mp, struct vnode **vpp)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_root)(mp, vpp);
VFS_MPUNLOCK();
return (error);
}
int
vfs_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg,
struct ucred *cred)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_quotactl)(mp, cmds, uid, arg, cred);
VFS_MPUNLOCK();
return (error);
}
int
vfs_statfs(struct mount *mp, struct statfs *sbp, struct ucred *cred)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_statfs)(mp, sbp, cred);
VFS_MPUNLOCK();
return (error);
}
int
vfs_statvfs(struct mount *mp, struct statvfs *sbp, struct ucred *cred)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_statvfs)(mp, sbp, cred);
VFS_MPUNLOCK();
return (error);
}
int
vfs_sync(struct mount *mp, int waitfor)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_sync)(mp, waitfor);
VFS_MPUNLOCK();
return (error);
}
int
vfs_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_vget)(mp, dvp, ino, vpp);
VFS_MPUNLOCK();
return (error);
}
int
vfs_fhtovp(struct mount *mp, struct vnode *rootvp,
struct fid *fhp, struct vnode **vpp)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_fhtovp)(mp, rootvp, fhp, vpp);
VFS_MPUNLOCK();
return (error);
}
int
vfs_checkexp(struct mount *mp, struct sockaddr *nam,
int *extflagsp, struct ucred **credanonp)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_checkexp)(mp, nam, extflagsp, credanonp);
VFS_MPUNLOCK();
return (error);
}
int
vfs_vptofh(struct vnode *vp, struct fid *fhp)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(vp->v_mount);
error = (vp->v_mount->mnt_op->vfs_vptofh)(vp, fhp);
VFS_MPUNLOCK();
return (error);
}
int
vfs_init(struct vfsconf *vfc)
{
int error;
error = (vfc->vfc_vfsops->vfs_init)(vfc);
return (error);
}
int
vfs_uninit(struct vfsconf *vfc, struct vfsconf *vfsp)
{
int error;
error = (vfc->vfc_vfsops->vfs_uninit)(vfsp);
return (error);
}
int
vfs_extattrctl(struct mount *mp, int cmd, struct vnode *vp,
int attrnamespace, const char *attrname,
struct ucred *cred)
{
VFS_MPLOCK_DECLARE;
int error;
VFS_MPLOCK(mp);
error = (mp->mnt_op->vfs_extattrctl)(mp, cmd, vp,
attrnamespace, attrname,
cred);
VFS_MPUNLOCK();
return (error);
}