Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 8ad8e497df247137deeedbbf79a2f30e414fdcff)
+++ uspace/srv/vfs/vfs.h	(revision 8476a8dc6175cdfacf21d51244b0a2ff45d4cd8f)
@@ -47,4 +47,9 @@
 #define IPC_METHOD_TO_VFS_OP(m)	((m) - VFS_FIRST)	
 
+/* Basic types. */
+typedef int16_t fs_handle_t;
+typedef int16_t dev_handle_t;
+typedef uint32_t fs_index_t;
+
 typedef enum {
 	VFS_READ = VFS_FIRST,
@@ -107,5 +112,5 @@
 	link_t fs_link;
 	vfs_info_t vfs_info;
-	int fs_handle;
+	fs_handle_t fs_handle;
 	futex_t phone_futex;	/**< Phone serializing futex. */
 	ipcarg_t phone;
@@ -115,7 +120,7 @@
  * VFS_PAIR uniquely represents a file system instance.
  */
-#define VFS_PAIR	\
-	int fs_handle;	\
-	int dev_handle;	
+#define VFS_PAIR		\
+	fs_handle_t fs_handle;	\
+	dev_handle_t dev_handle;
 
 /**
@@ -128,5 +133,5 @@
 #define VFS_TRIPLET	\
 	VFS_PAIR;	\
-	uint64_t index;
+	fs_index_t index;
 
 typedef struct {
@@ -257,8 +262,8 @@
 extern rwlock_t namespace_rwlock;
 
-extern int vfs_grab_phone(int);
+extern int vfs_grab_phone(fs_handle_t);
 extern void vfs_release_phone(int);
 
-extern int fs_name_to_handle(char *, bool);
+extern fs_handle_t fs_name_to_handle(char *, bool);
 
 extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, vfs_pair_t *,
Index: uspace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision 8ad8e497df247137deeedbbf79a2f30e414fdcff)
+++ uspace/srv/vfs/vfs_lookup.c	(revision 8476a8dc6175cdfacf21d51244b0a2ff45d4cd8f)
@@ -83,10 +83,10 @@
 		return EINVAL;
 	
-	uint64_t index = 0;
+	fs_index_t index = 0;
 	if (lflag & L_LINK) {
 		va_list ap;
 
 		va_start(ap, altroot);
-		index = va_arg(ap, uint64_t);
+		index = va_arg(ap, fs_index_t);
 		va_end(ap);
 	}
@@ -178,7 +178,7 @@
 
 	if ((rc == EOK) && result) {
-		result->triplet.fs_handle = (int) IPC_GET_ARG1(answer);
-		result->triplet.dev_handle = (int) IPC_GET_ARG2(answer);
-		result->triplet.index = (uint64_t) IPC_GET_ARG3(answer);
+		result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer);
+		result->triplet.dev_handle = (dev_handle_t) IPC_GET_ARG2(answer);
+		result->triplet.index = (fs_index_t) IPC_GET_ARG3(answer);
 		result->size = (size_t) IPC_GET_ARG4(answer);
 		result->lnkcnt = (unsigned) IPC_GET_ARG5(answer);
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 8ad8e497df247137deeedbbf79a2f30e414fdcff)
+++ uspace/srv/vfs/vfs_ops.c	(revision 8476a8dc6175cdfacf21d51244b0a2ff45d4cd8f)
@@ -54,5 +54,5 @@
 
 /* Forward declarations of static functions. */
-static int vfs_truncate_internal(int, int, unsigned long, size_t);
+static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t);
 
 /**
@@ -69,5 +69,7 @@
 };
 
-static int lookup_root(int fs_handle, int dev_handle, vfs_lookup_res_t *result)
+static int
+lookup_root(fs_handle_t fs_handle, dev_handle_t dev_handle,
+    vfs_lookup_res_t *result)
 {
 	vfs_pair_t altroot = {
@@ -81,5 +83,5 @@
 void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
 {
-	int dev_handle;
+	dev_handle_t dev_handle;
 	vfs_node_t *mp_node = NULL;
 
@@ -89,5 +91,5 @@
 	 * in the request.
 	 */
-	dev_handle = IPC_GET_ARG1(*request);
+	dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
 
 	/*
@@ -128,5 +130,5 @@
 	 * This will also give us its file system handle.
 	 */
-	int fs_handle = fs_name_to_handle(fs_name, true);
+	fs_handle_t fs_handle = fs_name_to_handle(fs_name, true);
 	if (!fs_handle) {
 		ipc_answer_0(rid, ENOENT);
@@ -572,6 +574,7 @@
 }
 
-int vfs_truncate_internal(int fs_handle, int dev_handle, unsigned long index,
-    size_t size)
+int
+vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle,
+    fs_index_t index, size_t size)
 {
 	ipcarg_t rc;
Index: uspace/srv/vfs/vfs_register.c
===================================================================
--- uspace/srv/vfs/vfs_register.c	(revision 8ad8e497df247137deeedbbf79a2f30e414fdcff)
+++ uspace/srv/vfs/vfs_register.c	(revision 8476a8dc6175cdfacf21d51244b0a2ff45d4cd8f)
@@ -295,5 +295,5 @@
 	 * system a global file system handle.
 	 */
-	fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next);
+	fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next);
 	ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle);
 	
@@ -312,5 +312,5 @@
  *			sent. Return 0 if no phone was found.
  */
-int vfs_grab_phone(int handle)
+int vfs_grab_phone(fs_handle_t handle)
 {
 	/*
@@ -387,5 +387,5 @@
  * @return		File system handle or zero if file system not found.
  */
-int fs_name_to_handle(char *name, bool lock)
+fs_handle_t fs_name_to_handle(char *name, bool lock)
 {
 	int handle = 0;
