tmpfs_vfsops.c revision 234346
1170808Sdelphij/*	$NetBSD: tmpfs_vfsops.c,v 1.10 2005/12/11 12:24:29 christos Exp $	*/
2170808Sdelphij
3182739Sdelphij/*-
4170808Sdelphij * Copyright (c) 2005 The NetBSD Foundation, Inc.
5170808Sdelphij * All rights reserved.
6170808Sdelphij *
7170808Sdelphij * This code is derived from software contributed to The NetBSD Foundation
8170808Sdelphij * by Julio M. Merino Vidal, developed as part of Google's Summer of Code
9170808Sdelphij * 2005 program.
10170808Sdelphij *
11170808Sdelphij * Redistribution and use in source and binary forms, with or without
12170808Sdelphij * modification, are permitted provided that the following conditions
13170808Sdelphij * are met:
14170808Sdelphij * 1. Redistributions of source code must retain the above copyright
15170808Sdelphij *    notice, this list of conditions and the following disclaimer.
16170808Sdelphij * 2. Redistributions in binary form must reproduce the above copyright
17170808Sdelphij *    notice, this list of conditions and the following disclaimer in the
18170808Sdelphij *    documentation and/or other materials provided with the distribution.
19170808Sdelphij *
20170808Sdelphij * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21170808Sdelphij * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22170808Sdelphij * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23170808Sdelphij * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24170808Sdelphij * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25170808Sdelphij * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26170808Sdelphij * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27170808Sdelphij * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28170808Sdelphij * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29170808Sdelphij * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30170808Sdelphij * POSSIBILITY OF SUCH DAMAGE.
31170808Sdelphij */
32170808Sdelphij
33170808Sdelphij/*
34170808Sdelphij * Efficient memory file system.
35170808Sdelphij *
36170808Sdelphij * tmpfs is a file system that uses NetBSD's virtual memory sub-system
37170808Sdelphij * (the well-known UVM) to store file data and metadata in an efficient
38170808Sdelphij * way.  This means that it does not follow the structure of an on-disk
39170808Sdelphij * file system because it simply does not need to.  Instead, it uses
40170808Sdelphij * memory-specific data structures and algorithms to automatically
41170808Sdelphij * allocate and release resources.
42170808Sdelphij */
43170808Sdelphij#include <sys/cdefs.h>
44170808Sdelphij__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vfsops.c 234346 2012-04-16 18:07:42Z jh $");
45170808Sdelphij
46170808Sdelphij#include <sys/param.h>
47171308Sdelphij#include <sys/limits.h>
48170808Sdelphij#include <sys/lock.h>
49170808Sdelphij#include <sys/mutex.h>
50170808Sdelphij#include <sys/kernel.h>
51170808Sdelphij#include <sys/stat.h>
52170808Sdelphij#include <sys/systm.h>
53170808Sdelphij#include <sys/sysctl.h>
54170808Sdelphij
55170808Sdelphij#include <vm/vm.h>
56170808Sdelphij#include <vm/vm_object.h>
57170808Sdelphij#include <vm/vm_param.h>
58170808Sdelphij
59170808Sdelphij#include <fs/tmpfs/tmpfs.h>
60170808Sdelphij
61170808Sdelphij/*
62171070Sdelphij * Default permission for root node
63170808Sdelphij */
64170808Sdelphij#define TMPFS_DEFAULT_ROOT_MODE	(S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
65170808Sdelphij
66170808SdelphijMALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures");
67171087SdelphijMALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names");
68170808Sdelphij
69170808Sdelphij/* --------------------------------------------------------------------- */
70170808Sdelphij
71191990Sattiliostatic int	tmpfs_mount(struct mount *);
72191990Sattiliostatic int	tmpfs_unmount(struct mount *, int);
73191990Sattiliostatic int	tmpfs_root(struct mount *, int flags, struct vnode **);
74222167Srmacklemstatic int	tmpfs_fhtovp(struct mount *, struct fid *, int,
75222167Srmacklem		    struct vnode **);
76191990Sattiliostatic int	tmpfs_statfs(struct mount *, struct statfs *);
77170808Sdelphij
78170808Sdelphij/* --------------------------------------------------------------------- */
79170808Sdelphij
80170808Sdelphijstatic const char *tmpfs_opts[] = {
81203164Sjh	"from", "size", "maxfilesize", "inodes", "uid", "gid", "mode", "export",
82170808Sdelphij	NULL
83170808Sdelphij};
84170808Sdelphij
85234346Sjhstatic const char *tmpfs_updateopts[] = {
86234346Sjh	"from", "export", NULL
87234346Sjh};
88234346Sjh
89170808Sdelphij/* --------------------------------------------------------------------- */
90170808Sdelphij
91171029Sdelphijstatic int
92171029Sdelphijtmpfs_node_ctor(void *mem, int size, void *arg, int flags)
93171029Sdelphij{
94171029Sdelphij	struct tmpfs_node *node = (struct tmpfs_node *)mem;
95171070Sdelphij
96171362Sdelphij	node->tn_gen++;
97171029Sdelphij	node->tn_size = 0;
98171029Sdelphij	node->tn_status = 0;
99171029Sdelphij	node->tn_flags = 0;
100171029Sdelphij	node->tn_links = 0;
101171029Sdelphij	node->tn_vnode = NULL;
102171029Sdelphij	node->tn_vpstate = 0;
103170808Sdelphij
104171029Sdelphij	return (0);
105171029Sdelphij}
106171029Sdelphij
107171029Sdelphijstatic void
108171029Sdelphijtmpfs_node_dtor(void *mem, int size, void *arg)
109171029Sdelphij{
110171029Sdelphij	struct tmpfs_node *node = (struct tmpfs_node *)mem;
111171029Sdelphij	node->tn_type = VNON;
112171029Sdelphij}
113171029Sdelphij
114171070Sdelphijstatic int
115171029Sdelphijtmpfs_node_init(void *mem, int size, int flags)
116171029Sdelphij{
117171029Sdelphij	struct tmpfs_node *node = (struct tmpfs_node *)mem;
118171029Sdelphij	node->tn_id = 0;
119171029Sdelphij
120171029Sdelphij	mtx_init(&node->tn_interlock, "tmpfs node interlock", NULL, MTX_DEF);
121171362Sdelphij	node->tn_gen = arc4random();
122171070Sdelphij
123171029Sdelphij	return (0);
124171029Sdelphij}
125171029Sdelphij
126171029Sdelphijstatic void
127171029Sdelphijtmpfs_node_fini(void *mem, int size)
128171029Sdelphij{
129171029Sdelphij	struct tmpfs_node *node = (struct tmpfs_node *)mem;
130171070Sdelphij
131171029Sdelphij	mtx_destroy(&node->tn_interlock);
132171029Sdelphij}
133171029Sdelphij
134170808Sdelphijstatic int
135191990Sattiliotmpfs_mount(struct mount *mp)
136170808Sdelphij{
137234000Sgleb	const size_t nodes_per_page = howmany(PAGE_SIZE,
138234000Sgleb	    sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node));
139170808Sdelphij	struct tmpfs_mount *tmp;
140170808Sdelphij	struct tmpfs_node *root;
141170808Sdelphij	int error;
142171308Sdelphij	/* Size counters. */
143233999Sgleb	u_quad_t pages;
144233999Sgleb	off_t nodes_max, size_max, maxfilesize;
145170808Sdelphij
146171308Sdelphij	/* Root node attributes. */
147202187Sjh	uid_t root_uid;
148202187Sjh	gid_t root_gid;
149202187Sjh	mode_t root_mode;
150171308Sdelphij
151202187Sjh	struct vattr va;
152171308Sdelphij
153170808Sdelphij	if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts))
154170808Sdelphij		return (EINVAL);
155170808Sdelphij
156170808Sdelphij	if (mp->mnt_flag & MNT_UPDATE) {
157234346Sjh		/* Only support update mounts for certain options. */
158234346Sjh		if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
159234346Sjh			return (EOPNOTSUPP);
160234346Sjh		if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) !=
161234346Sjh		    ((struct tmpfs_mount *)mp->mnt_data)->tm_ronly)
162234346Sjh			return (EOPNOTSUPP);
163234346Sjh		return (0);
164170808Sdelphij	}
165170808Sdelphij
166175202Sattilio	vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
167182371Sattilio	error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred);
168175294Sattilio	VOP_UNLOCK(mp->mnt_vnodecovered, 0);
169171308Sdelphij	if (error)
170171308Sdelphij		return (error);
171170808Sdelphij
172171308Sdelphij	if (mp->mnt_cred->cr_ruid != 0 ||
173171308Sdelphij	    vfs_scanopt(mp->mnt_optnew, "gid", "%d", &root_gid) != 1)
174171308Sdelphij		root_gid = va.va_gid;
175171308Sdelphij	if (mp->mnt_cred->cr_ruid != 0 ||
176171308Sdelphij	    vfs_scanopt(mp->mnt_optnew, "uid", "%d", &root_uid) != 1)
177171308Sdelphij		root_uid = va.va_uid;
178171308Sdelphij	if (mp->mnt_cred->cr_ruid != 0 ||
179173570Sdelphij	    vfs_scanopt(mp->mnt_optnew, "mode", "%ho", &root_mode) != 1)
180171308Sdelphij		root_mode = va.va_mode;
181233999Sgleb	if (vfs_getopt_size(mp->mnt_optnew, "inodes", &nodes_max) != 0)
182171308Sdelphij		nodes_max = 0;
183233999Sgleb	if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) != 0)
184171308Sdelphij		size_max = 0;
185233999Sgleb	if (vfs_getopt_size(mp->mnt_optnew, "maxfilesize", &maxfilesize) != 0)
186203164Sjh		maxfilesize = 0;
187170808Sdelphij
188170808Sdelphij	/* Do not allow mounts if we do not have enough memory to preserve
189170808Sdelphij	 * the minimum reserved pages. */
190233998Sgleb	if (tmpfs_mem_avail() < TMPFS_PAGES_MINRESERVED)
191170808Sdelphij		return ENOSPC;
192170808Sdelphij
193170808Sdelphij	/* Get the maximum number of memory pages this file system is
194170808Sdelphij	 * allowed to use, based on the maximum size the user passed in
195170808Sdelphij	 * the mount structure.  A value of zero is treated as if the
196170808Sdelphij	 * maximum available space was requested. */
197233999Sgleb	if (size_max < PAGE_SIZE || size_max > OFF_MAX - PAGE_SIZE ||
198233999Sgleb	    (SIZE_MAX < OFF_MAX && size_max / PAGE_SIZE >= SIZE_MAX))
199170808Sdelphij		pages = SIZE_MAX;
200170808Sdelphij	else
201171308Sdelphij		pages = howmany(size_max, PAGE_SIZE);
202170808Sdelphij	MPASS(pages > 0);
203170808Sdelphij
204202708Sjh	if (nodes_max <= 3) {
205234000Sgleb		if (pages < INT_MAX / nodes_per_page)
206234000Sgleb			nodes_max = pages * nodes_per_page;
207202708Sjh		else
208234000Sgleb			nodes_max = INT_MAX;
209233999Sgleb	}
210234000Sgleb	if (nodes_max > INT_MAX)
211234000Sgleb		nodes_max = INT_MAX;
212233999Sgleb	MPASS(nodes_max >= 3);
213170808Sdelphij
214170808Sdelphij	/* Allocate the tmpfs mount structure and fill it. */
215170808Sdelphij	tmp = (struct tmpfs_mount *)malloc(sizeof(struct tmpfs_mount),
216170808Sdelphij	    M_TMPFSMNT, M_WAITOK | M_ZERO);
217171070Sdelphij
218170808Sdelphij	mtx_init(&tmp->allnode_lock, "tmpfs allnode lock", NULL, MTX_DEF);
219233999Sgleb	tmp->tm_nodes_max = nodes_max;
220170808Sdelphij	tmp->tm_nodes_inuse = 0;
221233999Sgleb	tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX;
222170808Sdelphij	LIST_INIT(&tmp->tm_nodes_used);
223171070Sdelphij
224170808Sdelphij	tmp->tm_pages_max = pages;
225170808Sdelphij	tmp->tm_pages_used = 0;
226171362Sdelphij	tmp->tm_ino_unr = new_unrhdr(2, INT_MAX, &tmp->allnode_lock);
227173724Sdelphij	tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent",
228173724Sdelphij	    sizeof(struct tmpfs_dirent),
229173724Sdelphij	    NULL, NULL, NULL, NULL,
230173724Sdelphij	    UMA_ALIGN_PTR, 0);
231173724Sdelphij	tmp->tm_node_pool = uma_zcreate("TMPFS node",
232173724Sdelphij	    sizeof(struct tmpfs_node),
233173724Sdelphij	    tmpfs_node_ctor, tmpfs_node_dtor,
234173724Sdelphij	    tmpfs_node_init, tmpfs_node_fini,
235173724Sdelphij	    UMA_ALIGN_PTR, 0);
236234346Sjh	tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
237170808Sdelphij
238170808Sdelphij	/* Allocate the root node. */
239171308Sdelphij	error = tmpfs_alloc_node(tmp, VDIR, root_uid,
240171308Sdelphij	    root_gid, root_mode & ALLPERMS, NULL, NULL,
241191990Sattilio	    VNOVAL, &root);
242170808Sdelphij
243170808Sdelphij	if (error != 0 || root == NULL) {
244171029Sdelphij	    uma_zdestroy(tmp->tm_node_pool);
245171029Sdelphij	    uma_zdestroy(tmp->tm_dirent_pool);
246171362Sdelphij	    delete_unrhdr(tmp->tm_ino_unr);
247170808Sdelphij	    free(tmp, M_TMPFSMNT);
248170808Sdelphij	    return error;
249170808Sdelphij	}
250171362Sdelphij	KASSERT(root->tn_id == 2, ("tmpfs root with invalid ino: %d", root->tn_id));
251170808Sdelphij	tmp->tm_root = root;
252170808Sdelphij
253170808Sdelphij	MNT_ILOCK(mp);
254170808Sdelphij	mp->mnt_flag |= MNT_LOCAL;
255170808Sdelphij	mp->mnt_kern_flag |= MNTK_MPSAFE;
256170808Sdelphij	MNT_IUNLOCK(mp);
257171070Sdelphij
258170808Sdelphij	mp->mnt_data = tmp;
259170808Sdelphij	mp->mnt_stat.f_namemax = MAXNAMLEN;
260170808Sdelphij	vfs_getnewfsid(mp);
261170808Sdelphij	vfs_mountedfrom(mp, "tmpfs");
262170808Sdelphij
263170808Sdelphij	return 0;
264170808Sdelphij}
265170808Sdelphij
266170808Sdelphij/* --------------------------------------------------------------------- */
267170808Sdelphij
268170808Sdelphij/* ARGSUSED2 */
269170808Sdelphijstatic int
270191990Sattiliotmpfs_unmount(struct mount *mp, int mntflags)
271170808Sdelphij{
272170808Sdelphij	int error;
273170808Sdelphij	int flags = 0;
274170808Sdelphij	struct tmpfs_mount *tmp;
275170808Sdelphij	struct tmpfs_node *node;
276170808Sdelphij
277170808Sdelphij	/* Handle forced unmounts. */
278170808Sdelphij	if (mntflags & MNT_FORCE)
279170808Sdelphij		flags |= FORCECLOSE;
280170808Sdelphij
281170808Sdelphij	/* Finalize all pending I/O. */
282191990Sattilio	error = vflush(mp, 0, flags, curthread);
283170808Sdelphij	if (error != 0)
284170808Sdelphij		return error;
285170808Sdelphij
286170808Sdelphij	tmp = VFS_TO_TMPFS(mp);
287171070Sdelphij
288170808Sdelphij	/* Free all associated data.  The loop iterates over the linked list
289170808Sdelphij	 * we have containing all used nodes.  For each of them that is
290170808Sdelphij	 * a directory, we free all its directory entries.  Note that after
291170808Sdelphij	 * freeing a node, it will automatically go to the available list,
292170808Sdelphij	 * so we will later have to iterate over it to release its items. */
293170808Sdelphij	node = LIST_FIRST(&tmp->tm_nodes_used);
294170808Sdelphij	while (node != NULL) {
295170808Sdelphij		struct tmpfs_node *next;
296170808Sdelphij
297170808Sdelphij		if (node->tn_type == VDIR) {
298170808Sdelphij			struct tmpfs_dirent *de;
299170808Sdelphij
300170808Sdelphij			de = TAILQ_FIRST(&node->tn_dir.tn_dirhead);
301170808Sdelphij			while (de != NULL) {
302170808Sdelphij				struct tmpfs_dirent *nde;
303170808Sdelphij
304170808Sdelphij				nde = TAILQ_NEXT(de, td_entries);
305170808Sdelphij				tmpfs_free_dirent(tmp, de, FALSE);
306170808Sdelphij				de = nde;
307170808Sdelphij				node->tn_size -= sizeof(struct tmpfs_dirent);
308170808Sdelphij			}
309170808Sdelphij		}
310170808Sdelphij
311170808Sdelphij		next = LIST_NEXT(node, tn_entries);
312170808Sdelphij		tmpfs_free_node(tmp, node);
313170808Sdelphij		node = next;
314170808Sdelphij	}
315170808Sdelphij
316171029Sdelphij	uma_zdestroy(tmp->tm_dirent_pool);
317171029Sdelphij	uma_zdestroy(tmp->tm_node_pool);
318171362Sdelphij	delete_unrhdr(tmp->tm_ino_unr);
319170808Sdelphij
320170808Sdelphij	mtx_destroy(&tmp->allnode_lock);
321170808Sdelphij	MPASS(tmp->tm_pages_used == 0);
322171308Sdelphij	MPASS(tmp->tm_nodes_inuse == 0);
323170808Sdelphij
324170808Sdelphij	/* Throw away the tmpfs_mount structure. */
325170808Sdelphij	free(mp->mnt_data, M_TMPFSMNT);
326170808Sdelphij	mp->mnt_data = NULL;
327171070Sdelphij
328170808Sdelphij	MNT_ILOCK(mp);
329170808Sdelphij	mp->mnt_flag &= ~MNT_LOCAL;
330170808Sdelphij	MNT_IUNLOCK(mp);
331170808Sdelphij	return 0;
332170808Sdelphij}
333170808Sdelphij
334170808Sdelphij/* --------------------------------------------------------------------- */
335170808Sdelphij
336170808Sdelphijstatic int
337191990Sattiliotmpfs_root(struct mount *mp, int flags, struct vnode **vpp)
338170808Sdelphij{
339170808Sdelphij	int error;
340191990Sattilio	error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp);
341170808Sdelphij
342170808Sdelphij	if (!error)
343171029Sdelphij		(*vpp)->v_vflag |= VV_ROOT;
344170808Sdelphij
345170808Sdelphij	return error;
346170808Sdelphij}
347170808Sdelphij
348170808Sdelphij/* --------------------------------------------------------------------- */
349170808Sdelphij
350170808Sdelphijstatic int
351222167Srmacklemtmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
352222167Srmacklem    struct vnode **vpp)
353170808Sdelphij{
354170808Sdelphij	boolean_t found;
355170808Sdelphij	struct tmpfs_fid *tfhp;
356170808Sdelphij	struct tmpfs_mount *tmp;
357170808Sdelphij	struct tmpfs_node *node;
358170808Sdelphij
359170808Sdelphij	tmp = VFS_TO_TMPFS(mp);
360170808Sdelphij
361170808Sdelphij	tfhp = (struct tmpfs_fid *)fhp;
362170808Sdelphij	if (tfhp->tf_len != sizeof(struct tmpfs_fid))
363170808Sdelphij		return EINVAL;
364170808Sdelphij
365170808Sdelphij	if (tfhp->tf_id >= tmp->tm_nodes_max)
366170808Sdelphij		return EINVAL;
367170808Sdelphij
368170808Sdelphij	found = FALSE;
369170808Sdelphij
370170808Sdelphij	TMPFS_LOCK(tmp);
371170808Sdelphij	LIST_FOREACH(node, &tmp->tm_nodes_used, tn_entries) {
372170808Sdelphij		if (node->tn_id == tfhp->tf_id &&
373170808Sdelphij		    node->tn_gen == tfhp->tf_gen) {
374170808Sdelphij			found = TRUE;
375170808Sdelphij			break;
376170808Sdelphij		}
377170808Sdelphij	}
378170808Sdelphij	TMPFS_UNLOCK(tmp);
379170808Sdelphij
380171799Sdelphij	if (found)
381191990Sattilio		return (tmpfs_alloc_vp(mp, node, LK_EXCLUSIVE, vpp));
382171799Sdelphij
383171799Sdelphij	return (EINVAL);
384170808Sdelphij}
385170808Sdelphij
386170808Sdelphij/* --------------------------------------------------------------------- */
387170808Sdelphij
388170808Sdelphij/* ARGSUSED2 */
389170808Sdelphijstatic int
390191990Sattiliotmpfs_statfs(struct mount *mp, struct statfs *sbp)
391170808Sdelphij{
392170808Sdelphij	struct tmpfs_mount *tmp;
393233998Sgleb	size_t used;
394170808Sdelphij
395170808Sdelphij	tmp = VFS_TO_TMPFS(mp);
396170808Sdelphij
397171070Sdelphij	sbp->f_iosize = PAGE_SIZE;
398170808Sdelphij	sbp->f_bsize = PAGE_SIZE;
399170808Sdelphij
400233998Sgleb	used = tmpfs_pages_used(tmp);
401233998Sgleb	if (tmp->tm_pages_max != SIZE_MAX)
402233998Sgleb		 sbp->f_blocks = tmp->tm_pages_max;
403233998Sgleb	else
404233998Sgleb		 sbp->f_blocks = used + tmpfs_mem_avail();
405233998Sgleb	if (sbp->f_blocks <= used)
406233998Sgleb		sbp->f_bavail = 0;
407233998Sgleb	else
408233998Sgleb		sbp->f_bavail = sbp->f_blocks - used;
409233998Sgleb	sbp->f_bfree = sbp->f_bavail;
410233998Sgleb	used = tmp->tm_nodes_inuse;
411233998Sgleb	sbp->f_files = tmp->tm_nodes_max;
412233998Sgleb	if (sbp->f_files <= used)
413233998Sgleb		sbp->f_ffree = 0;
414233998Sgleb	else
415233998Sgleb		sbp->f_ffree = sbp->f_files - used;
416170808Sdelphij	/* sbp->f_owner = tmp->tn_uid; */
417170808Sdelphij
418170808Sdelphij	return 0;
419170808Sdelphij}
420170808Sdelphij
421170808Sdelphij/* --------------------------------------------------------------------- */
422170808Sdelphij
423170808Sdelphij/*
424170808Sdelphij * tmpfs vfs operations.
425170808Sdelphij */
426170808Sdelphij
427170808Sdelphijstruct vfsops tmpfs_vfsops = {
428170808Sdelphij	.vfs_mount =			tmpfs_mount,
429170808Sdelphij	.vfs_unmount =			tmpfs_unmount,
430170808Sdelphij	.vfs_root =			tmpfs_root,
431170808Sdelphij	.vfs_statfs =			tmpfs_statfs,
432170808Sdelphij	.vfs_fhtovp =			tmpfs_fhtovp,
433170808Sdelphij};
434170808SdelphijVFS_SET(tmpfs_vfsops, tmpfs, 0);
435