Index: kernel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision e32e092d6f8bed442ecc81b18af9ef323bc4e650)
+++ kernel/generic/src/mm/slab.c	(revision 1a48bcd3561973c645144d2b46f10f70895be3be)
@@ -168,5 +168,5 @@
  *
  */
-static slab_t * slab_space_alloc(slab_cache_t *cache, int flags)
+static slab_t *slab_space_alloc(slab_cache_t *cache, int flags)
 {
 	void *data;
@@ -180,5 +180,5 @@
 		return NULL;
 	}
-	if (! (cache->flags & SLAB_CACHE_SLINSIDE)) {
+	if (!(cache->flags & SLAB_CACHE_SLINSIDE)) {
 		slab = slab_alloc(slab_extern_cache, flags);
 		if (!slab) {
@@ -201,5 +201,5 @@
 
 	for (i = 0; i < cache->objects; i++)
-		*((int *) (slab->start + i*cache->size)) = i+1;
+		*((int *) (slab->start + i*cache->size)) = i + 1;
 
 	atomic_inc(&cache->allocated_slabs);
@@ -240,6 +240,5 @@
  * @return Number of freed pages
  */
-static count_t slab_obj_destroy(slab_cache_t *cache, void *obj,
-				slab_t *slab)
+static count_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab)
 {
 	int freed = 0;
@@ -257,5 +256,5 @@
 
 	*((int *)obj) = slab->nextavail;
-	slab->nextavail = (obj - slab->start)/cache->size;
+	slab->nextavail = (obj - slab->start) / cache->size;
 	slab->available++;
 
@@ -282,5 +281,5 @@
  * @return Object address or null
  */
-static void * slab_obj_create(slab_cache_t *cache, int flags)
+static void *slab_obj_create(slab_cache_t *cache, int flags)
 {
 	slab_t *slab;
@@ -302,5 +301,6 @@
 		spinlock_lock(&cache->slablock);
 	} else {
-		slab = list_get_instance(cache->partial_slabs.next, slab_t, link);
+		slab = list_get_instance(cache->partial_slabs.next, slab_t,
+		    link);
 		list_remove(&slab->link);
 	}
@@ -333,6 +333,5 @@
  * @param first If true, return first, else last mag
  */
-static slab_magazine_t * get_mag_from_cache(slab_cache_t *cache,
-					    int first)
+static slab_magazine_t *get_mag_from_cache(slab_cache_t *cache, int first)
 {
 	slab_magazine_t *mag = NULL;
@@ -369,6 +368,5 @@
  * @return Number of freed pages
  */
-static count_t magazine_destroy(slab_cache_t *cache, 
-				slab_magazine_t *mag)
+static count_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag)
 {
 	unsigned int i;
@@ -390,5 +388,5 @@
  * Assume cpu_magazine lock is held
  */
-static slab_magazine_t * get_full_current_mag(slab_cache_t *cache)
+static slab_magazine_t *get_full_current_mag(slab_cache_t *cache)
 {
 	slab_magazine_t *cmag, *lastmag, *newmag;
@@ -424,5 +422,5 @@
  * @return Pointer to object or NULL if not available
  */
-static void * magazine_obj_get(slab_cache_t *cache)
+static void *magazine_obj_get(slab_cache_t *cache)
 {
 	slab_magazine_t *mag;
@@ -459,5 +457,5 @@
  *
  */
-static slab_magazine_t * make_empty_current_mag(slab_cache_t *cache)
+static slab_magazine_t *make_empty_current_mag(slab_cache_t *cache)
 {
 	slab_magazine_t *cmag,*lastmag,*newmag;
@@ -531,5 +529,6 @@
 {
 	if (cache->flags & SLAB_CACHE_SLINSIDE)
-		return ((PAGE_SIZE << cache->order) - sizeof(slab_t)) / cache->size;
+		return ((PAGE_SIZE << cache->order) - sizeof(slab_t)) /
+		    cache->size;
 	else 
 		return (PAGE_SIZE << cache->order) / cache->size;
@@ -558,8 +557,10 @@
 	ASSERT(_slab_initialized >= 2);
 
-	cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,0);
+	cache->mag_cache = malloc(sizeof(slab_mag_cache_t) * config.cpu_count,
+	    0);
 	for (i = 0; i < config.cpu_count; i++) {
 		memsetb(&cache->mag_cache[i], sizeof(cache->mag_cache[i]), 0);
-		spinlock_initialize(&cache->mag_cache[i].lock, "slab_maglock_cpu");
+		spinlock_initialize(&cache->mag_cache[i].lock,
+		    "slab_maglock_cpu");
 	}
 }
@@ -567,11 +568,7 @@
 /** Initialize allocated memory as a slab cache */
 static void
-_slab_cache_create(slab_cache_t *cache,
-		   char *name,
-		   size_t size,
-		   size_t align,
-		   int (*constructor)(void *obj, int kmflag),
-		   int (*destructor)(void *obj),
-		   int flags)
+_slab_cache_create(slab_cache_t *cache, char *name, size_t size, size_t align,
+    int (*constructor)(void *obj, int kmflag), int (*destructor)(void *obj),
+    int flags)
 {
 	int pages;
@@ -596,5 +593,5 @@
 	spinlock_initialize(&cache->slablock, "slab_lock");
 	spinlock_initialize(&cache->maglock, "slab_maglock");
-	if (! (cache->flags & SLAB_CACHE_NOMAGAZINE))
+	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
 		make_magcache(cache);
 
@@ -609,5 +606,5 @@
 		cache->order = 0;
 	else
-		cache->order = fnzb(pages-1)+1;
+		cache->order = fnzb(pages - 1) + 1;
 
 	while (badness(cache) > SLAB_MAX_BADNESS(cache)) {
@@ -630,10 +627,8 @@
 
 /** Create slab cache  */
-slab_cache_t * slab_cache_create(char *name,
-				 size_t size,
-				 size_t align,
-				 int (*constructor)(void *obj, int kmflag),
-				 int (*destructor)(void *obj),
-				 int flags)
+slab_cache_t *
+slab_cache_create(char *name, size_t size, size_t align,
+    int (*constructor)(void *obj, int kmflag), int (*destructor)(void *obj),
+    int flags)
 {
 	slab_cache_t *cache;
@@ -641,5 +636,5 @@
 	cache = slab_alloc(&slab_cache_cache, 0);
 	_slab_cache_create(cache, name, size, align, constructor, destructor,
-			   flags);
+	    flags);
 	return cache;
 }
@@ -665,5 +660,5 @@
 	 */
 	magcount = atomic_get(&cache->magazine_counter);
-	while (magcount-- && (mag=get_mag_from_cache(cache,0))) {
+	while (magcount-- && (mag=get_mag_from_cache(cache, 0))) {
 		frames += magazine_destroy(cache,mag);
 		if (!(flags & SLAB_RECLAIM_ALL) && frames)
@@ -718,6 +713,6 @@
 
 	/* All slabs must be empty */
-	if (!list_empty(&cache->full_slabs) \
-	    || !list_empty(&cache->partial_slabs))
+	if (!list_empty(&cache->full_slabs) ||
+	    !list_empty(&cache->partial_slabs))
 		panic("Destroying cache that is not empty.");
 
@@ -727,7 +722,6 @@
 }
 
-/** Allocate new object from cache - if no flags given, always returns 
-    memory */
-void * slab_alloc(slab_cache_t *cache, int flags)
+/** Allocate new object from cache - if no flags given, always returns memory */
+void *slab_alloc(slab_cache_t *cache, int flags)
 {
 	ipl_t ipl;
@@ -758,7 +752,6 @@
 	ipl = interrupts_disable();
 
-	if ((cache->flags & SLAB_CACHE_NOMAGAZINE) \
-	    || magazine_obj_put(cache, obj)) {
-
+	if ((cache->flags & SLAB_CACHE_NOMAGAZINE) ||
+	    magazine_obj_put(cache, obj)) {
 		slab_obj_destroy(cache, obj, slab);
 
@@ -787,5 +780,6 @@
 	 */
 
-	for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) {
+	for (cur = slab_cache_list.next; cur != &slab_cache_list;
+	    cur = cur->next) {
 		cache = list_get_instance(cur, slab_cache_t, link);
 		frames += _slab_reclaim(cache, flags);
@@ -807,14 +801,19 @@
 	ipl = interrupts_disable();
 	spinlock_lock(&slab_cache_lock);
-	printf("slab name        size     pages  obj/pg slabs  cached allocated ctl\n");
-	printf("---------------- -------- ------ ------ ------ ------ --------- ---\n");
-	
-	for (cur = slab_cache_list.next; cur != &slab_cache_list; cur = cur->next) {
+	printf("slab name        size     pages  obj/pg slabs  cached allocated"
+	    " ctl\n");
+	printf("---------------- -------- ------ ------ ------ ------ ---------"
+	    " ---\n");
+	
+	for (cur = slab_cache_list.next; cur != &slab_cache_list;
+	    cur = cur->next) {
 		cache = list_get_instance(cur, slab_cache_t, link);
 		
 		printf("%-16s %8" PRIs " %6d %6u %6ld %6ld %9ld %-3s\n",
-			cache->name, cache->size, (1 << cache->order), cache->objects,
-			atomic_get(&cache->allocated_slabs), atomic_get(&cache->cached_objs),
-			atomic_get(&cache->allocated_objs), cache->flags & SLAB_CACHE_SLINSIDE ? "in" : "out");
+		    cache->name, cache->size, (1 << cache->order),
+		    cache->objects, atomic_get(&cache->allocated_slabs),
+		    atomic_get(&cache->cached_objs),
+		    atomic_get(&cache->allocated_objs),
+		    cache->flags & SLAB_CACHE_SLINSIDE ? "in" : "out");
 	}
 	spinlock_unlock(&slab_cache_lock);
@@ -827,30 +826,22 @@
 
 	/* Initialize magazine cache */
-	_slab_cache_create(&mag_cache,
-			   "slab_magazine",
-			   sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void*),
-			   sizeof(uintptr_t),
-			   NULL, NULL,
-			   SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
+	_slab_cache_create(&mag_cache, "slab_magazine",
+	    sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void*),
+	    sizeof(uintptr_t), NULL, NULL, SLAB_CACHE_NOMAGAZINE |
+	    SLAB_CACHE_SLINSIDE);
 	/* Initialize slab_cache cache */
-	_slab_cache_create(&slab_cache_cache,
-			   "slab_cache",
-			   sizeof(slab_cache_cache),
-			   sizeof(uintptr_t),
-			   NULL, NULL,
-			   SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
+	_slab_cache_create(&slab_cache_cache, "slab_cache",
+	    sizeof(slab_cache_cache), sizeof(uintptr_t), NULL, NULL,
+	    SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
 	/* Initialize external slab cache */
-	slab_extern_cache = slab_cache_create("slab_extern",
-					      sizeof(slab_t),
-					      0, NULL, NULL,
-					      SLAB_CACHE_SLINSIDE | SLAB_CACHE_MAGDEFERRED);
+	slab_extern_cache = slab_cache_create("slab_extern", sizeof(slab_t), 0,
+	    NULL, NULL, SLAB_CACHE_SLINSIDE | SLAB_CACHE_MAGDEFERRED);
 
 	/* Initialize structures for malloc */
-	for (i=0, size=(1 << SLAB_MIN_MALLOC_W);
-	     i < (SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1);
-	     i++, size <<= 1) {
-		malloc_caches[i] = slab_cache_create(malloc_names[i],
-						     size, 0,
-						     NULL,NULL, SLAB_CACHE_MAGDEFERRED);
+	for (i = 0, size = (1 << SLAB_MIN_MALLOC_W);
+	    i < (SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1);
+	    i++, size <<= 1) {
+		malloc_caches[i] = slab_cache_create(malloc_names[i], size, 0,
+		    NULL, NULL, SLAB_CACHE_MAGDEFERRED);
 	}
 #ifdef CONFIG_DEBUG       
@@ -877,7 +868,9 @@
 	spinlock_lock(&slab_cache_lock);
 	
-	for (cur=slab_cache_list.next; cur != &slab_cache_list;cur=cur->next){
+	for (cur = slab_cache_list.next; cur != &slab_cache_list;
+	    cur = cur->next){
 		s = list_get_instance(cur, slab_cache_t, link);
-		if ((s->flags & SLAB_CACHE_MAGDEFERRED) != SLAB_CACHE_MAGDEFERRED)
+		if ((s->flags & SLAB_CACHE_MAGDEFERRED) !=
+		    SLAB_CACHE_MAGDEFERRED)
 			continue;
 		make_magcache(s);
@@ -890,5 +883,5 @@
 /**************************************/
 /* kalloc/kfree functions             */
-void * malloc(unsigned int size, int flags)
+void *malloc(unsigned int size, int flags)
 {
 	ASSERT(_slab_initialized);
@@ -903,5 +896,5 @@
 }
 
-void * realloc(void *ptr, unsigned int size, int flags)
+void *realloc(void *ptr, unsigned int size, int flags)
 {
 	ASSERT(_slab_initialized);
