/*
* 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
*/
/*
*/
/*
* Common implementation for priority queues. Currently we have only a single
* priority queue per handle, so this may be a little overboard, but this
* isolates the implementation and allows us to easily expand in the future.
*/
#include <shadow_impl.h>
int
{
uint_t i, j;
void **items;
return (-1);
}
pqp->shpq_items[i] = p;
/*
* Bubble the node up until heap criteria are met.
*/
for (; i != 1; i = j) {
j = i / 2;
break;
/* Swap parent and child. */
p = pqp->shpq_items[i];
pqp->shpq_items[j] = p;
}
return (0);
}
static void
{
uint_t c;
void *p;
return;
break;
c = i * 2;
} else {
/* Choose the child with lower priority. */
c = i * 2;
} else {
c = i * 2 + 1;
}
}
break;
/* Swap parent and (smaller) child. */
p = pqp->shpq_items[i];
pqp->shpq_items[c] = p;
}
/*
* Try to shrink the table if it's more than four times the required
* size. If we can't allocate memory, just press on.
*/
void **items;
size /= 2;
}
}
}
}
void *
{
void *p;
return (NULL);
return (p);
}
void *
{
return (NULL);
}
/*
* Remove an element from the heap. This is a O(n) operation so should not be
* used for common operations. This could be improved (to O(log n)) by having
* each node keep track of its index.
*/
int
{
uint_t i;
if (pqp->shpq_items[i] == p) {
return (0);
}
}
return (-1);
}
int
void *), void *data)
{
uint_t i;
int ret;
return (ret);
}
return (0);
}
int
{
}
void
{
}