Ejemplo n.º 1
0
static void split_hole(struct malloc_head *mh,
		       register struct malloc_hole *m, segext_t len)
{
    register struct malloc_hole *n;
    seg_t spare = m->extent - len;

    if (!spare)
	return;
    /*
     *      Split into one allocated one free
     */

    m->extent = len;
    n = alloc_hole(mh);
    n->page_base = m->page_base + len;
    n->extent = spare;
    n->next = m->next;
    m->next = n;
    n->flags = HOLE_FREE;
}
Ejemplo n.º 2
0
static int split_hole(struct malloc_head *mh, struct hole *m, uint16_t len)
{
	struct hole *n;
	uint16_t spare = m->extent - len;

	if (!spare)
		return 0
		    /*
		     *      Split into one allocated one free
		     */
		    n = alloc_hole();
	if (n == NULL)
		return ENOMEM;
	m->extent = len;
	n->base = m->base + len;
	n->extent = spare;
	n->next = m->next;
	m->next = n;
	n->flags = HOLE_FREE;
	return 0;
}