Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision d9c8c81f21850cb9e08890ce3919e1d8e253e810)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 4e1b57de0f1631729b8907befb57c677fd2d06d4)
@@ -52,5 +52,5 @@
 #include <adt/list.h>
 #include <assert.h>
-#include <futex.h>
+#include <fibril_sync.h>
 #include <sys/mman.h>
 #include <align.h>
@@ -59,6 +59,6 @@
 #define FS_NODE(node)	((node) ? (node)->bp : NULL)
 
-/** Futex protecting the list of cached free FAT nodes. */
-static futex_t ffn_futex = FUTEX_INITIALIZER;
+/** Mutex protecting the list of cached free FAT nodes. */
+static FIBRIL_MUTEX_INITIALIZE(ffn_mutex);
 
 /** List of cached free FAT nodes. */
@@ -67,5 +67,5 @@
 static void fat_node_initialize(fat_node_t *node)
 {
-	futex_initialize(&node->lock, 1);
+	fibril_mutex_initialize(&node->lock);
 	node->bp = NULL;
 	node->idx = NULL;
@@ -116,28 +116,28 @@
 	fat_node_t *nodep;
 
-	futex_down(&ffn_futex);
+	fibril_mutex_lock(&ffn_mutex);
 	if (!list_empty(&ffn_head)) {
 		/* Try to use a cached free node structure. */
 		fat_idx_t *idxp_tmp;
 		nodep = list_get_instance(ffn_head.next, fat_node_t, ffn_link);
-		if (futex_trydown(&nodep->lock) == ESYNCH_WOULD_BLOCK)
+		if (!fibril_mutex_trylock(&nodep->lock))
 			goto skip_cache;
 		idxp_tmp = nodep->idx;
-		if (futex_trydown(&idxp_tmp->lock) == ESYNCH_WOULD_BLOCK) {
-			futex_up(&nodep->lock);
+		if (!fibril_mutex_trylock(&idxp_tmp->lock)) {
+			fibril_mutex_unlock(&nodep->lock);
 			goto skip_cache;
 		}
 		list_remove(&nodep->ffn_link);
-		futex_up(&ffn_futex);
+		fibril_mutex_unlock(&ffn_mutex);
 		if (nodep->dirty)
 			fat_node_sync(nodep);
 		idxp_tmp->nodep = NULL;
-		futex_up(&nodep->lock);
-		futex_up(&idxp_tmp->lock);
+		fibril_mutex_unlock(&nodep->lock);
+		fibril_mutex_unlock(&idxp_tmp->lock);
 		fn = FS_NODE(nodep);
 	} else {
 skip_cache:
 		/* Try to allocate a new node structure. */
-		futex_up(&ffn_futex);
+		fibril_mutex_unlock(&ffn_mutex);
 		fn = (fs_node_t *)malloc(sizeof(fs_node_t));
 		if (!fn)
@@ -176,8 +176,8 @@
 		 * The node is already instantiated in memory.
 		 */
-		futex_down(&idxp->nodep->lock);
+		fibril_mutex_lock(&idxp->nodep->lock);
 		if (!idxp->nodep->refcnt++)
 			list_remove(&idxp->nodep->ffn_link);
-		futex_up(&idxp->nodep->lock);
+		fibril_mutex_unlock(&idxp->nodep->lock);
 		return idxp->nodep;
 	}
@@ -269,5 +269,5 @@
 	/* idxp->lock held */
 	nodep = fat_node_get_core(idxp);
-	futex_up(&idxp->lock);
+	fibril_mutex_unlock(&idxp->lock);
 	return FS_NODE(nodep);
 }
@@ -278,10 +278,10 @@
 	bool destroy = false;
 
-	futex_down(&nodep->lock);
+	fibril_mutex_lock(&nodep->lock);
 	if (!--nodep->refcnt) {
 		if (nodep->idx) {
-			futex_down(&ffn_futex);
+			fibril_mutex_lock(&ffn_mutex);
 			list_append(&nodep->ffn_link, &ffn_head);
-			futex_up(&ffn_futex);
+			fibril_mutex_unlock(&ffn_mutex);
 		} else {
 			/*
@@ -294,5 +294,5 @@
 		}
 	}
-	futex_up(&nodep->lock);
+	fibril_mutex_unlock(&nodep->lock);
 	if (destroy) {
 		free(nodep->bp);
@@ -361,5 +361,5 @@
 	idxp->nodep = nodep;
 
-	futex_up(&idxp->lock);
+	fibril_mutex_unlock(&idxp->lock);
 	return FS_NODE(nodep);
 }
@@ -410,14 +410,14 @@
 	int rc;
 
-	futex_down(&childp->lock);
+	fibril_mutex_lock(&childp->lock);
 	if (childp->lnkcnt == 1) {
 		/*
 		 * On FAT, we don't support multiple hard links.
 		 */
-		futex_up(&childp->lock);
+		fibril_mutex_unlock(&childp->lock);
 		return EMLINK;
 	}
 	assert(childp->lnkcnt == 0);
-	futex_up(&childp->lock);
+	fibril_mutex_unlock(&childp->lock);
 
 	if (!fat_dentry_name_verify(name)) {
@@ -433,5 +433,5 @@
 	 */
 	
-	futex_down(&parentp->idx->lock);
+	fibril_mutex_lock(&parentp->idx->lock);
 	bs = block_bb_get(parentp->idx->dev_handle);
 	bps = uint16_t_le2host(bs->bps);
@@ -464,10 +464,10 @@
 	if (parentp->idx->pfc == FAT_CLST_ROOT) {
 		/* Can't grow the root directory. */
-		futex_up(&parentp->idx->lock);
+		fibril_mutex_unlock(&parentp->idx->lock);
 		return ENOSPC;
 	}
 	rc = fat_alloc_clusters(bs, parentp->idx->dev_handle, 1, &mcl, &lcl);
 	if (rc != EOK) {
-		futex_up(&parentp->idx->lock);
+		fibril_mutex_unlock(&parentp->idx->lock);
 		return rc;
 	}
@@ -492,7 +492,7 @@
 	b->dirty = true;		/* need to sync block */
 	block_put(b);
-	futex_up(&parentp->idx->lock);
-
-	futex_down(&childp->idx->lock);
+	fibril_mutex_unlock(&parentp->idx->lock);
+
+	fibril_mutex_lock(&childp->idx->lock);
 	
 	/*
@@ -530,10 +530,10 @@
 	childp->idx->pfc = parentp->firstc;
 	childp->idx->pdi = i * dps + j;
-	futex_up(&childp->idx->lock);
-
-	futex_down(&childp->lock);
+	fibril_mutex_unlock(&childp->idx->lock);
+
+	fibril_mutex_lock(&childp->lock);
 	childp->lnkcnt = 1;
 	childp->dirty = true;		/* need to sync node */
-	futex_up(&childp->lock);
+	fibril_mutex_unlock(&childp->lock);
 
 	/*
@@ -560,8 +560,8 @@
 		return ENOTEMPTY;
 
-	futex_down(&parentp->lock);
-	futex_down(&childp->lock);
+	fibril_mutex_lock(&parentp->lock);
+	fibril_mutex_lock(&childp->lock);
 	assert(childp->lnkcnt == 1);
-	futex_down(&childp->idx->lock);
+	fibril_mutex_lock(&childp->idx->lock);
 	bs = block_bb_get(childp->idx->dev_handle);
 	bps = uint16_t_le2host(bs->bps);
@@ -582,9 +582,9 @@
 	childp->idx->pfc = FAT_CLST_RES0;
 	childp->idx->pdi = 0;
-	futex_up(&childp->idx->lock);
+	fibril_mutex_unlock(&childp->idx->lock);
 	childp->lnkcnt = 0;
 	childp->dirty = true;
-	futex_up(&childp->lock);
-	futex_up(&parentp->lock);
+	fibril_mutex_unlock(&childp->lock);
+	fibril_mutex_unlock(&parentp->lock);
 
 	return EOK;
@@ -603,5 +603,5 @@
 	block_t *b;
 
-	futex_down(&parentp->idx->lock);
+	fibril_mutex_lock(&parentp->idx->lock);
 	bs = block_bb_get(parentp->idx->dev_handle);
 	bps = uint16_t_le2host(bs->bps);
@@ -618,5 +618,5 @@
 			case FAT_DENTRY_LAST:
 				block_put(b);
-				futex_up(&parentp->idx->lock);
+				fibril_mutex_unlock(&parentp->idx->lock);
 				return NULL;
 			default:
@@ -637,5 +637,5 @@
 				    parentp->idx->dev_handle, parentp->firstc,
 				    i * dps + j);
-				futex_up(&parentp->idx->lock);
+				fibril_mutex_unlock(&parentp->idx->lock);
 				if (!idx) {
 					/*
@@ -647,5 +647,5 @@
 				}
 				nodep = fat_node_get_core(idx);
-				futex_up(&idx->lock);
+				fibril_mutex_unlock(&idx->lock);
 				block_put(b);
 				return FS_NODE(nodep);
@@ -655,5 +655,5 @@
 	}
 
-	futex_up(&parentp->idx->lock);
+	fibril_mutex_unlock(&parentp->idx->lock);
 	return NULL;
 }
@@ -687,5 +687,5 @@
 		return false;
 	
-	futex_down(&nodep->idx->lock);
+	fibril_mutex_lock(&nodep->idx->lock);
 	bs = block_bb_get(nodep->idx->dev_handle);
 	bps = uint16_t_le2host(bs->bps);
@@ -706,14 +706,14 @@
 			case FAT_DENTRY_LAST:
 				block_put(b);
-				futex_up(&nodep->idx->lock);
+				fibril_mutex_unlock(&nodep->idx->lock);
 				return false;
 			default:
 			case FAT_DENTRY_VALID:
 				block_put(b);
-				futex_up(&nodep->idx->lock);
+				fibril_mutex_unlock(&nodep->idx->lock);
 				return true;
 			}
 			block_put(b);
-			futex_up(&nodep->idx->lock);
+			fibril_mutex_unlock(&nodep->idx->lock);
 			return true;
 		}
@@ -721,5 +721,5 @@
 	}
 
-	futex_up(&nodep->idx->lock);
+	fibril_mutex_unlock(&nodep->idx->lock);
 	return false;
 }
@@ -882,5 +882,5 @@
 	rfn->data = rootp;
 	
-	futex_up(&ridxp->lock);
+	fibril_mutex_unlock(&ridxp->lock);
 
 	ipc_answer_3(rid, EOK, ridxp->index, rootp->size, rootp->lnkcnt);
