예제 #1
0
파일: slab.c 프로젝트: softirq/common
static int _kmem_free_obj(struct kmem_cache_t *cachep, void *objp)
{
    if(cachep == NULL || objp == NULL)
        return -1;

    /*unsigned long address = ((unsigned long )objp & (~(DEFAULT_SLAB_PAGES * PAGE_SIZE) + 1));*/
    unsigned long address = ((unsigned long )objp & VALUE_MASK(DEFAULT_SLAB_PAGES * PAGE_SIZE));
    struct slab *slabp = (struct slab *)address;
    /*printf("slabp = %x.\n",slabp);*/

    return slab_free_obj(cachep,slabp,objp);
}
예제 #2
0
파일: slab.c 프로젝트: smushroom/libmm
static int _kmem_free_obj(kmem_cache_t *cachep, void *objp)
{
    if(cachep == NULL || objp == NULL)
    {
        return -1;
    }

    unsigned long address = ((unsigned long )objp & VALUE_MASK(DEFAULT_SLAB_PAGES * PAGE_SIZE));
    struct slab *slabp = (struct slab *)address;

    return slab_free_obj(cachep,slabp,objp);
}