Deleted Added
full compact
tmpfs_vfsops.c (253573) tmpfs_vfsops.c (254741)
1/* $NetBSD: tmpfs_vfsops.c,v 1.10 2005/12/11 12:24:29 christos Exp $ */
2
3/*-
4 * Copyright (c) 2005 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal, developed as part of Google's Summer of Code

--- 27 unchanged lines hidden (view full) ---

36 * tmpfs is a file system that uses NetBSD's virtual memory sub-system
37 * (the well-known UVM) to store file data and metadata in an efficient
38 * way. This means that it does not follow the structure of an on-disk
39 * file system because it simply does not need to. Instead, it uses
40 * memory-specific data structures and algorithms to automatically
41 * allocate and release resources.
42 */
43#include <sys/cdefs.h>
1/* $NetBSD: tmpfs_vfsops.c,v 1.10 2005/12/11 12:24:29 christos Exp $ */
2
3/*-
4 * Copyright (c) 2005 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal, developed as part of Google's Summer of Code

--- 27 unchanged lines hidden (view full) ---

36 * tmpfs is a file system that uses NetBSD's virtual memory sub-system
37 * (the well-known UVM) to store file data and metadata in an efficient
38 * way. This means that it does not follow the structure of an on-disk
39 * file system because it simply does not need to. Instead, it uses
40 * memory-specific data structures and algorithms to automatically
41 * allocate and release resources.
42 */
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vfsops.c 253573 2013-07-23 14:48:37Z nwhitehorn $");
44__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vfsops.c 254741 2013-08-23 22:52:20Z delphij $");
45
46#include <sys/param.h>
47#include <sys/limits.h>
48#include <sys/lock.h>
49#include <sys/mutex.h>
45
46#include <sys/param.h>
47#include <sys/limits.h>
48#include <sys/lock.h>
49#include <sys/mutex.h>
50#include <sys/proc.h>
51#include <sys/jail.h>
50#include <sys/kernel.h>
51#include <sys/stat.h>
52#include <sys/systm.h>
53#include <sys/sysctl.h>
54
55#include <vm/vm.h>
56#include <vm/vm_object.h>
57#include <vm/vm_param.h>

--- 75 unchanged lines hidden (view full) ---

133
134static int
135tmpfs_mount(struct mount *mp)
136{
137 const size_t nodes_per_page = howmany(PAGE_SIZE,
138 sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node));
139 struct tmpfs_mount *tmp;
140 struct tmpfs_node *root;
52#include <sys/kernel.h>
53#include <sys/stat.h>
54#include <sys/systm.h>
55#include <sys/sysctl.h>
56
57#include <vm/vm.h>
58#include <vm/vm_object.h>
59#include <vm/vm_param.h>

--- 75 unchanged lines hidden (view full) ---

135
136static int
137tmpfs_mount(struct mount *mp)
138{
139 const size_t nodes_per_page = howmany(PAGE_SIZE,
140 sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node));
141 struct tmpfs_mount *tmp;
142 struct tmpfs_node *root;
143 struct thread *td = curthread;
141 int error;
142 /* Size counters. */
143 u_quad_t pages;
144 off_t nodes_max, size_max, maxfilesize;
145
146 /* Root node attributes. */
147 uid_t root_uid;
148 gid_t root_gid;
149 mode_t root_mode;
150
151 struct vattr va;
152
144 int error;
145 /* Size counters. */
146 u_quad_t pages;
147 off_t nodes_max, size_max, maxfilesize;
148
149 /* Root node attributes. */
150 uid_t root_uid;
151 gid_t root_gid;
152 mode_t root_mode;
153
154 struct vattr va;
155
156 if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_TMPFS))
157 return (EPERM);
158
153 if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts))
154 return (EINVAL);
155
156 if (mp->mnt_flag & MNT_UPDATE) {
157 /* Only support update mounts for certain options. */
158 if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
159 return (EOPNOTSUPP);
160 if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) !=

--- 254 unchanged lines hidden (view full) ---

415
416struct vfsops tmpfs_vfsops = {
417 .vfs_mount = tmpfs_mount,
418 .vfs_unmount = tmpfs_unmount,
419 .vfs_root = tmpfs_root,
420 .vfs_statfs = tmpfs_statfs,
421 .vfs_fhtovp = tmpfs_fhtovp,
422};
159 if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts))
160 return (EINVAL);
161
162 if (mp->mnt_flag & MNT_UPDATE) {
163 /* Only support update mounts for certain options. */
164 if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
165 return (EOPNOTSUPP);
166 if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) !=

--- 254 unchanged lines hidden (view full) ---

421
422struct vfsops tmpfs_vfsops = {
423 .vfs_mount = tmpfs_mount,
424 .vfs_unmount = tmpfs_unmount,
425 .vfs_root = tmpfs_root,
426 .vfs_statfs = tmpfs_statfs,
427 .vfs_fhtovp = tmpfs_fhtovp,
428};
423VFS_SET(tmpfs_vfsops, tmpfs, 0);
429VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL);