Index: uspace/lib/c/generic/fibril.c
===================================================================
--- uspace/lib/c/generic/fibril.c	(revision e35bf8820b0d5e24485f5a7a683e85d8f977fe7f)
+++ uspace/lib/c/generic/fibril.c	(revision 596d65c7081cad406248bd943a1ac1300f23e806)
@@ -48,10 +48,11 @@
 
 #ifndef FIBRIL_INITIAL_STACK_PAGES_NO
-#define FIBRIL_INITIAL_STACK_PAGES_NO	1
+	#define FIBRIL_INITIAL_STACK_PAGES_NO  1
 #endif
 
 /**
- * This futex serializes access to ready_list, serialized_list and manager_list.
- */ 
+ * This futex serializes access to ready_list,
+ * serialized_list and manager_list.
+ */
 static atomic_t fibril_futex = FUTEX_INITIALIZER;
 
@@ -60,47 +61,15 @@
 static LIST_INITIALIZE(manager_list);
 
-static void fibril_main(void);
-
 /** Number of threads that are executing a manager fibril. */
 static int threads_in_manager;
-/** Number of threads that are executing a manager fibril and are serialized. */
-static int serialized_threads;	/* Protected by async_futex */
+
+/**
+ * Number of threads that are executing a manager fibril
+ * and are serialized. Protected by async_futex.
+ */
+static int serialized_threads;
+
 /** Fibril-local count of serialization. If > 0, we must not preempt */
 static fibril_local int serialization_count;
-
-/** Setup fibril information into TCB structure */
-fibril_t *fibril_setup(void)
-{
-	fibril_t *f;
-	tcb_t *tcb;
-
-	tcb = __make_tls();
-	if (!tcb)
-		return NULL;
-
-	f = malloc(sizeof(fibril_t));
-	if (!f) {
-		__free_tls(tcb);
-		return NULL;
-	}
-
-	tcb->fibril_data = f;
-	f->tcb = tcb;
-
-	f->func = NULL;
-	f->arg = NULL;
-	f->stack = NULL;
-	f->clean_after_me = NULL;
-	f->retval = 0;
-	f->flags = 0;
-
-	return f;
-}
-
-void fibril_teardown(fibril_t *f)
-{
-	__free_tls(f->tcb);
-	free(f);
-}
 
 /** Function that spans the whole life-cycle of a fibril.
@@ -109,14 +78,49 @@
  * the fibril logic is called.  After its return, the return value is saved.
  * The fibril then switches to another fibril, which cleans up after it.
- */
-void fibril_main(void)
-{
-	fibril_t *f = __tcb_get()->fibril_data;
-
+ *
+ */
+static void fibril_main(void)
+{
+	fibril_t *fibril = __tcb_get()->fibril_data;
+	
 	/* Call the implementing function. */
-	f->retval = f->func(f->arg);
-
+	fibril->retval = fibril->func(fibril->arg);
+	
 	fibril_switch(FIBRIL_FROM_DEAD);
-	/* not reached */
+	/* Not reached */
+}
+
+/** Setup fibril information into TCB structure
+ *
+ */
+fibril_t *fibril_setup(void)
+{
+	tcb_t *tcb = __make_tls();
+	if (!tcb)
+		return NULL;
+	
+	fibril_t *fibril = malloc(sizeof(fibril_t));
+	if (!fibril) {
+		__free_tls(tcb);
+		return NULL;
+	}
+	
+	tcb->fibril_data = fibril;
+	fibril->tcb = tcb;
+	
+	fibril->func = NULL;
+	fibril->arg = NULL;
+	fibril->stack = NULL;
+	fibril->clean_after_me = NULL;
+	fibril->retval = 0;
+	fibril->flags = 0;
+	
+	return fibril;
+}
+
+void fibril_teardown(fibril_t *fibril)
+{
+	__free_tls(fibril->tcb);
+	free(fibril);
 }
 
@@ -126,9 +130,11 @@
  * held.
  *
- * @param stype		Switch type. One of FIBRIL_PREEMPT, FIBRIL_TO_MANAGER,
- * 			FIBRIL_FROM_MANAGER, FIBRIL_FROM_DEAD. The parameter
- * 			describes the circumstances of the switch.
- * @return		Return 0 if there is no ready fibril,
- * 			return 1 otherwise.
+ * @param stype Switch type. One of FIBRIL_PREEMPT, FIBRIL_TO_MANAGER,
+ *              FIBRIL_FROM_MANAGER, FIBRIL_FROM_DEAD. The parameter
+ *              describes the circumstances of the switch.
+ *
+ * @return 0 if there is no ready fibril,
+ * @return 1 otherwise.
+ *
  */
 int fibril_switch(fibril_switch_type_t stype)
@@ -246,48 +252,52 @@
 /** Create a new fibril.
  *
- * @param func		Implementing function of the new fibril.
- * @param arg		Argument to pass to func.
- *
- * @return		Return 0 on failure or TLS of the new fibril.
+ * @param func Implementing function of the new fibril.
+ * @param arg Argument to pass to func.
+ *
+ * @return 0 on failure or TLS of the new fibril.
+ *
  */
 fid_t fibril_create(int (*func)(void *), void *arg)
 {
-	fibril_t *f;
-
-	f = fibril_setup();
-	if (!f) 
+	fibril_t *fibril;
+	
+	fibril = fibril_setup();
+	if (fibril == NULL)
 		return 0;
-	f->stack = (char *) malloc(FIBRIL_INITIAL_STACK_PAGES_NO *
-	    getpagesize());
-	if (!f->stack) {
-		fibril_teardown(f);
+	
+	fibril->stack =
+	    (char *) malloc(FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize());
+	if (!fibril->stack) {
+		fibril_teardown(fibril);
 		return 0;
 	}
 	
-	f->func = func;
-	f->arg = arg;
-
-	context_save(&f->ctx);
-	context_set(&f->ctx, FADDR(fibril_main), f->stack,
-	    FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), f->tcb);
-
-	return (fid_t) f;
+	fibril->func = func;
+	fibril->arg = arg;
+	
+	context_save(&fibril->ctx);
+	context_set(&fibril->ctx, FADDR(fibril_main), fibril->stack,
+	    FIBRIL_INITIAL_STACK_PAGES_NO * getpagesize(), fibril->tcb);
+
+	return (fid_t) fibril;
 }
 
 /** Add a fibril to the ready list.
  *
- * @param fid		Pointer to the fibril structure of the fibril to be
- *			added.
+ * @param fid Pointer to the fibril structure of the fibril to be
+ *            added.
+ *
  */
 void fibril_add_ready(fid_t fid)
 {
-	fibril_t *f;
-
-	f = (fibril_t *) fid;
+	fibril_t *fibril = (fibril_t *) fid;
+	
 	futex_down(&fibril_futex);
-	if ((f->flags & FIBRIL_SERIALIZED))
-		list_append(&f->link, &serialized_list);
+	
+	if ((fibril->flags & FIBRIL_SERIALIZED))
+		list_append(&fibril->link, &serialized_list);
 	else
-		list_append(&f->link, &ready_list);
+		list_append(&fibril->link, &ready_list);
+	
 	futex_up(&fibril_futex);
 }
@@ -295,15 +305,14 @@
 /** Add a fibril to the manager list.
  *
- * @param fid		Pointer to the fibril structure of the fibril to be
- *			added.
+ * @param fid Pointer to the fibril structure of the fibril to be
+ *            added.
+ *
  */
 void fibril_add_manager(fid_t fid)
 {
-	fibril_t *f;
-
-	f = (fibril_t *) fid;
-
+	fibril_t *fibril = (fibril_t *) fid;
+	
 	futex_down(&fibril_futex);
-	list_append(&f->link, &manager_list);
+	list_append(&fibril->link, &manager_list);
 	futex_up(&fibril_futex);
 }
@@ -313,9 +322,8 @@
 {
 	futex_down(&fibril_futex);
-	if (list_empty(&manager_list)) {
-		futex_up(&fibril_futex);
-		return;
-	}
-	list_remove(manager_list.next);
+	
+	if (!list_empty(&manager_list))
+		list_remove(manager_list.next);
+	
 	futex_up(&fibril_futex);
 }
Index: uspace/lib/c/generic/futex.c
===================================================================
--- uspace/lib/c/generic/futex.c	(revision e35bf8820b0d5e24485f5a7a683e85d8f977fe7f)
+++ uspace/lib/c/generic/futex.c	(revision 596d65c7081cad406248bd943a1ac1300f23e806)
@@ -31,5 +31,5 @@
  */
 /** @file
- */ 
+ */
 
 #include <futex.h>
@@ -40,6 +40,7 @@
 /** Initialize futex counter.
  *
- * @param futex		Futex.
- * @param val		Initialization value.
+ * @param futex Futex.
+ * @param val   Initialization value.
+ *
  */
 void futex_initialize(futex_t *futex, int val)
@@ -50,7 +51,9 @@
 /** Try to down the futex.
  *
- * @param futex		Futex.
- * @return		Non-zero if the futex was acquired.
- * @return		Zero if the futex was not acquired.
+ * @param futex Futex.
+ *
+ * @return Non-zero if the futex was acquired.
+ * @return Zero if the futex was not acquired.
+ *
  */
 int futex_trydown(futex_t *futex)
@@ -61,8 +64,10 @@
 /** Down the futex.
  *
- * @param futex		Futex.
- * @return		ENOENT if there is no such virtual address.
- * @return		Zero in the uncontended case. 
- * @return		Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED.
+ * @param futex Futex.
+ *
+ * @return ENOENT if there is no such virtual address.
+ * @return Zero in the uncontended case.
+ * @return Otherwise one of ESYNCH_OK_ATOMIC or ESYNCH_OK_BLOCKED.
+ *
  */
 int futex_down(futex_t *futex)
@@ -70,5 +75,5 @@
 	if ((atomic_signed_t) atomic_predec(futex) < 0)
 		return __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &futex->count);
-
+	
 	return 0;
 }
@@ -76,7 +81,9 @@
 /** Up the futex.
  *
- * @param futex		Futex.
- * @return		ENOENT if there is no such virtual address.
- * @return		Zero in the uncontended case.
+ * @param futex Futex.
+ *
+ * @return ENOENT if there is no such virtual address.
+ * @return Zero in the uncontended case.
+ *
  */
 int futex_up(futex_t *futex)
@@ -84,5 +91,5 @@
 	if ((atomic_signed_t) atomic_postinc(futex) < 0)
 		return __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &futex->count);
-		
+	
 	return 0;
 }
Index: uspace/lib/c/include/futex.h
===================================================================
--- uspace/lib/c/include/futex.h	(revision e35bf8820b0d5e24485f5a7a683e85d8f977fe7f)
+++ uspace/lib/c/include/futex.h	(revision 596d65c7081cad406248bd943a1ac1300f23e806)
@@ -39,5 +39,5 @@
 #include <sys/types.h>
 
-#define FUTEX_INITIALIZER     {1}
+#define FUTEX_INITIALIZER  {1}
 
 typedef atomic_t futex_t;
