2 * Copyright (c) 2009 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * Implement mp->mnt_ops function call wrappers.
37 * These wrappers are responsible for handling all MPSAFE issues related to
41 #include <sys/param.h>
42 #include <sys/systm.h>
45 #include <sys/dirent.h>
46 #include <sys/domain.h>
47 #include <sys/eventhandler.h>
48 #include <sys/fcntl.h>
49 #include <sys/kernel.h>
50 #include <sys/kthread.h>
51 #include <sys/malloc.h>
53 #include <sys/mount.h>
55 #include <sys/namei.h>
56 #include <sys/reboot.h>
57 #include <sys/socket.h>
59 #include <sys/sysctl.h>
60 #include <sys/syslog.h>
61 #include <sys/vmmeter.h>
62 #include <sys/vnode.h>
63 #include <sys/vfsops.h>
64 #include <sys/sysmsg.h>
66 #include <machine/limits.h>
69 #include <vm/vm_object.h>
70 #include <vm/vm_extern.h>
71 #include <vm/vm_kern.h>
73 #include <vm/vm_map.h>
74 #include <vm/vm_page.h>
75 #include <vm/vm_pager.h>
76 #include <vm/vnode_pager.h>
77 #include <vm/vm_zone.h>
80 #include <sys/thread2.h>
81 #include <sys/mplock2.h>
87 vfs_mount(struct mount
*mp
, char *path
, caddr_t data
, struct ucred
*cred
)
93 error
= (mp
->mnt_op
->vfs_mount
)(mp
, path
, data
, cred
);
102 vfs_start(struct mount
*mp
, int flags
)
108 error
= (mp
->mnt_op
->vfs_start
)(mp
, flags
);
117 vfs_unmount(struct mount
*mp
, int mntflags
)
123 error
= (mp
->mnt_op
->vfs_unmount
)(mp
, mntflags
);
132 vfs_root(struct mount
*mp
, struct vnode
**vpp
)
138 error
= (mp
->mnt_op
->vfs_root
)(mp
, vpp
);
147 vfs_quotactl(struct mount
*mp
, int cmds
, uid_t uid
, caddr_t arg
,
154 error
= (mp
->mnt_op
->vfs_quotactl
)(mp
, cmds
, uid
, arg
, cred
);
163 vfs_statfs(struct mount
*mp
, struct statfs
*sbp
, struct ucred
*cred
)
169 error
= (mp
->mnt_op
->vfs_statfs
)(mp
, sbp
, cred
);
175 vfs_statvfs(struct mount
*mp
, struct statvfs
*sbp
, struct ucred
*cred
)
181 error
= (mp
->mnt_op
->vfs_statvfs
)(mp
, sbp
, cred
);
190 vfs_sync(struct mount
*mp
, int waitfor
)
196 error
= (mp
->mnt_op
->vfs_sync
)(mp
, waitfor
);
205 vfs_vget(struct mount
*mp
, struct vnode
*dvp
, ino_t ino
, struct vnode
**vpp
)
211 error
= (mp
->mnt_op
->vfs_vget
)(mp
, dvp
, ino
, vpp
);
220 vfs_fhtovp(struct mount
*mp
, struct vnode
*rootvp
,
221 struct fid
*fhp
, struct vnode
**vpp
)
227 error
= (mp
->mnt_op
->vfs_fhtovp
)(mp
, rootvp
, fhp
, vpp
);
236 vfs_checkexp(struct mount
*mp
, struct sockaddr
*nam
,
237 int *extflagsp
, struct ucred
**credanonp
)
243 error
= (mp
->mnt_op
->vfs_checkexp
)(mp
, nam
, extflagsp
, credanonp
);
252 vfs_vptofh(struct vnode
*vp
, struct fid
*fhp
)
257 VFS_MPLOCK1(vp
->v_mount
);
258 error
= (vp
->v_mount
->mnt_op
->vfs_vptofh
)(vp
, fhp
);
259 VFS_MPUNLOCK(vp
->v_mount
);
267 vfs_init(struct vfsconf
*vfc
)
272 error
= (vfc
->vfc_vfsops
->vfs_init
)(vfc
);
282 vfs_uninit(struct vfsconf
*vfc
, struct vfsconf
*vfsp
)
287 error
= (vfc
->vfc_vfsops
->vfs_uninit
)(vfsp
);
297 vfs_extattrctl(struct mount
*mp
, int cmd
, const char *attrname
,
298 caddr_t arg
, struct ucred
*cred
)
304 error
= (mp
->mnt_op
->vfs_extattrctl
)(mp
, cmd
, attrname
, arg
, cred
);