xref: /freebsd/sys/fs/nullfs/null_vfsops.c (revision 3a773ad0b564e224a380b188f005e6582fabaf34)
1df8bae1dSRodney W. Grimes /*
2df8bae1dSRodney W. Grimes  * Copyright (c) 1992, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * This code is derived from software donated to Berkeley by
6df8bae1dSRodney W. Grimes  * Jan-Simon Pendry.
7df8bae1dSRodney W. Grimes  *
8df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
9df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
10df8bae1dSRodney W. Grimes  * are met:
11df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
12df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
13df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
15df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
16df8bae1dSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
17df8bae1dSRodney W. Grimes  *    must display the following acknowledgement:
18df8bae1dSRodney W. Grimes  *	This product includes software developed by the University of
19df8bae1dSRodney W. Grimes  *	California, Berkeley and its contributors.
20df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
21df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
22df8bae1dSRodney W. Grimes  *    without specific prior written permission.
23df8bae1dSRodney W. Grimes  *
24df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
35df8bae1dSRodney W. Grimes  *
36df8bae1dSRodney W. Grimes  *	@(#)null_vfsops.c	8.2 (Berkeley) 1/21/94
37df8bae1dSRodney W. Grimes  *
38df8bae1dSRodney W. Grimes  * @(#)lofs_vfsops.c	1.2 (Berkeley) 6/18/92
393a773ad0SPoul-Henning Kamp  * $Id: null_vfsops.c,v 1.3 1994/09/22 19:38:14 wollman Exp $
40df8bae1dSRodney W. Grimes  */
41df8bae1dSRodney W. Grimes 
42df8bae1dSRodney W. Grimes /*
43df8bae1dSRodney W. Grimes  * Null Layer
44df8bae1dSRodney W. Grimes  * (See null_vnops.c for a description of what this does.)
45df8bae1dSRodney W. Grimes  */
46df8bae1dSRodney W. Grimes 
47df8bae1dSRodney W. Grimes #include <sys/param.h>
48df8bae1dSRodney W. Grimes #include <sys/systm.h>
49c9b1d604SGarrett Wollman #include <sys/kernel.h>
50df8bae1dSRodney W. Grimes #include <sys/time.h>
51df8bae1dSRodney W. Grimes #include <sys/types.h>
52df8bae1dSRodney W. Grimes #include <sys/vnode.h>
53df8bae1dSRodney W. Grimes #include <sys/mount.h>
54df8bae1dSRodney W. Grimes #include <sys/namei.h>
55df8bae1dSRodney W. Grimes #include <sys/malloc.h>
56df8bae1dSRodney W. Grimes #include <miscfs/nullfs/null.h>
57df8bae1dSRodney W. Grimes 
58df8bae1dSRodney W. Grimes /*
59df8bae1dSRodney W. Grimes  * Mount null layer
60df8bae1dSRodney W. Grimes  */
61df8bae1dSRodney W. Grimes int
62df8bae1dSRodney W. Grimes nullfs_mount(mp, path, data, ndp, p)
63df8bae1dSRodney W. Grimes 	struct mount *mp;
64df8bae1dSRodney W. Grimes 	char *path;
65df8bae1dSRodney W. Grimes 	caddr_t data;
66df8bae1dSRodney W. Grimes 	struct nameidata *ndp;
67df8bae1dSRodney W. Grimes 	struct proc *p;
68df8bae1dSRodney W. Grimes {
69df8bae1dSRodney W. Grimes 	int error = 0;
70df8bae1dSRodney W. Grimes 	struct null_args args;
71df8bae1dSRodney W. Grimes 	struct vnode *lowerrootvp, *vp;
72df8bae1dSRodney W. Grimes 	struct vnode *nullm_rootvp;
73df8bae1dSRodney W. Grimes 	struct null_mount *xmp;
74df8bae1dSRodney W. Grimes 	u_int size;
75df8bae1dSRodney W. Grimes 
76df8bae1dSRodney W. Grimes #ifdef NULLFS_DIAGNOSTIC
77df8bae1dSRodney W. Grimes 	printf("nullfs_mount(mp = %x)\n", mp);
78df8bae1dSRodney W. Grimes #endif
79df8bae1dSRodney W. Grimes 
80df8bae1dSRodney W. Grimes 	/*
81df8bae1dSRodney W. Grimes 	 * Update is a no-op
82df8bae1dSRodney W. Grimes 	 */
83df8bae1dSRodney W. Grimes 	if (mp->mnt_flag & MNT_UPDATE) {
84df8bae1dSRodney W. Grimes 		return (EOPNOTSUPP);
85df8bae1dSRodney W. Grimes 		/* return VFS_MOUNT(MOUNTTONULLMOUNT(mp)->nullm_vfs, path, data, ndp, p);*/
86df8bae1dSRodney W. Grimes 	}
87df8bae1dSRodney W. Grimes 
88df8bae1dSRodney W. Grimes 	/*
89df8bae1dSRodney W. Grimes 	 * Get argument
90df8bae1dSRodney W. Grimes 	 */
913a773ad0SPoul-Henning Kamp 	error = copyin(data, (caddr_t)&args, sizeof(struct null_args));
923a773ad0SPoul-Henning Kamp 	if (error)
93df8bae1dSRodney W. Grimes 		return (error);
94df8bae1dSRodney W. Grimes 
95df8bae1dSRodney W. Grimes 	/*
96df8bae1dSRodney W. Grimes 	 * Find lower node
97df8bae1dSRodney W. Grimes 	 */
98df8bae1dSRodney W. Grimes 	NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT|LOCKLEAF,
99df8bae1dSRodney W. Grimes 		UIO_USERSPACE, args.target, p);
1003a773ad0SPoul-Henning Kamp 	error = namei(ndp);
1013a773ad0SPoul-Henning Kamp 	if (error)
102df8bae1dSRodney W. Grimes 		return (error);
103df8bae1dSRodney W. Grimes 
104df8bae1dSRodney W. Grimes 	/*
105df8bae1dSRodney W. Grimes 	 * Sanity check on lower vnode
106df8bae1dSRodney W. Grimes 	 */
107df8bae1dSRodney W. Grimes 	lowerrootvp = ndp->ni_vp;
108df8bae1dSRodney W. Grimes 
109df8bae1dSRodney W. Grimes 	vrele(ndp->ni_dvp);
110df8bae1dSRodney W. Grimes 	ndp->ni_dvp = NULL;
111df8bae1dSRodney W. Grimes 
112df8bae1dSRodney W. Grimes 	xmp = (struct null_mount *) malloc(sizeof(struct null_mount),
113df8bae1dSRodney W. Grimes 				M_UFSMNT, M_WAITOK);	/* XXX */
114df8bae1dSRodney W. Grimes 
115df8bae1dSRodney W. Grimes 	/*
116df8bae1dSRodney W. Grimes 	 * Save reference to underlying FS
117df8bae1dSRodney W. Grimes 	 */
118df8bae1dSRodney W. Grimes 	xmp->nullm_vfs = lowerrootvp->v_mount;
119df8bae1dSRodney W. Grimes 
120df8bae1dSRodney W. Grimes 	/*
121df8bae1dSRodney W. Grimes 	 * Save reference.  Each mount also holds
122df8bae1dSRodney W. Grimes 	 * a reference on the root vnode.
123df8bae1dSRodney W. Grimes 	 */
124df8bae1dSRodney W. Grimes 	error = null_node_create(mp, lowerrootvp, &vp);
125df8bae1dSRodney W. Grimes 	/*
126df8bae1dSRodney W. Grimes 	 * Unlock the node (either the lower or the alias)
127df8bae1dSRodney W. Grimes 	 */
128df8bae1dSRodney W. Grimes 	VOP_UNLOCK(vp);
129df8bae1dSRodney W. Grimes 	/*
130df8bae1dSRodney W. Grimes 	 * Make sure the node alias worked
131df8bae1dSRodney W. Grimes 	 */
132df8bae1dSRodney W. Grimes 	if (error) {
133df8bae1dSRodney W. Grimes 		vrele(lowerrootvp);
134df8bae1dSRodney W. Grimes 		free(xmp, M_UFSMNT);	/* XXX */
135df8bae1dSRodney W. Grimes 		return (error);
136df8bae1dSRodney W. Grimes 	}
137df8bae1dSRodney W. Grimes 
138df8bae1dSRodney W. Grimes 	/*
139df8bae1dSRodney W. Grimes 	 * Keep a held reference to the root vnode.
140df8bae1dSRodney W. Grimes 	 * It is vrele'd in nullfs_unmount.
141df8bae1dSRodney W. Grimes 	 */
142df8bae1dSRodney W. Grimes 	nullm_rootvp = vp;
143df8bae1dSRodney W. Grimes 	nullm_rootvp->v_flag |= VROOT;
144df8bae1dSRodney W. Grimes 	xmp->nullm_rootvp = nullm_rootvp;
145df8bae1dSRodney W. Grimes 	if (NULLVPTOLOWERVP(nullm_rootvp)->v_mount->mnt_flag & MNT_LOCAL)
146df8bae1dSRodney W. Grimes 		mp->mnt_flag |= MNT_LOCAL;
147df8bae1dSRodney W. Grimes 	mp->mnt_data = (qaddr_t) xmp;
148df8bae1dSRodney W. Grimes 	getnewfsid(mp, MOUNT_LOFS);
149df8bae1dSRodney W. Grimes 
150df8bae1dSRodney W. Grimes 	(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
151df8bae1dSRodney W. Grimes 	bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
152df8bae1dSRodney W. Grimes 	(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
153df8bae1dSRodney W. Grimes 	    &size);
154df8bae1dSRodney W. Grimes 	bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
155df8bae1dSRodney W. Grimes #ifdef NULLFS_DIAGNOSTIC
156df8bae1dSRodney W. Grimes 	printf("nullfs_mount: lower %s, alias at %s\n",
157df8bae1dSRodney W. Grimes 		mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
158df8bae1dSRodney W. Grimes #endif
159df8bae1dSRodney W. Grimes 	return (0);
160df8bae1dSRodney W. Grimes }
161df8bae1dSRodney W. Grimes 
162df8bae1dSRodney W. Grimes /*
163df8bae1dSRodney W. Grimes  * VFS start.  Nothing needed here - the start routine
164df8bae1dSRodney W. Grimes  * on the underlying filesystem will have been called
165df8bae1dSRodney W. Grimes  * when that filesystem was mounted.
166df8bae1dSRodney W. Grimes  */
167df8bae1dSRodney W. Grimes int
168df8bae1dSRodney W. Grimes nullfs_start(mp, flags, p)
169df8bae1dSRodney W. Grimes 	struct mount *mp;
170df8bae1dSRodney W. Grimes 	int flags;
171df8bae1dSRodney W. Grimes 	struct proc *p;
172df8bae1dSRodney W. Grimes {
173df8bae1dSRodney W. Grimes 	return (0);
174df8bae1dSRodney W. Grimes 	/* return VFS_START(MOUNTTONULLMOUNT(mp)->nullm_vfs, flags, p); */
175df8bae1dSRodney W. Grimes }
176df8bae1dSRodney W. Grimes 
177df8bae1dSRodney W. Grimes /*
178df8bae1dSRodney W. Grimes  * Free reference to null layer
179df8bae1dSRodney W. Grimes  */
180df8bae1dSRodney W. Grimes int
181df8bae1dSRodney W. Grimes nullfs_unmount(mp, mntflags, p)
182df8bae1dSRodney W. Grimes 	struct mount *mp;
183df8bae1dSRodney W. Grimes 	int mntflags;
184df8bae1dSRodney W. Grimes 	struct proc *p;
185df8bae1dSRodney W. Grimes {
186df8bae1dSRodney W. Grimes 	struct vnode *nullm_rootvp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
187df8bae1dSRodney W. Grimes 	int error;
188df8bae1dSRodney W. Grimes 	int flags = 0;
189df8bae1dSRodney W. Grimes 	extern int doforce;
190df8bae1dSRodney W. Grimes 
191df8bae1dSRodney W. Grimes #ifdef NULLFS_DIAGNOSTIC
192df8bae1dSRodney W. Grimes 	printf("nullfs_unmount(mp = %x)\n", mp);
193df8bae1dSRodney W. Grimes #endif
194df8bae1dSRodney W. Grimes 
195df8bae1dSRodney W. Grimes 	if (mntflags & MNT_FORCE) {
196df8bae1dSRodney W. Grimes 		/* lofs can never be rootfs so don't check for it */
197df8bae1dSRodney W. Grimes 		if (!doforce)
198df8bae1dSRodney W. Grimes 			return (EINVAL);
199df8bae1dSRodney W. Grimes 		flags |= FORCECLOSE;
200df8bae1dSRodney W. Grimes 	}
201df8bae1dSRodney W. Grimes 
202df8bae1dSRodney W. Grimes 	/*
203df8bae1dSRodney W. Grimes 	 * Clear out buffer cache.  I don't think we
204df8bae1dSRodney W. Grimes 	 * ever get anything cached at this level at the
205df8bae1dSRodney W. Grimes 	 * moment, but who knows...
206df8bae1dSRodney W. Grimes 	 */
207df8bae1dSRodney W. Grimes #if 0
208df8bae1dSRodney W. Grimes 	mntflushbuf(mp, 0);
209df8bae1dSRodney W. Grimes 	if (mntinvalbuf(mp, 1))
210df8bae1dSRodney W. Grimes 		return (EBUSY);
211df8bae1dSRodney W. Grimes #endif
212df8bae1dSRodney W. Grimes 	if (nullm_rootvp->v_usecount > 1)
213df8bae1dSRodney W. Grimes 		return (EBUSY);
2143a773ad0SPoul-Henning Kamp 	error = vflush(mp, nullm_rootvp, flags);
2153a773ad0SPoul-Henning Kamp 	if (error)
216df8bae1dSRodney W. Grimes 		return (error);
217df8bae1dSRodney W. Grimes 
218df8bae1dSRodney W. Grimes #ifdef NULLFS_DIAGNOSTIC
219df8bae1dSRodney W. Grimes 	vprint("alias root of lower", nullm_rootvp);
220df8bae1dSRodney W. Grimes #endif
221df8bae1dSRodney W. Grimes 	/*
222df8bae1dSRodney W. Grimes 	 * Release reference on underlying root vnode
223df8bae1dSRodney W. Grimes 	 */
224df8bae1dSRodney W. Grimes 	vrele(nullm_rootvp);
225df8bae1dSRodney W. Grimes 	/*
226df8bae1dSRodney W. Grimes 	 * And blow it away for future re-use
227df8bae1dSRodney W. Grimes 	 */
228df8bae1dSRodney W. Grimes 	vgone(nullm_rootvp);
229df8bae1dSRodney W. Grimes 	/*
230df8bae1dSRodney W. Grimes 	 * Finally, throw away the null_mount structure
231df8bae1dSRodney W. Grimes 	 */
232df8bae1dSRodney W. Grimes 	free(mp->mnt_data, M_UFSMNT);	/* XXX */
233df8bae1dSRodney W. Grimes 	mp->mnt_data = 0;
234df8bae1dSRodney W. Grimes 	return 0;
235df8bae1dSRodney W. Grimes }
236df8bae1dSRodney W. Grimes 
237df8bae1dSRodney W. Grimes int
238df8bae1dSRodney W. Grimes nullfs_root(mp, vpp)
239df8bae1dSRodney W. Grimes 	struct mount *mp;
240df8bae1dSRodney W. Grimes 	struct vnode **vpp;
241df8bae1dSRodney W. Grimes {
242df8bae1dSRodney W. Grimes 	struct vnode *vp;
243df8bae1dSRodney W. Grimes 
244df8bae1dSRodney W. Grimes #ifdef NULLFS_DIAGNOSTIC
245df8bae1dSRodney W. Grimes 	printf("nullfs_root(mp = %x, vp = %x->%x)\n", mp,
246df8bae1dSRodney W. Grimes 			MOUNTTONULLMOUNT(mp)->nullm_rootvp,
247df8bae1dSRodney W. Grimes 			NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp)
248df8bae1dSRodney W. Grimes 			);
249df8bae1dSRodney W. Grimes #endif
250df8bae1dSRodney W. Grimes 
251df8bae1dSRodney W. Grimes 	/*
252df8bae1dSRodney W. Grimes 	 * Return locked reference to root.
253df8bae1dSRodney W. Grimes 	 */
254df8bae1dSRodney W. Grimes 	vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
255df8bae1dSRodney W. Grimes 	VREF(vp);
256df8bae1dSRodney W. Grimes 	VOP_LOCK(vp);
257df8bae1dSRodney W. Grimes 	*vpp = vp;
258df8bae1dSRodney W. Grimes 	return 0;
259df8bae1dSRodney W. Grimes }
260df8bae1dSRodney W. Grimes 
261df8bae1dSRodney W. Grimes int
262df8bae1dSRodney W. Grimes nullfs_quotactl(mp, cmd, uid, arg, p)
263df8bae1dSRodney W. Grimes 	struct mount *mp;
264df8bae1dSRodney W. Grimes 	int cmd;
265df8bae1dSRodney W. Grimes 	uid_t uid;
266df8bae1dSRodney W. Grimes 	caddr_t arg;
267df8bae1dSRodney W. Grimes 	struct proc *p;
268df8bae1dSRodney W. Grimes {
269df8bae1dSRodney W. Grimes 	return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg, p);
270df8bae1dSRodney W. Grimes }
271df8bae1dSRodney W. Grimes 
272df8bae1dSRodney W. Grimes int
273df8bae1dSRodney W. Grimes nullfs_statfs(mp, sbp, p)
274df8bae1dSRodney W. Grimes 	struct mount *mp;
275df8bae1dSRodney W. Grimes 	struct statfs *sbp;
276df8bae1dSRodney W. Grimes 	struct proc *p;
277df8bae1dSRodney W. Grimes {
278df8bae1dSRodney W. Grimes 	int error;
279df8bae1dSRodney W. Grimes 	struct statfs mstat;
280df8bae1dSRodney W. Grimes 
281df8bae1dSRodney W. Grimes #ifdef NULLFS_DIAGNOSTIC
282df8bae1dSRodney W. Grimes 	printf("nullfs_statfs(mp = %x, vp = %x->%x)\n", mp,
283df8bae1dSRodney W. Grimes 			MOUNTTONULLMOUNT(mp)->nullm_rootvp,
284df8bae1dSRodney W. Grimes 			NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp)
285df8bae1dSRodney W. Grimes 			);
286df8bae1dSRodney W. Grimes #endif
287df8bae1dSRodney W. Grimes 
288df8bae1dSRodney W. Grimes 	bzero(&mstat, sizeof(mstat));
289df8bae1dSRodney W. Grimes 
290df8bae1dSRodney W. Grimes 	error = VFS_STATFS(MOUNTTONULLMOUNT(mp)->nullm_vfs, &mstat, p);
291df8bae1dSRodney W. Grimes 	if (error)
292df8bae1dSRodney W. Grimes 		return (error);
293df8bae1dSRodney W. Grimes 
294df8bae1dSRodney W. Grimes 	/* now copy across the "interesting" information and fake the rest */
295df8bae1dSRodney W. Grimes 	sbp->f_type = mstat.f_type;
296df8bae1dSRodney W. Grimes 	sbp->f_flags = mstat.f_flags;
297df8bae1dSRodney W. Grimes 	sbp->f_bsize = mstat.f_bsize;
298df8bae1dSRodney W. Grimes 	sbp->f_iosize = mstat.f_iosize;
299df8bae1dSRodney W. Grimes 	sbp->f_blocks = mstat.f_blocks;
300df8bae1dSRodney W. Grimes 	sbp->f_bfree = mstat.f_bfree;
301df8bae1dSRodney W. Grimes 	sbp->f_bavail = mstat.f_bavail;
302df8bae1dSRodney W. Grimes 	sbp->f_files = mstat.f_files;
303df8bae1dSRodney W. Grimes 	sbp->f_ffree = mstat.f_ffree;
304df8bae1dSRodney W. Grimes 	if (sbp != &mp->mnt_stat) {
305df8bae1dSRodney W. Grimes 		bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid));
306df8bae1dSRodney W. Grimes 		bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
307df8bae1dSRodney W. Grimes 		bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
308df8bae1dSRodney W. Grimes 	}
309df8bae1dSRodney W. Grimes 	return (0);
310df8bae1dSRodney W. Grimes }
311df8bae1dSRodney W. Grimes 
312df8bae1dSRodney W. Grimes int
313df8bae1dSRodney W. Grimes nullfs_sync(mp, waitfor, cred, p)
314df8bae1dSRodney W. Grimes 	struct mount *mp;
315df8bae1dSRodney W. Grimes 	int waitfor;
316df8bae1dSRodney W. Grimes 	struct ucred *cred;
317df8bae1dSRodney W. Grimes 	struct proc *p;
318df8bae1dSRodney W. Grimes {
319df8bae1dSRodney W. Grimes 	/*
320df8bae1dSRodney W. Grimes 	 * XXX - Assumes no data cached at null layer.
321df8bae1dSRodney W. Grimes 	 */
322df8bae1dSRodney W. Grimes 	return (0);
323df8bae1dSRodney W. Grimes }
324df8bae1dSRodney W. Grimes 
325df8bae1dSRodney W. Grimes int
326df8bae1dSRodney W. Grimes nullfs_vget(mp, ino, vpp)
327df8bae1dSRodney W. Grimes 	struct mount *mp;
328df8bae1dSRodney W. Grimes 	ino_t ino;
329df8bae1dSRodney W. Grimes 	struct vnode **vpp;
330df8bae1dSRodney W. Grimes {
331df8bae1dSRodney W. Grimes 
332df8bae1dSRodney W. Grimes 	return VFS_VGET(MOUNTTONULLMOUNT(mp)->nullm_vfs, ino, vpp);
333df8bae1dSRodney W. Grimes }
334df8bae1dSRodney W. Grimes 
335df8bae1dSRodney W. Grimes int
336df8bae1dSRodney W. Grimes nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp)
337df8bae1dSRodney W. Grimes 	struct mount *mp;
338df8bae1dSRodney W. Grimes 	struct fid *fidp;
339df8bae1dSRodney W. Grimes 	struct mbuf *nam;
340df8bae1dSRodney W. Grimes 	struct vnode **vpp;
341df8bae1dSRodney W. Grimes 	int *exflagsp;
342df8bae1dSRodney W. Grimes 	struct ucred**credanonp;
343df8bae1dSRodney W. Grimes {
344df8bae1dSRodney W. Grimes 
345df8bae1dSRodney W. Grimes 	return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam, vpp, exflagsp,credanonp);
346df8bae1dSRodney W. Grimes }
347df8bae1dSRodney W. Grimes 
348df8bae1dSRodney W. Grimes int
349df8bae1dSRodney W. Grimes nullfs_vptofh(vp, fhp)
350df8bae1dSRodney W. Grimes 	struct vnode *vp;
351df8bae1dSRodney W. Grimes 	struct fid *fhp;
352df8bae1dSRodney W. Grimes {
353df8bae1dSRodney W. Grimes 	return VFS_VPTOFH(NULLVPTOLOWERVP(vp), fhp);
354df8bae1dSRodney W. Grimes }
355df8bae1dSRodney W. Grimes 
356df8bae1dSRodney W. Grimes int nullfs_init __P((void));
357df8bae1dSRodney W. Grimes 
358df8bae1dSRodney W. Grimes struct vfsops null_vfsops = {
359df8bae1dSRodney W. Grimes 	nullfs_mount,
360df8bae1dSRodney W. Grimes 	nullfs_start,
361df8bae1dSRodney W. Grimes 	nullfs_unmount,
362df8bae1dSRodney W. Grimes 	nullfs_root,
363df8bae1dSRodney W. Grimes 	nullfs_quotactl,
364df8bae1dSRodney W. Grimes 	nullfs_statfs,
365df8bae1dSRodney W. Grimes 	nullfs_sync,
366df8bae1dSRodney W. Grimes 	nullfs_vget,
367df8bae1dSRodney W. Grimes 	nullfs_fhtovp,
368df8bae1dSRodney W. Grimes 	nullfs_vptofh,
369df8bae1dSRodney W. Grimes 	nullfs_init,
370df8bae1dSRodney W. Grimes };
371c901836cSGarrett Wollman 
372c901836cSGarrett Wollman VFS_SET(null_vfsops, null, MOUNT_NULL, 0);
373