vfs_init.c (98641) | vfs_init.c (109623) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed 6 * to Berkeley by John Heidemann of the UCLA Ficus project. 7 * 8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_init.c 8.3 (Berkeley) 1/4/94 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed 6 * to Berkeley by John Heidemann of the UCLA Ficus project. 7 * 8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_init.c 8.3 (Berkeley) 1/4/94 |
39 * $FreeBSD: head/sys/kern/vfs_init.c 98641 2002-06-22 21:44:11Z mux $ | 39 * $FreeBSD: head/sys/kern/vfs_init.c 109623 2003-01-21 08:56:16Z alfred $ |
40 */ 41 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/mount.h> 47#include <sys/sysctl.h> --- 80 unchanged lines hidden (view full) --- 128 129 /* 130 * Allocate and initialize temporary array to store 131 * offsets. Sort it to put all uninitialized entries 132 * first and to make holes in existing offset sequence 133 * detectable. 134 */ 135 MALLOC(vfs_op_offsets, int *, | 40 */ 41 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/mount.h> 47#include <sys/sysctl.h> --- 80 unchanged lines hidden (view full) --- 128 129 /* 130 * Allocate and initialize temporary array to store 131 * offsets. Sort it to put all uninitialized entries 132 * first and to make holes in existing offset sequence 133 * detectable. 134 */ 135 MALLOC(vfs_op_offsets, int *, |
136 num_op_descs * sizeof(int), M_TEMP, M_WAITOK); | 136 num_op_descs * sizeof(int), M_TEMP, 0); |
137 if (vfs_op_offsets == NULL) 138 panic("vfs_opv_recalc: no memory"); 139 for (i = 0; i < num_op_descs; i++) 140 vfs_op_offsets[i] = vfs_op_descs[i]->vdesc_offset; 141 qsort(vfs_op_offsets, num_op_descs, sizeof(int), int_cmp); 142 143 /* 144 * Run through and make sure all known descs have an offset. --- 36 unchanged lines hidden (view full) --- 181 * Allocate and fill in the vectors 182 */ 183 for (i = 0; i < vnodeopv_num; i++) { 184 opv = vnodeopv_descs[i]; 185 opv_desc_vector_p = opv->opv_desc_vector_p; 186 if (*opv_desc_vector_p == NULL) 187 MALLOC(*opv_desc_vector_p, vop_t **, 188 vfs_opv_numops * sizeof(vop_t *), M_VNODE, | 137 if (vfs_op_offsets == NULL) 138 panic("vfs_opv_recalc: no memory"); 139 for (i = 0; i < num_op_descs; i++) 140 vfs_op_offsets[i] = vfs_op_descs[i]->vdesc_offset; 141 qsort(vfs_op_offsets, num_op_descs, sizeof(int), int_cmp); 142 143 /* 144 * Run through and make sure all known descs have an offset. --- 36 unchanged lines hidden (view full) --- 181 * Allocate and fill in the vectors 182 */ 183 for (i = 0; i < vnodeopv_num; i++) { 184 opv = vnodeopv_descs[i]; 185 opv_desc_vector_p = opv->opv_desc_vector_p; 186 if (*opv_desc_vector_p == NULL) 187 MALLOC(*opv_desc_vector_p, vop_t **, 188 vfs_opv_numops * sizeof(vop_t *), M_VNODE, |
189 M_WAITOK | M_ZERO); | 189 M_ZERO); |
190 191 /* Fill in, with slot 0 being to return EOPNOTSUPP */ 192 opv_desc_vector = *opv_desc_vector_p; 193 opv_desc_vector[0] = (vop_t *)vop_eopnotsupp; 194 for (j = 0; opv->opv_desc_ops[j].opve_op; j++) { 195 opve_descp = &(opv->opv_desc_ops[j]); 196 opv_desc_vector[opve_descp->opve_op->vdesc_offset] = 197 opve_descp->opve_impl; --- 18 unchanged lines hidden (view full) --- 216 struct vnodeop_desc **newop; 217 int *newref; 218 vop_t **opv_desc_vector; 219 struct vnodeop_desc *desc; 220 int i, j; 221 222 opv = (const struct vnodeopv_desc *)data; 223 MALLOC(newopv, const struct vnodeopv_desc **, | 190 191 /* Fill in, with slot 0 being to return EOPNOTSUPP */ 192 opv_desc_vector = *opv_desc_vector_p; 193 opv_desc_vector[0] = (vop_t *)vop_eopnotsupp; 194 for (j = 0; opv->opv_desc_ops[j].opve_op; j++) { 195 opve_descp = &(opv->opv_desc_ops[j]); 196 opv_desc_vector[opve_descp->opve_op->vdesc_offset] = 197 opve_descp->opve_impl; --- 18 unchanged lines hidden (view full) --- 216 struct vnodeop_desc **newop; 217 int *newref; 218 vop_t **opv_desc_vector; 219 struct vnodeop_desc *desc; 220 int i, j; 221 222 opv = (const struct vnodeopv_desc *)data; 223 MALLOC(newopv, const struct vnodeopv_desc **, |
224 (vnodeopv_num + 1) * sizeof(*newopv), M_VNODE, M_WAITOK); | 224 (vnodeopv_num + 1) * sizeof(*newopv), M_VNODE, 0); |
225 if (vnodeopv_descs) { 226 bcopy(vnodeopv_descs, newopv, vnodeopv_num * sizeof(*newopv)); 227 FREE(vnodeopv_descs, M_VNODE); 228 } 229 newopv[vnodeopv_num] = opv; 230 vnodeopv_descs = newopv; 231 vnodeopv_num++; 232 --- 6 unchanged lines hidden (view full) --- 239 vfs_op_desc_refs[j]++; 240 break; 241 } 242 } 243 if (j == num_op_descs) { 244 /* not found, new entry */ 245 MALLOC(newop, struct vnodeop_desc **, 246 (num_op_descs + 1) * sizeof(*newop), | 225 if (vnodeopv_descs) { 226 bcopy(vnodeopv_descs, newopv, vnodeopv_num * sizeof(*newopv)); 227 FREE(vnodeopv_descs, M_VNODE); 228 } 229 newopv[vnodeopv_num] = opv; 230 vnodeopv_descs = newopv; 231 vnodeopv_num++; 232 --- 6 unchanged lines hidden (view full) --- 239 vfs_op_desc_refs[j]++; 240 break; 241 } 242 } 243 if (j == num_op_descs) { 244 /* not found, new entry */ 245 MALLOC(newop, struct vnodeop_desc **, 246 (num_op_descs + 1) * sizeof(*newop), |
247 M_VNODE, M_WAITOK); | 247 M_VNODE, 0); |
248 /* new reference count (for unload) */ 249 MALLOC(newref, int *, 250 (num_op_descs + 1) * sizeof(*newref), | 248 /* new reference count (for unload) */ 249 MALLOC(newref, int *, 250 (num_op_descs + 1) * sizeof(*newref), |
251 M_VNODE, M_WAITOK); | 251 M_VNODE, 0); |
252 if (vfs_op_descs) { 253 bcopy(vfs_op_descs, newop, 254 num_op_descs * sizeof(*newop)); 255 FREE(vfs_op_descs, M_VNODE); 256 } 257 if (vfs_op_desc_refs) { 258 bcopy(vfs_op_desc_refs, newref, 259 num_op_descs * sizeof(*newref)); --- 41 unchanged lines hidden (view full) --- 301 opv_desc_vector = 302 *(vnodeopv_descs[k]->opv_desc_vector_p); 303 if (opv_desc_vector != NULL) 304 opv_desc_vector[desc->vdesc_offset] = 305 opv_desc_vector[1]; 306 } 307 MALLOC(newop, struct vnodeop_desc **, 308 (num_op_descs - 1) * sizeof(*newop), | 252 if (vfs_op_descs) { 253 bcopy(vfs_op_descs, newop, 254 num_op_descs * sizeof(*newop)); 255 FREE(vfs_op_descs, M_VNODE); 256 } 257 if (vfs_op_desc_refs) { 258 bcopy(vfs_op_desc_refs, newref, 259 num_op_descs * sizeof(*newref)); --- 41 unchanged lines hidden (view full) --- 301 opv_desc_vector = 302 *(vnodeopv_descs[k]->opv_desc_vector_p); 303 if (opv_desc_vector != NULL) 304 opv_desc_vector[desc->vdesc_offset] = 305 opv_desc_vector[1]; 306 } 307 MALLOC(newop, struct vnodeop_desc **, 308 (num_op_descs - 1) * sizeof(*newop), |
309 M_VNODE, M_WAITOK); | 309 M_VNODE, 0); |
310 /* new reference count (for unload) */ 311 MALLOC(newref, int *, 312 (num_op_descs - 1) * sizeof(*newref), | 310 /* new reference count (for unload) */ 311 MALLOC(newref, int *, 312 (num_op_descs - 1) * sizeof(*newref), |
313 M_VNODE, M_WAITOK); | 313 M_VNODE, 0); |
314 for (k = j; k < (num_op_descs - 1); k++) { 315 vfs_op_descs[k] = vfs_op_descs[k + 1]; 316 vfs_op_desc_refs[k] = vfs_op_desc_refs[k + 1]; 317 } 318 bcopy(vfs_op_descs, newop, 319 (num_op_descs - 1) * sizeof(*newop)); 320 bcopy(vfs_op_desc_refs, newref, 321 (num_op_descs - 1) * sizeof(*newref)); --- 13 unchanged lines hidden (view full) --- 335 } 336 } 337 if (i == vnodeopv_num) 338 panic("vfs_remove_vnodeops: opv not found"); 339 opv_desc_vector = *(opv->opv_desc_vector_p); 340 if (opv_desc_vector != NULL) 341 FREE(opv_desc_vector, M_VNODE); 342 MALLOC(newopv, const struct vnodeopv_desc **, | 314 for (k = j; k < (num_op_descs - 1); k++) { 315 vfs_op_descs[k] = vfs_op_descs[k + 1]; 316 vfs_op_desc_refs[k] = vfs_op_desc_refs[k + 1]; 317 } 318 bcopy(vfs_op_descs, newop, 319 (num_op_descs - 1) * sizeof(*newop)); 320 bcopy(vfs_op_desc_refs, newref, 321 (num_op_descs - 1) * sizeof(*newref)); --- 13 unchanged lines hidden (view full) --- 335 } 336 } 337 if (i == vnodeopv_num) 338 panic("vfs_remove_vnodeops: opv not found"); 339 opv_desc_vector = *(opv->opv_desc_vector_p); 340 if (opv_desc_vector != NULL) 341 FREE(opv_desc_vector, M_VNODE); 342 MALLOC(newopv, const struct vnodeopv_desc **, |
343 (vnodeopv_num - 1) * sizeof(*newopv), M_VNODE, M_WAITOK); | 343 (vnodeopv_num - 1) * sizeof(*newopv), M_VNODE, 0); |
344 bcopy(vnodeopv_descs, newopv, (vnodeopv_num - 1) * sizeof(*newopv)); 345 FREE(vnodeopv_descs, M_VNODE); 346 vnodeopv_descs = newopv; 347 vnodeopv_num--; 348 349 vfs_opv_recalc(); 350} 351 --- 126 unchanged lines hidden --- | 344 bcopy(vnodeopv_descs, newopv, (vnodeopv_num - 1) * sizeof(*newopv)); 345 FREE(vnodeopv_descs, M_VNODE); 346 vnodeopv_descs = newopv; 347 vnodeopv_num--; 348 349 vfs_opv_recalc(); 350} 351 --- 126 unchanged lines hidden --- |