pseudofs.c (103314) | pseudofs.c (109623) |
---|---|
1/*- 2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/fs/pseudofs/pseudofs.c 103314 2002-09-14 09:02:28Z njl $ | 28 * $FreeBSD: head/sys/fs/pseudofs/pseudofs.c 109623 2003-01-21 08:56:16Z alfred $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/kernel.h> 33#include <sys/systm.h> 34#include <sys/lock.h> 35#include <sys/malloc.h> 36#include <sys/module.h> --- 50 unchanged lines hidden (view full) --- 87 * Add . and .. to a directory 88 */ 89static int 90_pfs_fixup_dir(struct pfs_node *parent) 91{ 92 struct pfs_node *dir; 93 94 MALLOC(dir, struct pfs_node *, sizeof *dir, | 29 */ 30 31#include <sys/param.h> 32#include <sys/kernel.h> 33#include <sys/systm.h> 34#include <sys/lock.h> 35#include <sys/malloc.h> 36#include <sys/module.h> --- 50 unchanged lines hidden (view full) --- 87 * Add . and .. to a directory 88 */ 89static int 90_pfs_fixup_dir(struct pfs_node *parent) 91{ 92 struct pfs_node *dir; 93 94 MALLOC(dir, struct pfs_node *, sizeof *dir, |
95 M_PFSNODES, M_WAITOK|M_ZERO); | 95 M_PFSNODES, M_ZERO); |
96 dir->pn_name[0] = '.'; 97 dir->pn_type = pfstype_this; 98 99 if (_pfs_add_node(parent, dir) != 0) { 100 FREE(dir, M_PFSNODES); 101 return (-1); 102 } 103 104 MALLOC(dir, struct pfs_node *, sizeof *dir, | 96 dir->pn_name[0] = '.'; 97 dir->pn_type = pfstype_this; 98 99 if (_pfs_add_node(parent, dir) != 0) { 100 FREE(dir, M_PFSNODES); 101 return (-1); 102 } 103 104 MALLOC(dir, struct pfs_node *, sizeof *dir, |
105 M_PFSNODES, M_WAITOK|M_ZERO); | 105 M_PFSNODES, M_ZERO); |
106 dir->pn_name[0] = dir->pn_name[1] = '.'; 107 dir->pn_type = pfstype_parent; 108 109 if (_pfs_add_node(parent, dir) != 0) { 110 FREE(dir, M_PFSNODES); 111 return (-1); 112 } 113 --- 8 unchanged lines hidden (view full) --- 122 pfs_attr_t attr, pfs_vis_t vis, int flags) 123{ 124 struct pfs_node *dir; 125 126 KASSERT(strlen(name) < PFS_NAMELEN, 127 ("%s(): node name is too long", __func__)); 128 129 MALLOC(dir, struct pfs_node *, sizeof *dir, | 106 dir->pn_name[0] = dir->pn_name[1] = '.'; 107 dir->pn_type = pfstype_parent; 108 109 if (_pfs_add_node(parent, dir) != 0) { 110 FREE(dir, M_PFSNODES); 111 return (-1); 112 } 113 --- 8 unchanged lines hidden (view full) --- 122 pfs_attr_t attr, pfs_vis_t vis, int flags) 123{ 124 struct pfs_node *dir; 125 126 KASSERT(strlen(name) < PFS_NAMELEN, 127 ("%s(): node name is too long", __func__)); 128 129 MALLOC(dir, struct pfs_node *, sizeof *dir, |
130 M_PFSNODES, M_WAITOK|M_ZERO); | 130 M_PFSNODES, M_ZERO); |
131 strcpy(dir->pn_name, name); 132 dir->pn_type = (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir; 133 dir->pn_attr = attr; 134 dir->pn_vis = vis; 135 dir->pn_flags = flags; 136 137 if (_pfs_add_node(parent, dir) != 0) { 138 FREE(dir, M_PFSNODES); --- 16 unchanged lines hidden (view full) --- 155 pfs_attr_t attr, pfs_vis_t vis, int flags) 156{ 157 struct pfs_node *node; 158 159 KASSERT(strlen(name) < PFS_NAMELEN, 160 ("%s(): node name is too long", __func__)); 161 162 MALLOC(node, struct pfs_node *, sizeof *node, | 131 strcpy(dir->pn_name, name); 132 dir->pn_type = (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir; 133 dir->pn_attr = attr; 134 dir->pn_vis = vis; 135 dir->pn_flags = flags; 136 137 if (_pfs_add_node(parent, dir) != 0) { 138 FREE(dir, M_PFSNODES); --- 16 unchanged lines hidden (view full) --- 155 pfs_attr_t attr, pfs_vis_t vis, int flags) 156{ 157 struct pfs_node *node; 158 159 KASSERT(strlen(name) < PFS_NAMELEN, 160 ("%s(): node name is too long", __func__)); 161 162 MALLOC(node, struct pfs_node *, sizeof *node, |
163 M_PFSNODES, M_WAITOK|M_ZERO); | 163 M_PFSNODES, M_ZERO); |
164 strcpy(node->pn_name, name); 165 node->pn_type = pfstype_file; 166 node->pn_func = fill; 167 node->pn_attr = attr; 168 node->pn_vis = vis; 169 node->pn_flags = flags; 170 171 if (_pfs_add_node(parent, node) != 0) { --- 143 unchanged lines hidden (view full) --- 315{ 316 struct pfs_node *root; 317 int error; 318 319 mtx_init(&pi->pi_mutex, "pseudofs", NULL, MTX_DEF); 320 321 /* set up the root diretory */ 322 MALLOC(root, struct pfs_node *, sizeof *root, | 164 strcpy(node->pn_name, name); 165 node->pn_type = pfstype_file; 166 node->pn_func = fill; 167 node->pn_attr = attr; 168 node->pn_vis = vis; 169 node->pn_flags = flags; 170 171 if (_pfs_add_node(parent, node) != 0) { --- 143 unchanged lines hidden (view full) --- 315{ 316 struct pfs_node *root; 317 int error; 318 319 mtx_init(&pi->pi_mutex, "pseudofs", NULL, MTX_DEF); 320 321 /* set up the root diretory */ 322 MALLOC(root, struct pfs_node *, sizeof *root, |
323 M_PFSNODES, M_WAITOK|M_ZERO); | 323 M_PFSNODES, M_ZERO); |
324 root->pn_type = pfstype_root; 325 root->pn_name[0] = '/'; 326 root->pn_info = pi; 327 if (_pfs_fixup_dir(root) != 0) { 328 FREE(root, M_PFSNODES); 329 return (ENODEV); /* XXX not really the right errno */ 330 } 331 pi->pi_root = root; --- 67 unchanged lines hidden --- | 324 root->pn_type = pfstype_root; 325 root->pn_name[0] = '/'; 326 root->pn_info = pi; 327 if (_pfs_fixup_dir(root) != 0) { 328 FREE(root, M_PFSNODES); 329 return (ENODEV); /* XXX not really the right errno */ 330 } 331 pi->pi_root = root; --- 67 unchanged lines hidden --- |