int test_calculation_functions() { int ret = 1; if (test_calc_unit(16, 16, 16) != -E_SUCCESS) goto err; ret ++; if (test_calc_unit(32, 16, 16) != -E_SUCCESS) goto err; ret++; if (test_calc_unit(16, 32, 16) != -E_SUCCESS) goto err; ret ++; if (test_calc_unit(0x1000, 0x1000, 16) != -E_SUCCESS) goto err; ret ++; if (test_calc_unit(0x400, 0x1000, 16) != -E_SUCCESS) goto err; ret ++; if (mm_cache_init("Blaat", sizeof(struct mm_cache), 255, NULL, NULL) == NULL) goto err; ret ++; return -E_SUCCESS; err: debug("The test failed on item: %X\n", ret); return ret; }
static void* pipe_get_new_block(struct pipe* pipe) { #ifdef SLAB if (pipe_cache == NULL) pipe_cache = mm_cache_init("pipe blocks", BLOCK_SIZE, BLOCK_SIZE,NULL, NULL); if (pipe_cache == NULL) return NULL; #endif if (pipe == NULL) return NULL; #ifdef SLAB if (pipe->block_size == BLOCK_SIZE) return mm_cache_alloc(pipe_cache, 0); else return kmalloc(pipe->block_size); #else return kmalloc(pipe->block_size); #endif }