Deleted Added
full compact
tmpfs_vfsops.c (171070) tmpfs_vfsops.c (171087)
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

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

43 * tmpfs is a file system that uses NetBSD's virtual memory sub-system
44 * (the well-known UVM) to store file data and metadata in an efficient
45 * way. This means that it does not follow the structure of an on-disk
46 * file system because it simply does not need to. Instead, it uses
47 * memory-specific data structures and algorithms to automatically
48 * allocate and release resources.
49 */
50#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

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

43 * tmpfs is a file system that uses NetBSD's virtual memory sub-system
44 * (the well-known UVM) to store file data and metadata in an efficient
45 * way. This means that it does not follow the structure of an on-disk
46 * file system because it simply does not need to. Instead, it uses
47 * memory-specific data structures and algorithms to automatically
48 * allocate and release resources.
49 */
50#include <sys/cdefs.h>
51__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vfsops.c 171070 2007-06-28 02:39:31Z delphij $");
51__FBSDID("$FreeBSD: head/sys/fs/tmpfs/tmpfs_vfsops.c 171087 2007-06-29 05:23:15Z delphij $");
52
53#include <sys/param.h>
54#include <sys/lock.h>
55#include <sys/mutex.h>
56#include <sys/kernel.h>
57#include <sys/stat.h>
58#include <sys/systm.h>
59#include <sys/sysctl.h>

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

65#include <fs/tmpfs/tmpfs.h>
66
67/*
68 * Default permission for root node
69 */
70#define TMPFS_DEFAULT_ROOT_MODE (S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
71
72MALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures");
52
53#include <sys/param.h>
54#include <sys/lock.h>
55#include <sys/mutex.h>
56#include <sys/kernel.h>
57#include <sys/stat.h>
58#include <sys/systm.h>
59#include <sys/sysctl.h>

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

65#include <fs/tmpfs/tmpfs.h>
66
67/*
68 * Default permission for root node
69 */
70#define TMPFS_DEFAULT_ROOT_MODE (S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
71
72MALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures");
73MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names");
73
74/* --------------------------------------------------------------------- */
75
76static int tmpfs_mount(struct mount *, struct thread *);
77static int tmpfs_unmount(struct mount *, int, struct thread *);
78static int tmpfs_root(struct mount *, int flags, struct vnode **,
79 struct thread *);
80static int tmpfs_fhtovp(struct mount *, struct fid *, struct vnode **);

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

271 UMA_ALIGN_PTR,
272 0);
273 tmp->tm_node_pool = uma_zcreate(
274 "TMPFS node",
275 sizeof(struct tmpfs_node),
276 tmpfs_node_ctor, tmpfs_node_dtor,
277 tmpfs_node_init, tmpfs_node_fini,
278 UMA_ALIGN_PTR,
74
75/* --------------------------------------------------------------------- */
76
77static int tmpfs_mount(struct mount *, struct thread *);
78static int tmpfs_unmount(struct mount *, int, struct thread *);
79static int tmpfs_root(struct mount *, int flags, struct vnode **,
80 struct thread *);
81static int tmpfs_fhtovp(struct mount *, struct fid *, struct vnode **);

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

272 UMA_ALIGN_PTR,
273 0);
274 tmp->tm_node_pool = uma_zcreate(
275 "TMPFS node",
276 sizeof(struct tmpfs_node),
277 tmpfs_node_ctor, tmpfs_node_dtor,
278 tmpfs_node_init, tmpfs_node_fini,
279 UMA_ALIGN_PTR,
279 0);
280 tmpfs_str_zone_create(&tmp->tm_str_pool);
280 UMA_ZONE_NOFREE);
281
282 /* Allocate the root node. */
283 error = tmpfs_alloc_node(tmp, VDIR, args.ta_root_uid,
284 args.ta_root_gid, args.ta_root_mode & ALLPERMS, NULL, NULL,
285 VNOVAL, l, &root);
286
287 if (error != 0 || root == NULL) {
281
282 /* Allocate the root node. */
283 error = tmpfs_alloc_node(tmp, VDIR, args.ta_root_uid,
284 args.ta_root_gid, args.ta_root_mode & ALLPERMS, NULL, NULL,
285 VNOVAL, l, &root);
286
287 if (error != 0 || root == NULL) {
288 tmpfs_str_zone_destroy(&tmp->tm_str_pool);
289 uma_zdestroy(tmp->tm_node_pool);
290 uma_zdestroy(tmp->tm_dirent_pool);
291 free(tmp, M_TMPFSMNT);
292 return error;
293 }
294 tmp->tm_root = root;
295
296 MNT_ILOCK(mp);

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

353
354 next = LIST_NEXT(node, tn_entries);
355 tmpfs_free_node(tmp, node);
356 node = next;
357 }
358
359 uma_zdestroy(tmp->tm_dirent_pool);
360 uma_zdestroy(tmp->tm_node_pool);
288 uma_zdestroy(tmp->tm_node_pool);
289 uma_zdestroy(tmp->tm_dirent_pool);
290 free(tmp, M_TMPFSMNT);
291 return error;
292 }
293 tmp->tm_root = root;
294
295 MNT_ILOCK(mp);

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

352
353 next = LIST_NEXT(node, tn_entries);
354 tmpfs_free_node(tmp, node);
355 node = next;
356 }
357
358 uma_zdestroy(tmp->tm_dirent_pool);
359 uma_zdestroy(tmp->tm_node_pool);
361 tmpfs_str_zone_destroy(&tmp->tm_str_pool);
362
363 mtx_destroy(&tmp->allnode_lock);
364 MPASS(tmp->tm_pages_used == 0);
365
366 /* Throw away the tmpfs_mount structure. */
367 free(mp->mnt_data, M_TMPFSMNT);
368 mp->mnt_data = NULL;
369

--- 95 unchanged lines hidden ---
360
361 mtx_destroy(&tmp->allnode_lock);
362 MPASS(tmp->tm_pages_used == 0);
363
364 /* Throw away the tmpfs_mount structure. */
365 free(mp->mnt_data, M_TMPFSMNT);
366 mp->mnt_data = NULL;
367

--- 95 unchanged lines hidden ---