Index: uspace/lib/libc/generic/futex.c
===================================================================
--- uspace/lib/libc/generic/futex.c	(revision b3c38750a1d4b8fe19c67acaa51288310cd9ba5d)
+++ uspace/lib/libc/generic/futex.c	(revision 4db6eaf06a371efbb5d1f20919cbf3e224a20036)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2006 Jakub Jermar
+ * Copyright (c) 2008 Jakub Jermar
  * All rights reserved.
  *
@@ -42,6 +42,6 @@
 /*
  * Note about race conditions.
- * Because of non-atomic nature of operations performed sequentially on the futex
- * counter and the futex wait queue, there is a race condition:
+ * Because of non-atomic nature of operations performed sequentially on the
+ * futex counter and the futex wait queue, there is a race condition:
  *
  * (wq->missed_wakeups == 1) && (futex->count = 1)
@@ -55,69 +55,81 @@
  * 5. B has to call SYS_FUTEX_WAKEUP syscall to wake up the sleeping thread
  * 6. B finds the wait queue empty and changes wq->missed_wakeups from 0 to 1
- * 7. A fixes futex->count (i.e. the number of waiting threads) by changing it from 0 to 1
+ * 7. A fixes futex->count (i.e. the number of waiting threads) by changing it
+ *    from 0 to 1
  *
  * Scenario 2 (conditional down operation vs. futex_up)
  * 1. assume wq->missed_wakeups == 0 && futex->count == 0
  *    (i.e. thread A is in the critical section)
- * 2. thread B performs futex_trydown() operation and changes futex->count from 0 to -1
+ * 2. thread B performs futex_trydown() operation and changes futex->count from
+ *    0 to -1
  *    B is now obliged to call SYS_FUTEX_SLEEP syscall
  * 3. A wants to leave the critical section and does futex_up()
- * 4. A thus changes futex->count from -1 to 0 and must call SYS_FUTEX_WAKEUP syscall
+ * 4. A thus changes futex->count from -1 to 0 and must call SYS_FUTEX_WAKEUP
+ *    syscall
  * 5. B finds the wait queue empty and immediatelly aborts the conditional sleep
- * 6. No thread is queueing in the wait queue so wq->missed_wakeups changes from 0 to 1
- * 6. B fixes futex->count (i.e. the number of waiting threads) by changing it from 0 to 1
+ * 6. No thread is queueing in the wait queue so wq->missed_wakeups changes from
+ *    0 to 1
+ * 6. B fixes futex->count (i.e. the number of waiting threads) by changing it
+ *    from 0 to 1
  *
- * Both scenarios allow two threads to be in the critical section simultaneously.
- * One without kernel intervention and the other through wq->missed_wakeups being 1.
+ * Both scenarios allow two threads to be in the critical section
+ * simultaneously. One without kernel intervention and the other through
+ * wq->missed_wakeups being 1.
  *
- * To mitigate this problem, futex_down_timeout() detects that the syscall didn't sleep
- * in the wait queue, fixes the futex counter and RETRIES the whole operation again.
- *
+ * To mitigate this problem, futex_down_timeout() detects that the syscall
+ * didn't sleep in the wait queue, fixes the futex counter and RETRIES the
+ * whole operation again.
  */
 
 /** Initialize futex counter.
  *
- * @param futex Futex.
- * @param val Initialization value.
+ * @param futex		Futex.
+ * @param val		Initialization value.
  */
-void futex_initialize(atomic_t *futex, int val)
+void futex_initialize(futex_t *futex, int val)
 {
 	atomic_set(futex, val);
 }
 
-int futex_down(atomic_t *futex)
+int futex_down(futex_t *futex)
 {
 	return futex_down_timeout(futex, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
 }
 
-int futex_trydown(atomic_t *futex)
+int futex_trydown(futex_t *futex)
 {
-	return futex_down_timeout(futex, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING);
+	return futex_down_timeout(futex, SYNCH_NO_TIMEOUT,
+	    SYNCH_FLAGS_NON_BLOCKING);
 }
 
 /** Try to down the futex.
  *
- * @param futex Futex.
- * @param usec Microseconds to wait. Zero value means sleep without timeout.
- * @param flags Select mode of operation. See comment for waitq_sleep_timeout(). 
+ * @param futex		Futex.
+ * @param usec		Microseconds to wait. Zero value means sleep without
+ * 			timeout.
+ * @param flags		Select mode of operation. See comment for
+ * 			waitq_sleep_timeout(). 
  *
- * @return ENOENT if there is no such virtual address. One of ESYNCH_OK_ATOMIC
- *	   and ESYNCH_OK_BLOCKED on success or ESYNCH_TIMEOUT if the lock was
- *	   not acquired because of a timeout or ESYNCH_WOULD_BLOCK if the
- *	   operation could not be carried out atomically (if requested so).
+ * @return		ENOENT if there is no such virtual address. One of
+ * 			ESYNCH_OK_ATOMIC and ESYNCH_OK_BLOCKED on success or
+ * 			ESYNCH_TIMEOUT if the lock was not acquired because of
+ * 			a timeout or ESYNCH_WOULD_BLOCK if the operation could
+ * 			not be carried out atomically (if requested so).
  */
-int futex_down_timeout(atomic_t *futex, uint32_t usec, int flags)
+int futex_down_timeout(futex_t *futex, uint32_t usec, int flags)
 {
 	int rc;
 	
 	while (atomic_predec(futex) < 0) {
-		rc = __SYSCALL3(SYS_FUTEX_SLEEP, (sysarg_t) &futex->count, (sysarg_t) usec, (sysarg_t) flags);
+		rc = __SYSCALL3(SYS_FUTEX_SLEEP, (sysarg_t) &futex->count,
+		    (sysarg_t) usec, (sysarg_t) flags);
 		
 		switch (rc) {
 		case ESYNCH_OK_ATOMIC:
 			/*
-			 * Because of a race condition between timeout and futex_up()
-			 * and between conditional futex_down_timeout() and futex_up(),
-			 * we have to give up and try again in this special case.
+			 * Because of a race condition between timeout and
+			 * futex_up() and between conditional
+			 * futex_down_timeout() and futex_up(), we have to give
+			 * up and try again in this special case.
 			 */
 			atomic_inc(futex);
@@ -131,7 +143,8 @@
 		case ESYNCH_WOULD_BLOCK:
 			/*
-			 * The conditional down operation should be implemented this way.
-			 * The userspace-only variant tends to accumulate missed wakeups
-			 * in the kernel futex wait queue.
+			 * The conditional down operation should be implemented
+			 * this way. The userspace-only variant tends to
+			 * accumulate missed wakeups in the kernel futex wait
+			 * queue.
 			 */
 			atomic_inc(futex);
@@ -142,5 +155,6 @@
 			/*
 			 * Enter the critical section.
-			 * The futex counter has already been incremented for us.
+			 * The futex counter has already been incremented for
+			 * us.
 			 */
 			return ESYNCH_OK_BLOCKED;
@@ -159,9 +173,10 @@
 /** Up the futex.
  *
- * @param futex Futex.
+ * @param futex		Futex.
  *
- * @return ENOENT if there is no such virtual address. Otherwise zero.
+ * @return		ENOENT if there is no such virtual address. Otherwise
+ * 			zero.
  */
-int futex_up(atomic_t *futex)
+int futex_up(futex_t *futex)
 {
 	long val;
Index: uspace/lib/libc/include/futex.h
===================================================================
--- uspace/lib/libc/include/futex.h	(revision b3c38750a1d4b8fe19c67acaa51288310cd9ba5d)
+++ uspace/lib/libc/include/futex.h	(revision 4db6eaf06a371efbb5d1f20919cbf3e224a20036)
@@ -41,9 +41,11 @@
 #define FUTEX_INITIALIZER     {1}
 
-extern void futex_initialize(atomic_t *futex, int value);
-extern int futex_down(atomic_t *futex);
-extern int futex_trydown(atomic_t *futex);
-extern int futex_down_timeout(atomic_t *futex, uint32_t usec, int flags);
-extern int futex_up(atomic_t *futex);
+typedef atomic_t futex_t;
+
+extern void futex_initialize(futex_t *futex, int value);
+extern int futex_down(futex_t *futex);
+extern int futex_trydown(futex_t *futex);
+extern int futex_down_timeout(futex_t *futex, uint32_t usec, int flags);
+extern int futex_up(futex_t *futex);
 
 #endif
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision b3c38750a1d4b8fe19c67acaa51288310cd9ba5d)
+++ uspace/srv/vfs/vfs.h	(revision 4db6eaf06a371efbb5d1f20919cbf3e224a20036)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2007 Jakub Jermar
+ * Copyright (c) 2008 Jakub Jermar
  * All rights reserved.
  *
@@ -137,6 +137,8 @@
 	link_t nh_link;		/**< Node hash-table link. */
 
-	/** Holding this rwlock prevents modifications of the node's contents. */
-	atomic_t contents_rwlock;
+	/**
+	 * Holding this rwlock prevents modifications of the node's contents.
+	 */
+	rwlock_t contents_rwlock;
 } vfs_node_t;
 
