Browse Source

core/mem: ll_malloc initialization updated to be able to set pool type

Daniel-Constantin Mierla 11 years ago
parent
commit
91b3628fe4
2 changed files with 4 additions and 2 deletions
  1. 2 1
      mem/ll_malloc.c
  2. 2 1
      mem/ll_malloc.h

+ 2 - 1
mem/ll_malloc.c

@@ -356,7 +356,7 @@ void sfm_split_frag(struct sfm_block* qm, struct sfm_frag* frag,
 
 
 /* init malloc and return a sfm_block*/
-struct sfm_block* sfm_malloc_init(char* address, unsigned long size)
+struct sfm_block* sfm_malloc_init(char* address, unsigned long size, int type)
 {
 	char* start;
 	char* end;
@@ -392,6 +392,7 @@ struct sfm_block* sfm_malloc_init(char* address, unsigned long size)
 	qm=(struct sfm_block*)start;
 	memset(qm, 0, sizeof(struct sfm_block));
 	qm->size=size;
+	qm->type = type;
 	size-=init_overhead;
 	
 	qm->first_frag=(struct sfm_frag*)(start+ROUNDUP(sizeof(struct sfm_block)));

+ 2 - 1
mem/ll_malloc.h

@@ -131,6 +131,7 @@ struct sfm_block{
 	gen_lock_t lock;
 #endif
 	atomic_t crt_id; /* current pool */
+	int type; /* type of pool */
 	unsigned long size; /* total size */
 	/* stats are kept now per bucket */
 	struct sfm_frag* first_frag;
@@ -145,7 +146,7 @@ struct sfm_block{
 
 
 
-struct sfm_block* sfm_malloc_init(char* address, unsigned long size);
+struct sfm_block* sfm_malloc_init(char* address, unsigned long size, int type);
 void sfm_malloc_destroy(struct sfm_block* qm);
 int sfm_pool_reset();