/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1988-2000 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include "db_headers.h"
#include "db_index_entry.h"
#include "nisdb_mt.h"
/* Constructor: create an entry using given string and location info. */
{
FATAL("db_index_entry::db_index_entry: cannot allocate space",
/* what about hashval ? */
}
/*
* Constructor: create an entry using the given info.
* A copy of the item is made. New entry is added to head of list of 'n'.
*/
{
"db_index_entry::db_index_entry: cannot allocate space (2)",
next_result = NULL;
}
/*
* Join two lists (entry as identified by its 'location' occurs on both list,
* then it is included in the list returned).
* Returns pointer to resulting list; size of list
* returned in 'newsize'. List is chained using the 'nextresult' pointer.
*/
{
int count = 0;
/*
* algorithm is straightforward:
* traverse this list,
* for each item, traverse list2,
* if item on list1 matches item on list2,
* add to merged list and delete it from list2.
*/
/* find 'current' in 'other' list */
for (other = otherstart;
break;
else
}
/* delete 'other' from future consideration */
/* new head */
} else {
/* bypass 'other' */
}
/* add 'current' to list of items found so far */
if (mergedlist == NULL)
else
++count;
}
}
return (mergedlist);
}
/* Relocate bucket starting with this entry to new hashtable 'new_tab'. */
void
{
}
}
/* Return the next entry in the bucket starting with this entry
with the same hashvalue, key and location as this entry. */
{
break;
}
}
else
return (NULL);
}
/*
* Return pointer to index entry with same hash value, same key,
* and same record number as those supplied. Returns NULL if not found.
*/
{
break;
}
}
return (np);
}
/*
* Returns pointer to a list of index entries with the same hash value and
* key as those given. Returns in 'how_many' the number of entries in the
* list returned. The list is linked by the 'next_result' field of the
* index entries. These may be changed after the next call to 'lookup'
* or 'join'.
*/
{
long count = 0;
++count;
break;
}
}
/*
* gather all the ones with the same key; assume that all entries
* with same key are located contiguously.
*/
++count;
}
else
break;
}
}
return (fst);
}
/*
* Remove entry with the specified hashvalue, key, and record number.
* Returns 'TRUE' if successful, FALSE otherwise.
* If the entry being removed is at the head of the list, then
* the head is updated to reflect the removal. The storage for the index
* entry is freed. The record pointed to by 'recnum' must be removed
* through another means. All that is updated in this operation is the
* index.
*/
{
/* Search for it in the bucket */
break;
} else {
}
}
} else {
}
delete np;
return (TRUE);
}
/* Replace the 'location' field of the index entry with the given one. */
/*
void
db_index_entry::replace(entryp ep)
{
location = ep;
}
*/
/*
* Create and add an entry with the given hashvalue, key value, and record
* location, to the bucket pointed to by 'hashvalue'.
* If an entry with the same hashvalue and key value is found,
* the entry is added after the first entry with this property. Otherwise,
* the entry is added to the head of the bucket. This way, entries
* with the same hashvalue and key are not scattered throughout the bucket
* but they occur together. Copy is made of given key.
*/
{
/* Search for it in the bucket */
break;
} else {
}
}
"db_index_entry::add: cannot allocate space for head",
}
} else {
"db_index_entry::add: cannot allocate space for entry",
}
}
return (TRUE);
}
/* Print this entry to stdout. */
void
{
printf("\t");
}
}
/* Print bucket starting with this entry. */
void
{
}
}
/* Print result list starting with this entry. */
void
{
}
}