Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 8ccd2ea277c15d5df7f5e27ff901bafaa18515df)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision b5553a2369389ebef7f28ae29434069aa9df0fcc)
@@ -59,4 +59,7 @@
 #define DENTRIES_BUCKETS	256
 
+#define TMPFS_GET_INDEX(x)	(((tmpfs_dentry_t *)(x))->index)
+#define TMPFS_GET_LNKCNT(x)	1
+
 /*
  * Hash table of all directory entries.
@@ -128,17 +131,21 @@
 /** Compare one component of path to a directory entry.
  *
- * @param dentry	Directory entry to compare the path component with.
+ * @param nodep		Node to compare the path component with.
  * @param component	Array of characters holding component name.
  *
  * @return		True on match, false otherwise.
  */
-static bool match_component(tmpfs_dentry_t *dentry, const char *component)
-{
+static bool match_component(void *nodep, const char *component)
+{
+	tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
+
 	return !strcmp(dentry->name, component);
 }
 
-static unsigned long create_node(tmpfs_dentry_t *dentry,
+static void *create_node(void *nodep,
     const char *component, int lflag)
 {
+	tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
+
 	assert(dentry->type == TMPFS_DIRECTORY);
 	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
@@ -146,10 +153,10 @@
 	tmpfs_dentry_t *node = malloc(sizeof(tmpfs_dentry_t));
 	if (!node)
-		return 0;
+		return NULL;
 	size_t len = strlen(component);
 	char *name = malloc(len + 1);
 	if (!name) {
 		free(node);
-		return 0;
+		return NULL;
 	}
 	strcpy(name, component);
@@ -176,8 +183,8 @@
 	/* Insert the new node into the dentry hash table. */
 	hash_table_insert(&dentries, &node->index, &node->dh_link);
-	return node->index;
-}
-
-static int destroy_component(tmpfs_dentry_t *dentry)
+	return (void *) node;
+}
+
+static int destroy_component(void *nodeptr)
 {
 	return EPERM;
@@ -242,10 +249,11 @@
 					return;
 				} 
-				unsigned long index = create_node(dcur,
+				void *nodep = create_node(dcur,
 				    component, lflag);
-				if (index > 0) {
-					ipc_answer_4(rid, EOK,
+				if (nodep) {
+					ipc_answer_5(rid, EOK,
 					    tmpfs_reg.fs_handle, dev_handle,
-					    index, 0);
+					    TMPFS_GET_INDEX(nodep), 0,
+					    TMPFS_GET_LNKCNT(nodep));
 				} else {
 					ipc_answer_0(rid, ENOSPC);
@@ -289,9 +297,9 @@
 			len = 0;
 				
-			unsigned long index;
-			index = create_node(dcur, component, lflag);
-			if (index) {
-				ipc_answer_4(rid, EOK, tmpfs_reg.fs_handle,
-				    dev_handle, index, 0);
+			void *nodep = create_node(dcur, component, lflag);
+			if (nodep) {
+				ipc_answer_5(rid, EOK, tmpfs_reg.fs_handle,
+				    dev_handle, TMPFS_GET_INDEX(nodep), 0,
+				    TMPFS_GET_LNKCNT(nodep));
 			} else {
 				ipc_answer_0(rid, ENOSPC);
@@ -322,6 +330,6 @@
 	}
 
-	ipc_answer_4(rid, EOK, tmpfs_reg.fs_handle, dev_handle, dcur->index,
-	    dcur->size);
+	ipc_answer_5(rid, EOK, tmpfs_reg.fs_handle, dev_handle, dcur->index,
+	    dcur->size, TMPFS_GET_LNKCNT(dcur));
 }
 
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 8ccd2ea277c15d5df7f5e27ff901bafaa18515df)
+++ uspace/srv/vfs/vfs.h	(revision b5553a2369389ebef7f28ae29434069aa9df0fcc)
@@ -174,4 +174,5 @@
 	vfs_triplet_t triplet;
 	size_t size;
+	unsigned lnkcnt;
 } vfs_lookup_res_t;
 
@@ -182,5 +183,14 @@
 typedef struct {
 	VFS_TRIPLET;		/**< Identity of the node. */
-	unsigned refcnt;	/**< Usage counter. */
+
+	/**
+	 * Usage counter.  This includes, but is not limited to, all vfs_file_t
+	 * structures that reference this node.
+	 */
+	unsigned refcnt;
+	
+	/** Number of names this node has in the file system namespace. */
+	unsigned lnkcnt;
+
 	link_t nh_link;		/**< Node hash-table link. */
 	size_t size;		/**< Cached size of the file. */
Index: uspace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision 8ccd2ea277c15d5df7f5e27ff901bafaa18515df)
+++ uspace/srv/vfs/vfs_lookup.c	(revision b5553a2369389ebef7f28ae29434069aa9df0fcc)
@@ -169,4 +169,5 @@
 		result->triplet.index = (int) IPC_GET_ARG3(answer);
 		result->size = (size_t) IPC_GET_ARG4(answer);
+		result->lnkcnt = (unsigned) IPC_GET_ARG5(answer);
 	}
 
Index: uspace/srv/vfs/vfs_node.c
===================================================================
--- uspace/srv/vfs/vfs_node.c	(revision 8ccd2ea277c15d5df7f5e27ff901bafaa18515df)
+++ uspace/srv/vfs/vfs_node.c	(revision b5553a2369389ebef7f28ae29434069aa9df0fcc)
@@ -149,4 +149,5 @@
 		node->index = result->triplet.index;
 		node->size = result->size;
+		node->lnkcnt = result->lnkcnt;
 		link_initialize(&node->nh_link);
 		rwlock_initialize(&node->contents_rwlock);
@@ -157,4 +158,5 @@
 
 	assert(node->size == result->size);
+	assert(node->lnkcnt == result->lnkcnt);
 
 	_vfs_node_addref(node);
