/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <assert.h>
#include <pthread.h>
#include "sip_hash.h"
/*
* This file implements functions that add, search or remove an object
* from the hash table. The object is opaque to the hash functions. To add
* an object to the hash table, the caller provides the hash table,
* the object and the index into the hash table. To search an object,
* the caller provides the hash table, the digest (opaque), the index into
* the hash table and the function that does the actual match. Similarly,
* for removing an object, the caller provides the hash table, the digest
* (opaque), the index into the hash table and the function that does
* the acutal deletion of the object - if the deletion is successful,
* the object is taken off of the hash table.
*/
/*
* Given an object and the hash index, add it to the given hash table
*/
int
{
return (-1);
if (hash_entry->hash_count == 0) {
} else {
}
hash_entry->hash_count++;
return (0);
}
/*
* Given the hash table, the digest to be searched for, index into the hash
* table and the function to do the actual matching, return the object,
* if found.
*/
void *
boolean_t (*match_func)(void *, void *))
{
int count;
(void) pthread_mutex_unlock(
}
}
return (NULL);
}
/*
* Walk the hash table and invoke func on each object. 'arg' is passed
* to 'func'
*/
void
{
int count;
int hcount;
}
}
}
/*
* Given the hash table, the digest to be searched for, the index into the
* hash table and the delete function provided to do the actual deletion,
* remove the object from the hash table (i.e. only if the object is deleted).
*/
void
{
int count;
int found;
} else {
}
} else {
} else {
}
}
hash_entry->hash_count--;
(void) pthread_mutex_unlock(
return;
/*
* If we found the object, we are done
*/
} else if (found == 1) {
(void) pthread_mutex_unlock(
return;
}
}
}