Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 1715b6af7847ebb95ae42eba99295f3291f1d1b5)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 1313ee92979dd133fd0dd0717213410aada3df10)
@@ -147,6 +147,6 @@
 hash_table_t nodes;
 
-#define NODES_KEY_DEV	0	
-#define NODES_KEY_INDEX	1
+#define NODES_KEY_INDEX	0
+#define NODES_KEY_DEV	1
 
 /* Implementation of hash table interface for the nodes hash table. */
@@ -160,36 +160,10 @@
 	tmpfs_node_t *nodep = hash_table_get_instance(item, tmpfs_node_t,
 	    nh_link);
-	
-	switch (keys) {
-	case 1:
-		return (nodep->dev_handle == key[NODES_KEY_DEV]);
-	case 2:	
-		return ((nodep->dev_handle == key[NODES_KEY_DEV]) &&
-		    (nodep->index == key[NODES_KEY_INDEX]));
-	default:
-		abort();
-	}
+	return (nodep->index == key[NODES_KEY_INDEX] &&
+	    nodep->dev_handle == key[NODES_KEY_DEV]);
 }
 
 static void nodes_remove_callback(link_t *item)
 {
-	tmpfs_node_t *nodep = hash_table_get_instance(item, tmpfs_node_t,
-	    nh_link);
-
-	while (!list_empty(&nodep->cs_head)) {
-		tmpfs_dentry_t *dentryp = list_get_instance(nodep->cs_head.next,
-		    tmpfs_dentry_t, link);
-
-		assert(nodep->type == TMPFS_DIRECTORY);
-		list_remove(&dentryp->link);
-		free(dentryp);
-	}
-
-	if (nodep->data) {
-		assert(nodep->type == TMPFS_FILE);
-		free(nodep->data);
-	}
-	free(nodep->bp);
-	free(nodep);
 }
 
@@ -241,19 +215,4 @@
 }
 
-static void tmpfs_instance_done(dev_handle_t dev_handle)
-{
-	unsigned long key[] = {
-		[NODES_KEY_DEV] = dev_handle
-	};
-	/*
-	 * Here we are making use of one special feature of our hash table
-	 * implementation, which allows to remove more items based on a partial
-	 * key match. In the following, we are going to remove all nodes
-	 * matching our device handle. The nodes_remove_callback() function will
-	 * take care of resource deallocation.
-	 */
-	hash_table_remove(&nodes, key, 1);
-}
-
 int tmpfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
 {
@@ -278,6 +237,6 @@
 {
 	unsigned long key[] = {
-		[NODES_KEY_DEV] = dev_handle,
-		[NODES_KEY_INDEX] = index
+		[NODES_KEY_INDEX] = index,
+		[NODES_KEY_DEV] = dev_handle
 	};
 	link_t *lnk = hash_table_find(&nodes, key);
@@ -337,6 +296,6 @@
 	/* Insert the new node into the nodes hash table. */
 	unsigned long key[] = {
-		[NODES_KEY_DEV] = nodep->dev_handle,
-		[NODES_KEY_INDEX] = nodep->index
+		[NODES_KEY_INDEX] = nodep->index,
+		[NODES_KEY_DEV] = nodep->dev_handle
 	};
 	hash_table_insert(&nodes, key, &nodep->nh_link);
@@ -353,13 +312,13 @@
 
 	unsigned long key[] = {
-		[NODES_KEY_DEV] = nodep->dev_handle,
-		[NODES_KEY_INDEX] = nodep->index
+		[NODES_KEY_INDEX] = nodep->index,
+		[NODES_KEY_DEV] = nodep->dev_handle
 	};
 	hash_table_remove(&nodes, key, 2);
 
-	/*
-	 * The nodes_remove_callback() function takes care of the actual
-	 * resource deallocation.
-	 */
+	if (nodep->type == TMPFS_FILE)
+		free(nodep->data);
+	free(nodep->bp);
+	free(nodep);
 	return EOK;
 }
@@ -465,5 +424,4 @@
 	/* Initialize TMPFS instance. */
 	if (!tmpfs_instance_init(dev_handle)) {
-		free(opts);
 		ipc_answer_0(rid, ENOMEM);
 		return;
@@ -484,5 +442,4 @@
 		    rootp->lnkcnt);
 	}
-	free(opts);
 }
 
@@ -490,17 +447,4 @@
 {
 	libfs_mount(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
-}
-
-void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request)
-{
-	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
-
-	tmpfs_instance_done(dev_handle);
-	ipc_answer_0(rid, EOK);
-}
-
-void tmpfs_unmount(ipc_callid_t rid, ipc_call_t *request)
-{
-	libfs_unmount(&tmpfs_libfs_ops, rid, request);
 }
 
@@ -521,6 +465,6 @@
 	link_t *hlp;
 	unsigned long key[] = {
+		[NODES_KEY_INDEX] = index,
 		[NODES_KEY_DEV] = dev_handle,
-		[NODES_KEY_INDEX] = index
 	};
 	hlp = hash_table_find(&nodes, key);
@@ -595,6 +539,6 @@
 	link_t *hlp;
 	unsigned long key[] = {
-		[NODES_KEY_DEV] = dev_handle,
-		[NODES_KEY_INDEX] = index
+		[NODES_KEY_INDEX] = index,
+		[NODES_KEY_DEV] = dev_handle
 	};
 	hlp = hash_table_find(&nodes, key);
@@ -659,6 +603,6 @@
 	link_t *hlp;
 	unsigned long key[] = {
-		[NODES_KEY_DEV] = dev_handle,
-		[NODES_KEY_INDEX] = index
+		[NODES_KEY_INDEX] = index,
+		[NODES_KEY_DEV] = dev_handle
 	};
 	hlp = hash_table_find(&nodes, key);
@@ -702,6 +646,6 @@
 	link_t *hlp;
 	unsigned long key[] = {
-		[NODES_KEY_DEV] = dev_handle,
-		[NODES_KEY_INDEX] = index
+		[NODES_KEY_INDEX] = index,
+		[NODES_KEY_DEV] = dev_handle
 	};
 	hlp = hash_table_find(&nodes, key);
