subr_hash.c (108384) | subr_hash.c (109623) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 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 * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 | 1/* 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 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 * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 |
39 * $FreeBSD: head/sys/kern/kern_subr.c 108384 2002-12-29 07:17:06Z alc $ | 39 * $FreeBSD: head/sys/kern/kern_subr.c 109623 2003-01-21 08:56:16Z alfred $ |
40 */ 41 42#include "opt_zero.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/kernel.h> 47#include <sys/ktr.h> --- 437 unchanged lines hidden (view full) --- 485 LIST_HEAD(generic, generic) *hashtbl; 486 int i; 487 488 if (elements <= 0) 489 panic("hashinit: bad elements"); 490 for (hashsize = 1; hashsize <= elements; hashsize <<= 1) 491 continue; 492 hashsize >>= 1; | 40 */ 41 42#include "opt_zero.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/kernel.h> 47#include <sys/ktr.h> --- 437 unchanged lines hidden (view full) --- 485 LIST_HEAD(generic, generic) *hashtbl; 486 int i; 487 488 if (elements <= 0) 489 panic("hashinit: bad elements"); 490 for (hashsize = 1; hashsize <= elements; hashsize <<= 1) 491 continue; 492 hashsize >>= 1; |
493 hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); | 493 hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, 0); |
494 for (i = 0; i < hashsize; i++) 495 LIST_INIT(&hashtbl[i]); 496 *hashmask = hashsize - 1; 497 return (hashtbl); 498} 499 500void 501hashdestroy(vhashtbl, type, hashmask) --- 32 unchanged lines hidden (view full) --- 534 panic("phashinit: bad elements"); 535 for (i = 1, hashsize = primes[1]; hashsize <= elements;) { 536 i++; 537 if (i == NPRIMES) 538 break; 539 hashsize = primes[i]; 540 } 541 hashsize = primes[i - 1]; | 494 for (i = 0; i < hashsize; i++) 495 LIST_INIT(&hashtbl[i]); 496 *hashmask = hashsize - 1; 497 return (hashtbl); 498} 499 500void 501hashdestroy(vhashtbl, type, hashmask) --- 32 unchanged lines hidden (view full) --- 534 panic("phashinit: bad elements"); 535 for (i = 1, hashsize = primes[1]; hashsize <= elements;) { 536 i++; 537 if (i == NPRIMES) 538 break; 539 hashsize = primes[i]; 540 } 541 hashsize = primes[i - 1]; |
542 hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); | 542 hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, 0); |
543 for (i = 0; i < hashsize; i++) 544 LIST_INIT(&hashtbl[i]); 545 *nentries = hashsize; 546 return (hashtbl); 547} 548 549void 550uio_yield() --- 48 unchanged lines hidden --- | 543 for (i = 0; i < hashsize; i++) 544 LIST_INIT(&hashtbl[i]); 545 *nentries = hashsize; 546 return (hashtbl); 547} 548 549void 550uio_yield() --- 48 unchanged lines hidden --- |