cache_t *pool_simple_create( unsigned int options, slab_class_t *slab_class, unsigned int inum ) { simple_cache_t *c = _bzero( sizeof( simple_cache_t ) ); _pool_init( c, slab_class, &_G_simple_cache, options, inum ); return c; }
/* allocate a block and return its block number. * returns negative value on error. */ int testfs_alloc_block(struct super_block *sb, char *block) { int phy_block_nr; phy_block_nr = testfs_get_block_freemap(sb); // if error occurred, return -ENOSPC if (phy_block_nr < 0) return phy_block_nr; _bzero(block, BLOCK_SIZE); return sb->sb.data_blocks_start + phy_block_nr; }
void * memset(void *b, int c, size_t len) { char *bb; if (c == 0) _bzero(b, len); else for (bb = (char *)b; len--; ) *bb++ = c; return (b); }
cache_t *pool_lockless_create( unsigned int options, slab_class_t *slab_class, unsigned int inum ) { /* we will play with pointers as atomic values * ptrs properties must match atomic word properties */ assert( ( alignof( AO_t ) == alignof( void* ) ) && ( sizeof( AO_t ) == sizeof( void* ) ) ); simple_cache_t *c = _bzero( sizeof( simple_cache_t ) ); _pool_init( c, slab_class, &_G_lockless_cache, options, inum ); return c; }