Index: base.c =================================================================== RCS file: /cvsroot/translucency/translucency/base.c,v retrieving revision 1.32 diff -u -r1.32 base.c --- base.c 24 May 2004 13:03:34 -0000 1.32 +++ base.c 24 May 2004 13:04:03 -0000 @@ -36,6 +36,8 @@ struct dirent64 data; }; +kmem_cache_t *hash_data_cachep; + static inline int match_uids(void) { struct task_struct *p = current; @@ -308,7 +310,9 @@ } if(!b_Found && !b_Whiteout){ // p_Cur=malloc(sizeof(struct list_head)+i_Len+4); // save some space - p_Cur=malloc(sizeof(struct hash_data_t)); + p_Cur=kmem_cache_alloc(hash_data_cachep, GFP_KERNEL); + if(!p_Cur) + printk("TODO: handle error allocating memory\n"); INIT_LIST_HEAD(&(p_Cur->list)); memcpy(&(p_Cur->data), cur, i_Len); list_add_tail(&(p_Cur->list), &(p_CurList->list)); @@ -348,7 +352,7 @@ sys_write(outfd, cur, i_Len); END_KMEM list_del(ListHead); - free(p_Cur); + kmem_cache_free(hash_data_cachep, p_Cur); } } sys_lseek(outfd, 0, 0/*SEEK_SET*/); @@ -728,6 +732,11 @@ int i; char *buffer_allocated=redirection_dir_table_name_buffer; memset(&redirs, 0, sizeof(redirs)); + hash_data_cachep=kmem_cache_create("trans_hash_data", sizeof(struct hash_data_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); + if(!hash_data_cachep) { + printk("no mem for cache\n"); + return -ENOMEM; + } for (i=0; i