Index: uspace/srv/fs/exfat/exfat_ops.c
===================================================================
--- uspace/srv/fs/exfat/exfat_ops.c	(revision 7234617338498dd73be89a2f23726367a7cdfc3c)
+++ uspace/srv/fs/exfat/exfat_ops.c	(revision 375ab5e571cc53eeb2aa803a8e86052b51d7ad00)
@@ -46,5 +46,5 @@
 #include <libblock.h>
 #include <ipc/services.h>
-#include <ipc/devmap.h>
+#include <ipc/loc.h>
 #include <macros.h>
 #include <async.h>
@@ -71,10 +71,10 @@
  */
 
-static int exfat_root_get(fs_node_t **, devmap_handle_t);
+static int exfat_root_get(fs_node_t **, service_id_t);
 static int exfat_match(fs_node_t **, fs_node_t *, const char *);
-static int exfat_node_get(fs_node_t **, devmap_handle_t, fs_index_t);
+static int exfat_node_get(fs_node_t **, service_id_t, fs_index_t);
 static int exfat_node_open(fs_node_t *);
 /* static int exfat_node_put(fs_node_t *); */
-static int exfat_create_node(fs_node_t **, devmap_handle_t, int);
+static int exfat_create_node(fs_node_t **, service_id_t, int);
 static int exfat_destroy_node(fs_node_t *);
 static int exfat_link(fs_node_t *, fs_node_t *, const char *);
@@ -86,5 +86,5 @@
 static bool exfat_is_directory(fs_node_t *);
 static bool exfat_is_file(fs_node_t *node);
-static devmap_handle_t exfat_device_get(fs_node_t *node);
+static service_id_t exfat_device_get(fs_node_t *node);
 
 /*
@@ -135,5 +135,5 @@
 	ds.data_size = node->size;
 
-	exfat_directory_open_parent(&di, node->idx->devmap_handle, node->idx->pfc, 
+	exfat_directory_open_parent(&di, node->idx->service_id, node->idx->pfc, 
 	    node->idx->parent_fragmented);
 	rc = exfat_directory_seek(&di, node->idx->pdi);
@@ -151,5 +151,5 @@
 }
 
-static int exfat_node_fini_by_devmap_handle(devmap_handle_t devmap_handle)
+static int exfat_node_fini_by_service_id(service_id_t service_id)
 {
 	exfat_node_t *nodep;
@@ -175,5 +175,5 @@
 			goto restart;
 		}
-		if (nodep->idx->devmap_handle != devmap_handle) {
+		if (nodep->idx->service_id != service_id) {
 			fibril_mutex_unlock(&nodep->idx->lock);
 			fibril_mutex_unlock(&nodep->lock);
@@ -268,7 +268,7 @@
 
 static int exfat_node_get_new_by_pos(exfat_node_t **nodepp, 
-    devmap_handle_t devmap_handle, exfat_cluster_t pfc, unsigned pdi)
-{
-	exfat_idx_t *idxp = exfat_idx_get_by_pos(devmap_handle, pfc, pdi);
+    service_id_t service_id, exfat_cluster_t pfc, unsigned pdi)
+{
+	exfat_idx_t *idxp = exfat_idx_get_by_pos(service_id, pfc, pdi);
 	if (!idxp)
 		return ENOMEM;
@@ -318,5 +318,5 @@
 		return rc;
 
-	exfat_directory_open_parent(&di, idxp->devmap_handle, idxp->pfc, 
+	exfat_directory_open_parent(&di, idxp->service_id, idxp->pfc, 
 	    idxp->parent_fragmented);
 	rc = exfat_directory_seek(&di, idxp->pdi);
@@ -395,9 +395,9 @@
 }
 
-int exfat_node_expand(devmap_handle_t devmap_handle, exfat_node_t *nodep, exfat_cluster_t clusters)
+int exfat_node_expand(service_id_t service_id, exfat_node_t *nodep, exfat_cluster_t clusters)
 {
 	exfat_bs_t *bs;
 	int rc;
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 
 	if (!nodep->fragmented) {
@@ -418,10 +418,10 @@
 
 	/* create an independent chain of nclsts clusters in all FATs */
-	rc = exfat_alloc_clusters(bs, devmap_handle, clusters, &mcl, &lcl);
-	if (rc != EOK)
-		return rc;
-	rc = exfat_zero_cluster(bs, devmap_handle, mcl);
-	if (rc != EOK) {
-		(void) exfat_free_clusters(bs, devmap_handle, mcl);
+	rc = exfat_alloc_clusters(bs, service_id, clusters, &mcl, &lcl);
+	if (rc != EOK)
+		return rc;
+	rc = exfat_zero_cluster(bs, service_id, mcl);
+	if (rc != EOK) {
+		(void) exfat_free_clusters(bs, service_id, mcl);
 		return rc;
 	}
@@ -432,5 +432,5 @@
 	rc = exfat_append_clusters(bs, nodep, mcl, lcl);
 	if (rc != EOK) {
-		(void) exfat_free_clusters(bs, devmap_handle, mcl);
+		(void) exfat_free_clusters(bs, service_id, mcl);
 		return rc;
 	}
@@ -439,9 +439,9 @@
 }
 
-static int exfat_node_shrink(devmap_handle_t devmap_handle, exfat_node_t *nodep, aoff64_t size)
+static int exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep, aoff64_t size)
 {
 	exfat_bs_t *bs;
 	int rc;
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 
 	if (!nodep->fragmented) {
@@ -466,5 +466,5 @@
 		} else {
 			exfat_cluster_t lastc;
-			rc = exfat_cluster_walk(bs, devmap_handle, nodep->firstc,
+			rc = exfat_cluster_walk(bs, service_id, nodep->firstc,
 			    &lastc, NULL, (size - 1) / BPC(bs));
 			if (rc != EOK)
@@ -486,17 +486,17 @@
  */
 
-int exfat_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
-{
-	return exfat_node_get(rfn, devmap_handle, EXFAT_ROOT_IDX);
-}
-
-int exfat_bitmap_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
-{
-	return exfat_node_get(rfn, devmap_handle, EXFAT_BITMAP_IDX);
-}
-
-int exfat_uctable_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
-{
-	return exfat_node_get(rfn, devmap_handle, EXFAT_UCTABLE_IDX);
+int exfat_root_get(fs_node_t **rfn, service_id_t service_id)
+{
+	return exfat_node_get(rfn, service_id, EXFAT_ROOT_IDX);
+}
+
+int exfat_bitmap_get(fs_node_t **rfn, service_id_t service_id)
+{
+	return exfat_node_get(rfn, service_id, EXFAT_BITMAP_IDX);
+}
+
+int exfat_uctable_get(fs_node_t **rfn, service_id_t service_id)
+{
+	return exfat_node_get(rfn, service_id, EXFAT_UCTABLE_IDX);
 }
 
@@ -508,9 +508,9 @@
 	exfat_file_dentry_t df;
 	exfat_stream_dentry_t ds;
-	devmap_handle_t devmap_handle;
+	service_id_t service_id;
 	int rc;
 
 	fibril_mutex_lock(&parentp->idx->lock);
-	devmap_handle = parentp->idx->devmap_handle;
+	service_id = parentp->idx->service_id;
 	fibril_mutex_unlock(&parentp->idx->lock);
 	
@@ -526,5 +526,5 @@
 			exfat_node_t *nodep;
 			aoff64_t o = di.pos % (BPS(di.bs) / sizeof(exfat_dentry_t));
-			exfat_idx_t *idx = exfat_idx_get_by_pos(devmap_handle,
+			exfat_idx_t *idx = exfat_idx_get_by_pos(service_id,
 				parentp->firstc, di.bnum * DPS(di.bs) + o);
 			if (!idx) {
@@ -559,5 +559,5 @@
 
 /** Instantiate a exFAT in-core node. */
-int exfat_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
+int exfat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
 {
 	exfat_node_t *nodep;
@@ -565,5 +565,5 @@
 	int rc;
 
-	idxp = exfat_idx_get_by_index(devmap_handle, index);
+	idxp = exfat_idx_get_by_index(service_id, index);
 	if (!idxp) {
 		*rfn = NULL;
@@ -616,5 +616,5 @@
 }
 
-int exfat_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags)
+int exfat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
 {
 	exfat_idx_t *idxp;
@@ -623,10 +623,10 @@
 	int rc;
 
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 	rc = exfat_node_get_new(&nodep);
 	if (rc != EOK)
 		return rc;
 
-	rc = exfat_idx_get_new(&idxp, devmap_handle);
+	rc = exfat_idx_get_new(&idxp, service_id);
 	if (rc != EOK) {
 		(void) exfat_node_put(FS_NODE(nodep));
@@ -647,5 +647,5 @@
 	if (flags & L_DIRECTORY) {
 		nodep->type = EXFAT_DIRECTORY;
-		rc = exfat_node_expand(devmap_handle, nodep, 1);
+		rc = exfat_node_expand(service_id, nodep, 1);
 		if (rc != EOK) {
 			(void) exfat_node_put(FS_NODE(nodep));
@@ -684,10 +684,10 @@
 	assert(!has_children);
 
-	bs = block_bb_get(nodep->idx->devmap_handle);
+	bs = block_bb_get(nodep->idx->service_id);
 	if (nodep->firstc != 0) {
 		assert(nodep->size);
 		/* Free all clusters allocated to the node. */
 		if (nodep->fragmented)
-			rc = exfat_free_clusters(bs, nodep->idx->devmap_handle,
+			rc = exfat_free_clusters(bs, nodep->idx->service_id,
 				nodep->firstc);
 		else
@@ -893,5 +893,5 @@
 }
 
-devmap_handle_t exfat_device_get(fs_node_t *node)
+service_id_t exfat_device_get(fs_node_t *node)
 {
 	return 0;
@@ -926,5 +926,5 @@
 /* Print debug info */
 /*
-static void exfat_fsinfo(exfat_bs_t *bs, devmap_handle_t devmap_handle)
+static void exfat_fsinfo(exfat_bs_t *bs, service_id_t service_id)
 {
 	printf("exFAT file system mounted\n");
@@ -945,10 +945,10 @@
 	exfat_cluster_t clst;
 	for (i=0; i<=7; i++) {
-		rc = exfat_get_cluster(bs, devmap_handle, i, &clst);
+		rc = exfat_get_cluster(bs, service_id, i, &clst);
 		if (rc != EOK)
 			return;
 		printf("Clst %d: %x", i, clst);
 		if (i>=2)
-			printf(", Bitmap: %d\n", bitmap_is_free(bs, devmap_handle, i)!=EOK);
+			printf(", Bitmap: %d\n", bitmap_is_free(bs, service_id, i)!=EOK);
 		else
 			printf("\n");
@@ -958,5 +958,5 @@
  
 static int
-exfat_mounted(devmap_handle_t devmap_handle, const char *opts, fs_index_t *index,
+exfat_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
     aoff64_t *size, unsigned *linkcnt)
 {
@@ -973,47 +973,47 @@
 
 	/* initialize libblock */
-	rc = block_init(EXCHANGE_SERIALIZE, devmap_handle, BS_SIZE);
+	rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE);
 	if (rc != EOK)
 		return rc;
 
 	/* prepare the boot block */
-	rc = block_bb_read(devmap_handle, BS_BLOCK);
-	if (rc != EOK) {
-		block_fini(devmap_handle);
+	rc = block_bb_read(service_id, BS_BLOCK);
+	if (rc != EOK) {
+		block_fini(service_id);
 		return rc;
 	}
 
 	/* get the buffer with the boot sector */
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 
 	/* Initialize the block cache */
-	rc = block_cache_init(devmap_handle, BPS(bs), 0 /* XXX */, cmode);
-	if (rc != EOK) {
-		block_fini(devmap_handle);
+	rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode);
+	if (rc != EOK) {
+		block_fini(service_id);
 		return rc;
 	}
 
 	/* Do some simple sanity checks on the file system. */
-	rc = exfat_sanity_check(bs, devmap_handle);
-	if (rc != EOK) {
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		return rc;
-	}
-
-	rc = exfat_idx_init_by_devmap_handle(devmap_handle);
-	if (rc != EOK) {
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
+	rc = exfat_sanity_check(bs, service_id);
+	if (rc != EOK) {
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		return rc;
+	}
+
+	rc = exfat_idx_init_by_service_id(service_id);
+	if (rc != EOK) {
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
 		return rc;
 	}
 
 	/* Initialize the root node. */
-	rc = exfat_node_get_new_by_pos(&rootp, devmap_handle, EXFAT_ROOT_PAR, 
+	rc = exfat_node_get_new_by_pos(&rootp, service_id, EXFAT_ROOT_PAR, 
 	    EXFAT_ROOT_POS);
 	if (rc!=EOK) {
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOMEM;
 	}
@@ -1027,10 +1027,10 @@
 
 	uint32_t clusters;
-	rc = exfat_clusters_get(&clusters, bs, devmap_handle, rootp->firstc);
+	rc = exfat_clusters_get(&clusters, bs, service_id, rootp->firstc);
 	if (rc != EOK) {
 		free(rootp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOTSUP;
 	}
@@ -1044,7 +1044,7 @@
 	if (rc != EOK) {
 		free(rootp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOTSUP;
 	}
@@ -1054,17 +1054,17 @@
 	if (rc != EOK) {
 		free(rootp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOTSUP;
 	}
 
-	rc = exfat_node_get_new_by_pos(&bitmapp, devmap_handle, rootp->firstc, 
+	rc = exfat_node_get_new_by_pos(&bitmapp, service_id, rootp->firstc, 
 	    di.pos);
 	if (rc!=EOK) {
 		free(rootp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOMEM;
 	}
@@ -1085,7 +1085,7 @@
 		free(rootp);
 		free(bitmapp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOTSUP;
 	}
@@ -1095,18 +1095,18 @@
 		free(rootp);
 		free(bitmapp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOTSUP;
 	}
 
-	rc = exfat_node_get_new_by_pos(&uctablep, devmap_handle, rootp->firstc, 
+	rc = exfat_node_get_new_by_pos(&uctablep, service_id, rootp->firstc, 
 	    di.pos);
 	if (rc!=EOK) {
 		free(rootp);
 		free(bitmapp);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOMEM;
 	}
@@ -1127,11 +1127,11 @@
 		free(bitmapp);
 		free(uctablep);
-		(void) block_cache_fini(devmap_handle);
-		block_fini(devmap_handle);
-		exfat_idx_fini_by_devmap_handle(devmap_handle);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		exfat_idx_fini_by_service_id(service_id);
 		return ENOMEM;
 	}
 
-	/* exfat_fsinfo(bs, devmap_handle); */
+	/* exfat_fsinfo(bs, service_id); */
 
 	*index = rootp->idx->index;
@@ -1142,5 +1142,5 @@
 }
 
-static int exfat_unmounted(devmap_handle_t devmap_handle)
+static int exfat_unmounted(service_id_t service_id)
 {
 	fs_node_t *fn;
@@ -1148,5 +1148,5 @@
 	int rc;
 
-	rc = exfat_root_get(&fn, devmap_handle);
+	rc = exfat_root_get(&fn, service_id);
 	if (rc != EOK)
 		return rc;
@@ -1173,8 +1173,8 @@
 	 * stop using libblock for this instance.
 	 */
-	(void) exfat_node_fini_by_devmap_handle(devmap_handle);
-	exfat_idx_fini_by_devmap_handle(devmap_handle);
-	(void) block_cache_fini(devmap_handle);
-	block_fini(devmap_handle);
+	(void) exfat_node_fini_by_service_id(service_id);
+	exfat_idx_fini_by_service_id(service_id);
+	(void) block_cache_fini(service_id);
+	block_fini(service_id);
 
 	return EOK;
@@ -1182,5 +1182,5 @@
 
 static int
-exfat_read(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,
+exfat_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *rbytes)
 {
@@ -1192,5 +1192,5 @@
 	int rc;
 
-	rc = exfat_node_get(&fn, devmap_handle, index);
+	rc = exfat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1207,5 +1207,5 @@
 	}
 
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 
 	if (nodep->type == EXFAT_FILE) {
@@ -1292,13 +1292,13 @@
 }
 
-static int exfat_close(devmap_handle_t devmap_handle, fs_index_t index)
+static int exfat_close(service_id_t service_id, fs_index_t index)
 {
 	return EOK;
 }
 
-static int exfat_sync(devmap_handle_t devmap_handle, fs_index_t index)
+static int exfat_sync(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
-	int rc = exfat_node_get(&fn, devmap_handle, index);
+	int rc = exfat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1316,5 +1316,5 @@
 
 static int
-exfat_write(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,
+exfat_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     size_t *wbytes, aoff64_t *nsize)
 {
@@ -1328,5 +1328,5 @@
 	int rc;
 
-	rc = exfat_node_get(&fn, devmap_handle, index);
+	rc = exfat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1343,5 +1343,5 @@
 	}
 
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 
 	/*
@@ -1360,5 +1360,5 @@
 		unsigned nclsts;
 		nclsts = (ROUND_UP(pos + bytes, BPC(bs)) - boundary) / BPC(bs);
-		rc = exfat_node_expand(devmap_handle, nodep, nclsts);
+		rc = exfat_node_expand(service_id, nodep, nclsts);
 		if (rc != EOK) {
 			/* could not expand node */
@@ -1404,5 +1404,5 @@
 
 static int
-exfat_truncate(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t size)
+exfat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
 {
 	fs_node_t *fn;
@@ -1411,5 +1411,5 @@
 	int rc;
 
-	rc = exfat_node_get(&fn, devmap_handle, index);
+	rc = exfat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
@@ -1418,5 +1418,5 @@
 	nodep = EXFAT_NODE(fn);
 
-	bs = block_bb_get(devmap_handle);
+	bs = block_bb_get(service_id);
 
 	if (nodep->size == size) {
@@ -1436,5 +1436,5 @@
 		rc = EOK;
 	} else {
-		rc = exfat_node_shrink(devmap_handle, nodep, size);
+		rc = exfat_node_shrink(service_id, nodep, size);
 	}
 
@@ -1443,5 +1443,5 @@
 }
 
-static int exfat_destroy(devmap_handle_t devmap_handle, fs_index_t index)
+static int exfat_destroy(service_id_t service_id, fs_index_t index)
 {
 	fs_node_t *fn;
@@ -1449,5 +1449,5 @@
 	int rc;
 
-	rc = exfat_node_get(&fn, devmap_handle, index);
+	rc = exfat_node_get(&fn, service_id, index);
 	if (rc != EOK)
 		return rc;
