Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision a93d79a46693b2c1d9a1d42413c586c2049c4ef1)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 63b4f90725d28de0589f88b5750edf8a9c29b84e)
@@ -72,10 +72,10 @@
  * Forward declarations of FAT libfs operations.
  */
-static int fat_root_get(fs_node_t **, dev_handle_t);
+static int fat_root_get(fs_node_t **, devmap_handle_t);
 static int fat_match(fs_node_t **, fs_node_t *, const char *);
-static int fat_node_get(fs_node_t **, dev_handle_t, fs_index_t);
+static int fat_node_get(fs_node_t **, devmap_handle_t, fs_index_t);
 static int fat_node_open(fs_node_t *);
 static int fat_node_put(fs_node_t *);
-static int fat_create_node(fs_node_t **, dev_handle_t, int);
+static int fat_create_node(fs_node_t **, devmap_handle_t, int);
 static int fat_destroy_node(fs_node_t *);
 static int fat_link(fs_node_t *, fs_node_t *, const char *);
@@ -88,5 +88,5 @@
 static bool fat_is_directory(fs_node_t *);
 static bool fat_is_file(fs_node_t *node);
-static dev_handle_t fat_device_get(fs_node_t *node);
+static devmap_handle_t fat_device_get(fs_node_t *node);
 
 /*
@@ -120,8 +120,8 @@
 	assert(node->dirty);
 
-	bs = block_bb_get(node->idx->dev_handle);
+	bs = block_bb_get(node->idx->devmap_handle);
 	
 	/* Read the block that contains the dentry of interest. */
-	rc = _fat_block_get(&b, bs, node->idx->dev_handle, node->idx->pfc,
+	rc = _fat_block_get(&b, bs, node->idx->devmap_handle, node->idx->pfc,
 	    NULL, (node->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
 	    BLOCK_FLAGS_NONE);
@@ -145,5 +145,5 @@
 }
 
-static int fat_node_fini_by_dev_handle(dev_handle_t dev_handle)
+static int fat_node_fini_by_devmap_handle(devmap_handle_t devmap_handle)
 {
 	link_t *lnk;
@@ -170,5 +170,5 @@
 			goto restart;
 		}
-		if (nodep->idx->dev_handle != dev_handle) {
+		if (nodep->idx->devmap_handle != devmap_handle) {
 			fibril_mutex_unlock(&nodep->idx->lock);
 			fibril_mutex_unlock(&nodep->lock);
@@ -299,8 +299,8 @@
 		return rc;
 
-	bs = block_bb_get(idxp->dev_handle);
+	bs = block_bb_get(idxp->devmap_handle);
 
 	/* Read the block that contains the dentry of interest. */
-	rc = _fat_block_get(&b, bs, idxp->dev_handle, idxp->pfc, NULL,
+	rc = _fat_block_get(&b, bs, idxp->devmap_handle, idxp->pfc, NULL,
 	    (idxp->pdi * sizeof(fat_dentry_t)) / BPS(bs), BLOCK_FLAGS_NONE);
 	if (rc != EOK) {
@@ -323,5 +323,5 @@
 		 */
 		uint16_t clusters;
-		rc = fat_clusters_get(&clusters, bs, idxp->dev_handle,
+		rc = fat_clusters_get(&clusters, bs, idxp->devmap_handle,
 		    uint16_t_le2host(d->firstc));
 		if (rc != EOK) {
@@ -356,7 +356,7 @@
  */
 
-int fat_root_get(fs_node_t **rfn, dev_handle_t dev_handle)
-{
-	return fat_node_get(rfn, dev_handle, 0);
+int fat_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
+{
+	return fat_node_get(rfn, devmap_handle, 0);
 }
 
@@ -369,13 +369,13 @@
 	unsigned blocks;
 	fat_dentry_t *d;
-	dev_handle_t dev_handle;
+	devmap_handle_t devmap_handle;
 	block_t *b;
 	int rc;
 
 	fibril_mutex_lock(&parentp->idx->lock);
-	dev_handle = parentp->idx->dev_handle;
+	devmap_handle = parentp->idx->devmap_handle;
 	fibril_mutex_unlock(&parentp->idx->lock);
 
-	bs = block_bb_get(dev_handle);
+	bs = block_bb_get(devmap_handle);
 	blocks = parentp->size / BPS(bs);
 	for (i = 0; i < blocks; i++) {
@@ -402,5 +402,5 @@
 				/* hit */
 				fat_node_t *nodep;
-				fat_idx_t *idx = fat_idx_get_by_pos(dev_handle,
+				fat_idx_t *idx = fat_idx_get_by_pos(devmap_handle,
 				    parentp->firstc, i * DPS(bs) + j);
 				if (!idx) {
@@ -435,5 +435,5 @@
 
 /** Instantiate a FAT in-core node. */
-int fat_node_get(fs_node_t **rfn, dev_handle_t dev_handle, fs_index_t index)
+int fat_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
 {
 	fat_node_t *nodep;
@@ -441,5 +441,5 @@
 	int rc;
 
-	idxp = fat_idx_get_by_index(dev_handle, index);
+	idxp = fat_idx_get_by_index(devmap_handle, index);
 	if (!idxp) {
 		*rfn = NULL;
@@ -492,5 +492,5 @@
 }
 
-int fat_create_node(fs_node_t **rfn, dev_handle_t dev_handle, int flags)
+int fat_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags)
 {
 	fat_idx_t *idxp;
@@ -500,14 +500,14 @@
 	int rc;
 
-	bs = block_bb_get(dev_handle);
+	bs = block_bb_get(devmap_handle);
 	if (flags & L_DIRECTORY) {
 		/* allocate a cluster */
-		rc = fat_alloc_clusters(bs, dev_handle, 1, &mcl, &lcl);
+		rc = fat_alloc_clusters(bs, devmap_handle, 1, &mcl, &lcl);
 		if (rc != EOK)
 			return rc;
 		/* populate the new cluster with unused dentries */
-		rc = fat_zero_cluster(bs, dev_handle, mcl);
+		rc = fat_zero_cluster(bs, devmap_handle, mcl);
 		if (rc != EOK) {
-			(void) fat_free_clusters(bs, dev_handle, mcl);
+			(void) fat_free_clusters(bs, devmap_handle, mcl);
 			return rc;
 		}
@@ -516,10 +516,10 @@
 	rc = fat_node_get_new(&nodep);
 	if (rc != EOK) {
-		(void) fat_free_clusters(bs, dev_handle, mcl);
+		(void) fat_free_clusters(bs, devmap_handle, mcl);
 		return rc;
 	}
-	rc = fat_idx_get_new(&idxp, dev_handle);
-	if (rc != EOK) {
-		(void) fat_free_clusters(bs, dev_handle, mcl);	
+	rc = fat_idx_get_new(&idxp, devmap_handle);
+	if (rc != EOK) {
+		(void) fat_free_clusters(bs, devmap_handle, mcl);	
 		(void) fat_node_put(FS_NODE(nodep));
 		return rc;
@@ -570,9 +570,9 @@
 	assert(!has_children);
 
-	bs = block_bb_get(nodep->idx->dev_handle);
+	bs = block_bb_get(nodep->idx->devmap_handle);
 	if (nodep->firstc != FAT_CLST_RES0) {
 		assert(nodep->size);
 		/* Free all clusters allocated to the node. */
-		rc = fat_free_clusters(bs, nodep->idx->dev_handle,
+		rc = fat_free_clusters(bs, nodep->idx->devmap_handle,
 		    nodep->firstc);
 	}
@@ -620,5 +620,5 @@
 	
 	fibril_mutex_lock(&parentp->idx->lock);
-	bs = block_bb_get(parentp->idx->dev_handle);
+	bs = block_bb_get(parentp->idx->devmap_handle);
 
 	blocks = parentp->size / BPS(bs);
@@ -659,12 +659,12 @@
 		return ENOSPC;
 	}
-	rc = fat_alloc_clusters(bs, parentp->idx->dev_handle, 1, &mcl, &lcl);
+	rc = fat_alloc_clusters(bs, parentp->idx->devmap_handle, 1, &mcl, &lcl);
 	if (rc != EOK) {
 		fibril_mutex_unlock(&parentp->idx->lock);
 		return rc;
 	}
-	rc = fat_zero_cluster(bs, parentp->idx->dev_handle, mcl);
-	if (rc != EOK) {
-		(void) fat_free_clusters(bs, parentp->idx->dev_handle, mcl);
+	rc = fat_zero_cluster(bs, parentp->idx->devmap_handle, mcl);
+	if (rc != EOK) {
+		(void) fat_free_clusters(bs, parentp->idx->devmap_handle, mcl);
 		fibril_mutex_unlock(&parentp->idx->lock);
 		return rc;
@@ -672,5 +672,5 @@
 	rc = fat_append_clusters(bs, parentp, mcl, lcl);
 	if (rc != EOK) {
-		(void) fat_free_clusters(bs, parentp->idx->dev_handle, mcl);
+		(void) fat_free_clusters(bs, parentp->idx->devmap_handle, mcl);
 		fibril_mutex_unlock(&parentp->idx->lock);
 		return rc;
@@ -789,7 +789,7 @@
 	assert(childp->lnkcnt == 1);
 	fibril_mutex_lock(&childp->idx->lock);
-	bs = block_bb_get(childp->idx->dev_handle);
-
-	rc = _fat_block_get(&b, bs, childp->idx->dev_handle, childp->idx->pfc,
+	bs = block_bb_get(childp->idx->devmap_handle);
+
+	rc = _fat_block_get(&b, bs, childp->idx->devmap_handle, childp->idx->pfc,
 	    NULL, (childp->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
 	    BLOCK_FLAGS_NONE);
@@ -840,5 +840,5 @@
 	
 	fibril_mutex_lock(&nodep->idx->lock);
-	bs = block_bb_get(nodep->idx->dev_handle);
+	bs = block_bb_get(nodep->idx->devmap_handle);
 
 	blocks = nodep->size / BPS(bs);
@@ -914,5 +914,5 @@
 }
 
-dev_handle_t fat_device_get(fs_node_t *node)
+devmap_handle_t fat_device_get(fs_node_t *node)
 {
 	return 0;
@@ -946,5 +946,5 @@
 void fat_mounted(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	enum cache_mode cmode;
 	fat_bs_t *bs;
@@ -968,5 +968,5 @@
 
 	/* initialize libblock */
-	rc = block_init(dev_handle, BS_SIZE);
+	rc = block_init(devmap_handle, BS_SIZE);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
@@ -975,7 +975,7 @@
 
 	/* prepare the boot block */
-	rc = block_bb_read(dev_handle, BS_BLOCK);
-	if (rc != EOK) {
-		block_fini(dev_handle);
+	rc = block_bb_read(devmap_handle, BS_BLOCK);
+	if (rc != EOK) {
+		block_fini(devmap_handle);
 		ipc_answer_0(rid, rc);
 		return;
@@ -983,8 +983,8 @@
 
 	/* get the buffer with the boot sector */
-	bs = block_bb_get(dev_handle);
+	bs = block_bb_get(devmap_handle);
 	
 	if (BPS(bs) != BS_SIZE) {
-		block_fini(dev_handle);
+		block_fini(devmap_handle);
 		ipc_answer_0(rid, ENOTSUP);
 		return;
@@ -992,7 +992,7 @@
 
 	/* Initialize the block cache */
-	rc = block_cache_init(dev_handle, BPS(bs), 0 /* XXX */, cmode);
-	if (rc != EOK) {
-		block_fini(dev_handle);
+	rc = block_cache_init(devmap_handle, BPS(bs), 0 /* XXX */, cmode);
+	if (rc != EOK) {
+		block_fini(devmap_handle);
 		ipc_answer_0(rid, rc);
 		return;
@@ -1000,16 +1000,16 @@
 
 	/* Do some simple sanity checks on the file system. */
-	rc = fat_sanity_check(bs, dev_handle);
-	if (rc != EOK) {
-		(void) block_cache_fini(dev_handle);
-		block_fini(dev_handle);
+	rc = fat_sanity_check(bs, devmap_handle);
+	if (rc != EOK) {
+		(void) block_cache_fini(devmap_handle);
+		block_fini(devmap_handle);
 		ipc_answer_0(rid, rc);
 		return;
 	}
 
-	rc = fat_idx_init_by_dev_handle(dev_handle);
-	if (rc != EOK) {
-		(void) block_cache_fini(dev_handle);
-		block_fini(dev_handle);
+	rc = fat_idx_init_by_devmap_handle(devmap_handle);
+	if (rc != EOK) {
+		(void) block_cache_fini(devmap_handle);
+		block_fini(devmap_handle);
 		ipc_answer_0(rid, rc);
 		return;
@@ -1019,7 +1019,7 @@
 	fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t));
 	if (!rfn) {
-		(void) block_cache_fini(dev_handle);
-		block_fini(dev_handle);
-		fat_idx_fini_by_dev_handle(dev_handle);
+		(void) block_cache_fini(devmap_handle);
+		block_fini(devmap_handle);
+		fat_idx_fini_by_devmap_handle(devmap_handle);
 		ipc_answer_0(rid, ENOMEM);
 		return;
@@ -1029,7 +1029,7 @@
 	if (!rootp) {
 		free(rfn);
-		(void) block_cache_fini(dev_handle);
-		block_fini(dev_handle);
-		fat_idx_fini_by_dev_handle(dev_handle);
+		(void) block_cache_fini(devmap_handle);
+		block_fini(devmap_handle);
+		fat_idx_fini_by_devmap_handle(devmap_handle);
 		ipc_answer_0(rid, ENOMEM);
 		return;
@@ -1037,11 +1037,11 @@
 	fat_node_initialize(rootp);
 
-	fat_idx_t *ridxp = fat_idx_get_by_pos(dev_handle, FAT_CLST_ROOTPAR, 0);
+	fat_idx_t *ridxp = fat_idx_get_by_pos(devmap_handle, FAT_CLST_ROOTPAR, 0);
 	if (!ridxp) {
 		free(rfn);
 		free(rootp);
-		(void) block_cache_fini(dev_handle);
-		block_fini(dev_handle);
-		fat_idx_fini_by_dev_handle(dev_handle);
+		(void) block_cache_fini(devmap_handle);
+		block_fini(devmap_handle);
+		fat_idx_fini_by_devmap_handle(devmap_handle);
 		ipc_answer_0(rid, ENOMEM);
 		return;
@@ -1072,10 +1072,10 @@
 void fat_unmounted(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	fs_node_t *fn;
 	fat_node_t *nodep;
 	int rc;
 
-	rc = fat_root_get(&fn, dev_handle);
+	rc = fat_root_get(&fn, devmap_handle);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
@@ -1105,8 +1105,8 @@
 	 * stop using libblock for this instance.
 	 */
-	(void) fat_node_fini_by_dev_handle(dev_handle);
-	fat_idx_fini_by_dev_handle(dev_handle);
-	(void) block_cache_fini(dev_handle);
-	block_fini(dev_handle);
+	(void) fat_node_fini_by_devmap_handle(devmap_handle);
+	fat_idx_fini_by_devmap_handle(devmap_handle);
+	(void) block_cache_fini(devmap_handle);
+	block_fini(devmap_handle);
 
 	ipc_answer_0(rid, EOK);
@@ -1125,5 +1125,5 @@
 void fat_read(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
 	aoff64_t pos =
@@ -1136,5 +1136,5 @@
 	int rc;
 
-	rc = fat_node_get(&fn, dev_handle, index);
+	rc = fat_node_get(&fn, devmap_handle, index);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
@@ -1156,5 +1156,5 @@
 	}
 
-	bs = block_bb_get(dev_handle);
+	bs = block_bb_get(devmap_handle);
 
 	if (nodep->type == FAT_FILE) {
@@ -1262,5 +1262,5 @@
 void fat_write(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
 	aoff64_t pos =
@@ -1275,5 +1275,5 @@
 	int rc;
 	
-	rc = fat_node_get(&fn, dev_handle, index);
+	rc = fat_node_get(&fn, devmap_handle, index);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
@@ -1295,5 +1295,5 @@
 	}
 
-	bs = block_bb_get(dev_handle);
+	bs = block_bb_get(devmap_handle);
 
 	/*
@@ -1357,5 +1357,5 @@
 		nclsts = (ROUND_UP(pos + bytes, BPC(bs)) - boundary) / BPC(bs);
 		/* create an independent chain of nclsts clusters in all FATs */
-		rc = fat_alloc_clusters(bs, dev_handle, nclsts, &mcl, &lcl);
+		rc = fat_alloc_clusters(bs, devmap_handle, nclsts, &mcl, &lcl);
 		if (rc != EOK) {
 			/* could not allocate a chain of nclsts clusters */
@@ -1368,5 +1368,5 @@
 		rc = fat_fill_gap(bs, nodep, mcl, pos);
 		if (rc != EOK) {
-			(void) fat_free_clusters(bs, dev_handle, mcl);
+			(void) fat_free_clusters(bs, devmap_handle, mcl);
 			(void) fat_node_put(fn);
 			ipc_answer_0(callid, rc);
@@ -1374,8 +1374,8 @@
 			return;
 		}
-		rc = _fat_block_get(&b, bs, dev_handle, lcl, NULL,
+		rc = _fat_block_get(&b, bs, devmap_handle, lcl, NULL,
 		    (pos / BPS(bs)) % SPC(bs), flags);
 		if (rc != EOK) {
-			(void) fat_free_clusters(bs, dev_handle, mcl);
+			(void) fat_free_clusters(bs, devmap_handle, mcl);
 			(void) fat_node_put(fn);
 			ipc_answer_0(callid, rc);
@@ -1388,5 +1388,5 @@
 		rc = block_put(b);
 		if (rc != EOK) {
-			(void) fat_free_clusters(bs, dev_handle, mcl);
+			(void) fat_free_clusters(bs, devmap_handle, mcl);
 			(void) fat_node_put(fn);
 			ipc_answer_0(rid, rc);
@@ -1399,5 +1399,5 @@
 		rc = fat_append_clusters(bs, nodep, mcl, lcl);
 		if (rc != EOK) {
-			(void) fat_free_clusters(bs, dev_handle, mcl);
+			(void) fat_free_clusters(bs, devmap_handle, mcl);
 			(void) fat_node_put(fn);
 			ipc_answer_0(rid, rc);
@@ -1414,5 +1414,5 @@
 void fat_truncate(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
 	aoff64_t size =
@@ -1423,5 +1423,5 @@
 	int rc;
 
-	rc = fat_node_get(&fn, dev_handle, index);
+	rc = fat_node_get(&fn, devmap_handle, index);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
@@ -1434,5 +1434,5 @@
 	nodep = FAT_NODE(fn);
 
-	bs = block_bb_get(dev_handle);
+	bs = block_bb_get(devmap_handle);
 
 	if (nodep->size == size) {
@@ -1461,5 +1461,5 @@
 		} else {
 			fat_cluster_t lastc;
-			rc = fat_cluster_walk(bs, dev_handle, nodep->firstc,
+			rc = fat_cluster_walk(bs, devmap_handle, nodep->firstc,
 			    &lastc, NULL, (size - 1) / BPC(bs));
 			if (rc != EOK)
@@ -1486,10 +1486,10 @@
 void fat_destroy(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request);
 	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
 	fs_node_t *fn;
 	int rc;
 
-	rc = fat_node_get(&fn, dev_handle, index);
+	rc = fat_node_get(&fn, devmap_handle, index);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
@@ -1517,9 +1517,9 @@
 void fat_sync(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
 	
 	fs_node_t *fn;
-	int rc = fat_node_get(&fn, dev_handle, index);
+	int rc = fat_node_get(&fn, devmap_handle, index);
 	if (rc != EOK) {
 		ipc_answer_0(rid, rc);
