Browse code

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

Daniel-Constantin Mierla authored on 03/05/2014 18:04:34
Showing 2 changed files
... ...
@@ -340,7 +340,7 @@ void sfm_split_frag(struct sfm_block* qm, struct sfm_frag* frag,
340 340
 
341 341
 
342 342
 /* init malloc and return a sfm_block*/
343
-struct sfm_block* sfm_malloc_init(char* address, unsigned long size)
343
+struct sfm_block* sfm_malloc_init(char* address, unsigned long size, int type)
344 344
 {
345 345
 	char* start;
346 346
 	char* end;
... ...
@@ -376,6 +376,7 @@ struct sfm_block* sfm_malloc_init(char* address, unsigned long size)
376 376
 	qm=(struct sfm_block*)start;
377 377
 	memset(qm, 0, sizeof(struct sfm_block));
378 378
 	qm->size=size;
379
+	qm->type = type;
379 380
 	size-=init_overhead;
380 381
 	
381 382
 	qm->first_frag=(struct sfm_frag*)(start+ROUNDUP(sizeof(struct sfm_block)));
... ...
@@ -130,6 +130,7 @@ struct sfm_block{
130 130
 	gen_lock_t lock;
131 131
 #endif
132 132
 	atomic_t crt_id; /* current pool */
133
+	int type;
133 134
 	unsigned long size; /* total size */
134 135
 	/* stats are kept now per bucket */
135 136
 	struct sfm_frag* first_frag;
... ...
@@ -144,7 +145,7 @@ struct sfm_block{
144 144
 
145 145
 
146 146
 
147
-struct sfm_block* sfm_malloc_init(char* address, unsigned long size);
147
+struct sfm_block* sfm_malloc_init(char* address, unsigned long size, int type);
148 148
 void sfm_malloc_destroy(struct sfm_block* qm);
149 149
 int sfm_pool_reset();
150 150