Index: uspace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision a9d85df9ee126de8f372c5cec3a11408064ec8ce)
+++ uspace/srv/fs/fat/fat_idx.c	(revision 15f3c3fbb3cd87db466db2f9b1379fe5b0794299)
@@ -59,5 +59,5 @@
 typedef struct {
 	link_t		link;
-	devmap_handle_t devmap_handle;
+	service_id_t	service_id;
 
 	/** Next unassigned index. */
@@ -76,8 +76,8 @@
 static LIST_INITIALIZE(unused_list);
 
-static void unused_initialize(unused_t *u, devmap_handle_t devmap_handle)
+static void unused_initialize(unused_t *u, service_id_t service_id)
 {
 	link_initialize(&u->link);
-	u->devmap_handle = devmap_handle;
+	u->service_id = service_id;
 	u->next = 0;
 	u->remaining = ((uint64_t)((fs_index_t)-1)) + 1;
@@ -85,5 +85,5 @@
 }
 
-static unused_t *unused_find(devmap_handle_t devmap_handle, bool lock)
+static unused_t *unused_find(service_id_t service_id, bool lock)
 {
 	unused_t *u;
@@ -94,5 +94,5 @@
 	list_foreach(unused_list, l) {
 		u = list_get_instance(l, unused_t, link);
-		if (u->devmap_handle == devmap_handle) 
+		if (u->service_id == service_id) 
 			return u;
 	}
@@ -108,5 +108,5 @@
 /**
  * Global hash table of all used fat_idx_t structures.
- * The index structures are hashed by the devmap_handle, parent node's first
+ * The index structures are hashed by the service_id, parent node's first
  * cluster and index within the parent directory.
  */ 
@@ -122,5 +122,5 @@
 static hash_index_t pos_hash(unsigned long key[])
 {
-	devmap_handle_t devmap_handle = (devmap_handle_t)key[UPH_DH_KEY];
+	service_id_t service_id = (service_id_t)key[UPH_DH_KEY];
 	fat_cluster_t pfc = (fat_cluster_t)key[UPH_PFC_KEY];
 	unsigned pdi = (unsigned)key[UPH_PDI_KEY];
@@ -142,5 +142,5 @@
 	h |= (pdi & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<
 	    (UPH_BUCKETS_LOG / 2); 
-	h |= (devmap_handle & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<
+	h |= (service_id & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<
 	    (3 * (UPH_BUCKETS_LOG / 4));
 
@@ -150,5 +150,5 @@
 static int pos_compare(unsigned long key[], hash_count_t keys, link_t *item)
 {
-	devmap_handle_t devmap_handle = (devmap_handle_t)key[UPH_DH_KEY];
+	service_id_t service_id = (service_id_t)key[UPH_DH_KEY];
 	fat_cluster_t pfc;
 	unsigned pdi;
@@ -157,9 +157,9 @@
 	switch (keys) {
 	case 1:
-		return (devmap_handle == fidx->devmap_handle);
+		return (service_id == fidx->service_id);
 	case 3:
 		pfc = (fat_cluster_t) key[UPH_PFC_KEY];
 		pdi = (unsigned) key[UPH_PDI_KEY];
-		return (devmap_handle == fidx->devmap_handle) && (pfc == fidx->pfc) &&
+		return (service_id == fidx->service_id) && (pfc == fidx->pfc) &&
 		    (pdi == fidx->pdi);
 	default:
@@ -183,5 +183,5 @@
 /**
  * Global hash table of all used fat_idx_t structures.
- * The index structures are hashed by the devmap_handle and index.
+ * The index structures are hashed by the service_id and index.
  */
 static hash_table_t ui_hash;
@@ -195,10 +195,10 @@
 static hash_index_t idx_hash(unsigned long key[])
 {
-	devmap_handle_t devmap_handle = (devmap_handle_t)key[UIH_DH_KEY];
+	service_id_t service_id = (service_id_t)key[UIH_DH_KEY];
 	fs_index_t index = (fs_index_t)key[UIH_INDEX_KEY];
 
 	hash_index_t h;
 
-	h = devmap_handle & ((1 << (UIH_BUCKETS_LOG / 2)) - 1);
+	h = service_id & ((1 << (UIH_BUCKETS_LOG / 2)) - 1);
 	h |= (index & ((1 << (UIH_BUCKETS_LOG / 2)) - 1)) <<
 	    (UIH_BUCKETS_LOG / 2);
@@ -209,5 +209,5 @@
 static int idx_compare(unsigned long key[], hash_count_t keys, link_t *item)
 {
-	devmap_handle_t devmap_handle = (devmap_handle_t)key[UIH_DH_KEY];
+	service_id_t service_id = (service_id_t)key[UIH_DH_KEY];
 	fs_index_t index;
 	fat_idx_t *fidx = list_get_instance(item, fat_idx_t, uih_link);
@@ -215,8 +215,8 @@
 	switch (keys) {
 	case 1:
-		return (devmap_handle == fidx->devmap_handle);
+		return (service_id == fidx->service_id);
 	case 2:
 		index = (fs_index_t) key[UIH_INDEX_KEY];
-		return (devmap_handle == fidx->devmap_handle) &&
+		return (service_id == fidx->service_id) &&
 		    (index == fidx->index);
 	default:
@@ -241,10 +241,10 @@
 
 /** Allocate a VFS index which is not currently in use. */
-static bool fat_index_alloc(devmap_handle_t devmap_handle, fs_index_t *index)
+static bool fat_index_alloc(service_id_t service_id, fs_index_t *index)
 {
 	unused_t *u;
 	
 	assert(index);
-	u = unused_find(devmap_handle, true);
+	u = unused_find(service_id, true);
 	if (!u)
 		return false;	
@@ -303,9 +303,9 @@
 
 /** Free a VFS index, which is no longer in use. */
-static void fat_index_free(devmap_handle_t devmap_handle, fs_index_t index)
+static void fat_index_free(service_id_t service_id, fs_index_t index)
 {
 	unused_t *u;
 
-	u = unused_find(devmap_handle, true);
+	u = unused_find(service_id, true);
 	assert(u);
 
@@ -365,5 +365,5 @@
 }
 
-static int fat_idx_create(fat_idx_t **fidxp, devmap_handle_t devmap_handle)
+static int fat_idx_create(fat_idx_t **fidxp, service_id_t service_id)
 {
 	fat_idx_t *fidx;
@@ -372,5 +372,5 @@
 	if (!fidx) 
 		return ENOMEM;
-	if (!fat_index_alloc(devmap_handle, &fidx->index)) {
+	if (!fat_index_alloc(service_id, &fidx->index)) {
 		free(fidx);
 		return ENOSPC;
@@ -380,5 +380,5 @@
 	link_initialize(&fidx->uih_link);
 	fibril_mutex_initialize(&fidx->lock);
-	fidx->devmap_handle = devmap_handle;
+	fidx->service_id = service_id;
 	fidx->pfc = FAT_CLST_RES0;	/* no parent yet */
 	fidx->pdi = 0;
@@ -389,5 +389,5 @@
 }
 
-int fat_idx_get_new(fat_idx_t **fidxp, devmap_handle_t devmap_handle)
+int fat_idx_get_new(fat_idx_t **fidxp, service_id_t service_id)
 {
 	fat_idx_t *fidx;
@@ -395,5 +395,5 @@
 
 	fibril_mutex_lock(&used_lock);
-	rc = fat_idx_create(&fidx, devmap_handle);
+	rc = fat_idx_create(&fidx, service_id);
 	if (rc != EOK) {
 		fibril_mutex_unlock(&used_lock);
@@ -402,5 +402,5 @@
 		
 	unsigned long ikey[] = {
-		[UIH_DH_KEY] = devmap_handle,
+		[UIH_DH_KEY] = service_id,
 		[UIH_INDEX_KEY] = fidx->index,
 	};
@@ -415,10 +415,10 @@
 
 fat_idx_t *
-fat_idx_get_by_pos(devmap_handle_t devmap_handle, fat_cluster_t pfc, unsigned pdi)
+fat_idx_get_by_pos(service_id_t service_id, fat_cluster_t pfc, unsigned pdi)
 {
 	fat_idx_t *fidx;
 	link_t *l;
 	unsigned long pkey[] = {
-		[UPH_DH_KEY] = devmap_handle,
+		[UPH_DH_KEY] = service_id,
 		[UPH_PFC_KEY] = pfc,
 		[UPH_PDI_KEY] = pdi,
@@ -432,5 +432,5 @@
 		int rc;
 
-		rc = fat_idx_create(&fidx, devmap_handle);
+		rc = fat_idx_create(&fidx, service_id);
 		if (rc != EOK) {
 			fibril_mutex_unlock(&used_lock);
@@ -439,5 +439,5 @@
 		
 		unsigned long ikey[] = {
-			[UIH_DH_KEY] = devmap_handle,
+			[UIH_DH_KEY] = service_id,
 			[UIH_INDEX_KEY] = fidx->index,
 		};
@@ -458,5 +458,5 @@
 {
 	unsigned long pkey[] = {
-		[UPH_DH_KEY] = idx->devmap_handle,
+		[UPH_DH_KEY] = idx->service_id,
 		[UPH_PFC_KEY] = idx->pfc,
 		[UPH_PDI_KEY] = idx->pdi,
@@ -471,5 +471,5 @@
 {
 	unsigned long pkey[] = {
-		[UPH_DH_KEY] = idx->devmap_handle,
+		[UPH_DH_KEY] = idx->service_id,
 		[UPH_PFC_KEY] = idx->pfc,
 		[UPH_PDI_KEY] = idx->pdi,
@@ -482,10 +482,10 @@
 
 fat_idx_t *
-fat_idx_get_by_index(devmap_handle_t devmap_handle, fs_index_t index)
+fat_idx_get_by_index(service_id_t service_id, fs_index_t index)
 {
 	fat_idx_t *fidx = NULL;
 	link_t *l;
 	unsigned long ikey[] = {
-		[UIH_DH_KEY] = devmap_handle,
+		[UIH_DH_KEY] = service_id,
 		[UIH_INDEX_KEY] = index,
 	};
@@ -509,8 +509,8 @@
 {
 	unsigned long ikey[] = {
-		[UIH_DH_KEY] = idx->devmap_handle,
+		[UIH_DH_KEY] = idx->service_id,
 		[UIH_INDEX_KEY] = idx->index,
 	};
-	devmap_handle_t devmap_handle = idx->devmap_handle;
+	service_id_t service_id = idx->service_id;
 	fs_index_t index = idx->index;
 
@@ -526,5 +526,5 @@
 	fibril_mutex_unlock(&used_lock);
 	/* Release the VFS index. */
-	fat_index_free(devmap_handle, index);
+	fat_index_free(service_id, index);
 	/* The index structure itself is freed in idx_remove_callback(). */
 }
@@ -548,5 +548,5 @@
 }
 
-int fat_idx_init_by_devmap_handle(devmap_handle_t devmap_handle)
+int fat_idx_init_by_service_id(service_id_t service_id)
 {
 	unused_t *u;
@@ -556,7 +556,7 @@
 	if (!u)
 		return ENOMEM;
-	unused_initialize(u, devmap_handle);
+	unused_initialize(u, service_id);
 	fibril_mutex_lock(&unused_lock);
-	if (!unused_find(devmap_handle, false)) {
+	if (!unused_find(service_id, false)) {
 		list_append(&u->link, &unused_list);
 	} else {
@@ -568,11 +568,11 @@
 }
 
-void fat_idx_fini_by_devmap_handle(devmap_handle_t devmap_handle)
+void fat_idx_fini_by_service_id(service_id_t service_id)
 {
 	unsigned long ikey[] = {
-		[UIH_DH_KEY] = devmap_handle
+		[UIH_DH_KEY] = service_id
 	};
 	unsigned long pkey[] = {
-		[UPH_DH_KEY] = devmap_handle
+		[UPH_DH_KEY] = service_id
 	};
 
@@ -590,5 +590,5 @@
 	 * Free the unused and freed structures for this instance.
 	 */
-	unused_t *u = unused_find(devmap_handle, true);
+	unused_t *u = unused_find(service_id, true);
 	assert(u);
 	list_remove(&u->link);
