Added rmove() (by Andreas, tweaked by me).
This commit is contained in:
parent
0077aab4f9
commit
2cc37815ae
2 changed files with 21 additions and 0 deletions
|
@ -106,6 +106,26 @@ pool_lookup(resource *P, unsigned long a)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rmove - move a resource
|
||||||
|
* @res: resource
|
||||||
|
* @p: pool to move the resource to
|
||||||
|
*
|
||||||
|
* rmove() moves a resource from one pool to another.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void rmove(void *res, pool *p)
|
||||||
|
{
|
||||||
|
resource *r = res;
|
||||||
|
|
||||||
|
if (r)
|
||||||
|
{
|
||||||
|
if (r->n.next)
|
||||||
|
rem_node(&r->n);
|
||||||
|
add_tail(&p->inside, &r->n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rfree - free a resource
|
* rfree - free a resource
|
||||||
* @res: resource
|
* @res: resource
|
||||||
|
|
|
@ -37,6 +37,7 @@ pool *rp_new(pool *, char *); /* Create new pool */
|
||||||
void rfree(void *); /* Free single resource */
|
void rfree(void *); /* Free single resource */
|
||||||
void rdump(void *); /* Dump to debug output */
|
void rdump(void *); /* Dump to debug output */
|
||||||
void rlookup(unsigned long); /* Look up address (only for debugging) */
|
void rlookup(unsigned long); /* Look up address (only for debugging) */
|
||||||
|
void rmove(void *, pool *); /* Move to a different pool */
|
||||||
|
|
||||||
void *ralloc(pool *, struct resclass *);
|
void *ralloc(pool *, struct resclass *);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue