/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <strings.h>
#include <assert.h>
#include <ipmi_impl.h>
#include <string.h>
#include <strings.h>
/*
* The (prime) number 137 happens to have the nice property that -- when
* multiplied by two and added to 33 -- one gets a pretty long series of
* primes:
*
* 307, 647, 1327, 2687, 5407, 10847, 21727, 43487
*
* And beyond 43487, the numbers in the series have few factors or are prime.
* That is, one can have a prime number and roughly double it to get another
* prime number -- but the series starts at 137. A size of 137 buckets doesn't
* particularly accommodate small hash tables, but we note that 13 also yields
* a reasonable sequence when doubling it and adding 5:
*
* 13, 31, 67, 139, 283, 571
*
* So we start with this second sequence, crossing over to the first when
* the size is greater than 137. (And when reducing the size of the hash
* table, we cross back when the size gets below 67.)
*/
static ulong_t
{
if (size < IPMI_HASHCROSSOVER) {
}
}
static ulong_t
{
if (size > IPMI_HASHCROSSUNDER) {
}
}
{
return (NULL);
return (NULL);
}
return (ihp);
}
void
{
}
}
{
ulong_t g, h = 0;
const char *p;
for (p = key; *p != '\0'; p++) {
h = (h << 4) + *p;
if ((g = (h & 0xf0000000)) != 0) {
h ^= (g >> 24);
h ^= g;
}
}
return (h);
}
int
{
}
{
}
int
{
return (*l == *r ? 0 : -1);
}
static ulong_t
{
}
static void
{
return;
/*
* This routine can't fail, so we just eat the failure here.
* The consequences of this failing are only for performance;
* correctness is not affected by our inability to resize
* the hash table.
*/
return;
}
void *elem;
/*
* For every hash element, we need to remove it from
* this bucket, and rehash it given the new bucket
* size.
*/
}
}
}
void *
{
return (elem);
}
return (NULL);
}
void *
{
return (NULL);
}
void *
{
return (NULL);
}
void
{
}
void
{
break;
}
}
{
return (ihp->ih_nelements);
}