Index: uspace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/bd/file_bd/file_bd.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -57,5 +57,5 @@
 
 static const size_t block_size = 512;
-static bn_t num_blocks;
+static aoff64_t num_blocks;
 static FILE *img;
 
@@ -210,6 +210,6 @@
 	/* Check whether access is within device address bounds. */
 	if (ba + cnt > num_blocks) {
-		printf(NAME ": Accessed blocks %" PRIuBN "-%" PRIuBN ", while "
-		    "max block number is %" PRIuBN ".\n", ba, ba + cnt - 1,
+		printf(NAME ": Accessed blocks %" PRIuOFF64 "-%" PRIuOFF64 ", while "
+		    "max block number is %" PRIuOFF64 ".\n", ba, ba + cnt - 1,
 		    num_blocks - 1);
 		return ELIMIT;
@@ -248,6 +248,6 @@
 	/* Check whether access is within device address bounds. */
 	if (ba + cnt > num_blocks) {
-		printf(NAME ": Accessed blocks %" PRIuBN "-%" PRIuBN ", while "
-		    "max block number is %" PRIuBN ".\n", ba, ba + cnt - 1,
+		printf(NAME ": Accessed blocks %" PRIuOFF64 "-%" PRIuOFF64 ", while "
+		    "max block number is %" PRIuOFF64 ".\n", ba, ba + cnt - 1,
 		    num_blocks - 1);
 		return ELIMIT;
Index: uspace/srv/bd/part/guid_part/guid_part.c
===================================================================
--- uspace/srv/bd/part/guid_part/guid_part.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/bd/part/guid_part/guid_part.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -79,7 +79,7 @@
 	bool present;
 	/** Address of first block */
-	bn_t start_addr;
+	aoff64_t start_addr;
 	/** Number of blocks */
-	bn_t length;
+	aoff64_t length;
 	/** Device representing the partition (outbound device) */
 	dev_handle_t dev;
@@ -101,7 +101,7 @@
 static void gpt_pte_to_part(const gpt_entry_t *pte, part_t *part);
 static void gpt_connection(ipc_callid_t iid, ipc_call_t *icall);
-static int gpt_bd_read(part_t *p, bn_t ba, size_t cnt, void *buf);
-static int gpt_bd_write(part_t *p, bn_t ba, size_t cnt, const void *buf);
-static int gpt_bsa_translate(part_t *p, bn_t ba, size_t cnt, bn_t *gba);
+static int gpt_bd_read(part_t *p, aoff64_t ba, size_t cnt, void *buf);
+static int gpt_bd_write(part_t *p, aoff64_t ba, size_t cnt, const void *buf);
+static int gpt_bsa_translate(part_t *p, aoff64_t ba, size_t cnt, aoff64_t *gba);
 
 int main(int argc, char **argv)
@@ -199,5 +199,5 @@
 		    / (1024 * 1024);
 		printf(NAME ": Registered device %s: %" PRIu64 " blocks "
-		    "%" PRIuBN " MB.\n", name, part->length, size_mb);
+		    "%" PRIuOFF64 " MB.\n", name, part->length, size_mb);
 
 		part->dev = dev;
@@ -319,5 +319,5 @@
 	int flags;
 	int retval;
-	bn_t ba;
+	aoff64_t ba;
 	size_t cnt;
 	part_t *part;
@@ -402,7 +402,7 @@
 
 /** Read blocks from partition. */
-static int gpt_bd_read(part_t *p, bn_t ba, size_t cnt, void *buf)
-{
-	bn_t gba;
+static int gpt_bd_read(part_t *p, aoff64_t ba, size_t cnt, void *buf)
+{
+	aoff64_t gba;
 
 	if (gpt_bsa_translate(p, ba, cnt, &gba) != EOK)
@@ -413,7 +413,7 @@
 
 /** Write blocks to partition. */
-static int gpt_bd_write(part_t *p, bn_t ba, size_t cnt, const void *buf)
-{
-	bn_t gba;
+static int gpt_bd_write(part_t *p, aoff64_t ba, size_t cnt, const void *buf)
+{
+	aoff64_t gba;
 
 	if (gpt_bsa_translate(p, ba, cnt, &gba) != EOK)
@@ -424,5 +424,5 @@
 
 /** Translate block segment address with range checking. */
-static int gpt_bsa_translate(part_t *p, bn_t ba, size_t cnt, bn_t *gba)
+static int gpt_bsa_translate(part_t *p, aoff64_t ba, size_t cnt, aoff64_t *gba)
 {
 	if (ba + cnt > p->length)
Index: uspace/srv/bd/part/mbr_part/mbr_part.c
===================================================================
--- uspace/srv/bd/part/mbr_part/mbr_part.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/bd/part/mbr_part/mbr_part.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -97,7 +97,7 @@
 	bool present;
 	/** Address of first block */
-	bn_t start_addr;
+	aoff64_t start_addr;
 	/** Number of blocks */
-	bn_t length;
+	aoff64_t length;
 	/** Device representing the partition (outbound device) */
 	dev_handle_t dev;
@@ -249,5 +249,5 @@
 		size_mb = (part->length * block_size + 1024 * 1024 - 1)
 		    / (1024 * 1024);
-		printf(NAME ": Registered device %s: %" PRIuBN " blocks "
+		printf(NAME ": Registered device %s: %" PRIuOFF64 " blocks "
 		    "%" PRIu64 " MB.\n", name, part->length, size_mb);
 
Index: uspace/srv/clip/clip.c
===================================================================
--- uspace/srv/clip/clip.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/clip/clip.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -145,5 +145,5 @@
 	
 	fibril_mutex_unlock(&clip_mtx);
-	ipc_answer_2(rid, EOK, (ipcarg_t) size, (ipcarg_t) clip_tag);
+	ipc_answer_2(rid, EOK, (ipcarg_t) size, (ipcarg_t) tag);
 }
 
Index: uspace/srv/fs/devfs/devfs_ops.c
===================================================================
--- uspace/srv/fs/devfs/devfs_ops.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/devfs/devfs_ops.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -37,4 +37,5 @@
 
 #include <ipc/ipc.h>
+#include <macros.h>
 #include <bool.h>
 #include <errno.h>
@@ -337,5 +338,5 @@
 }
 
-static size_t devfs_size_get(fs_node_t *fn)
+static aoff64_t devfs_size_get(fs_node_t *fn)
 {
 	return 0;
@@ -463,5 +464,6 @@
 {
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
-	off_t pos = (off_t) IPC_GET_ARG3(*request);
+	aoff64_t pos =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
 	
 	if (index == 0) {
@@ -597,6 +599,4 @@
 {
 	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
-	off_t pos = (off_t) IPC_GET_ARG3(*request);
-	
 	if (index == 0) {
 		ipc_answer_0(rid, ENOTSUP);
Index: uspace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/fat/fat.h	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -89,5 +89,5 @@
 			uint16_t	signature;
 		} __attribute__ ((packed));
-		struct fat32 {
+		struct {
 			/* FAT32 only */
 			/** Sectors per FAT. */
@@ -119,6 +119,6 @@
 			/** Signature. */
 			uint16_t	signature;
-		} __attribute__ ((packed));
-	}; 
+		} fat32 __attribute__ ((packed));
+	};
 } __attribute__ ((packed)) fat_bs_t;
 
@@ -194,5 +194,5 @@
 	/** FAT in-core node free list link. */
 	link_t			ffn_link;
-	size_t			size;
+	aoff64_t		size;
 	unsigned		lnkcnt;
 	unsigned		refcnt;
Index: uspace/srv/fs/fat/fat_dentry.c
===================================================================
--- uspace/srv/fs/fat/fat_dentry.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/fat/fat_dentry.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -82,5 +82,6 @@
 bool fat_dentry_name_verify(const char *name)
 {
-	unsigned i, dot;
+	unsigned int i;
+	unsigned int dot = 0;
 	bool dot_found = false;
 	
Index: uspace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/fat/fat_fat.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -93,5 +93,5 @@
 
 	while (clst < FAT_CLST_LAST1 && clusters < max_clusters) {
-		bn_t fsec;	/* sector offset relative to FAT1 */
+		aoff64_t fsec;	/* sector offset relative to FAT1 */
 		unsigned fidx;	/* FAT1 entry index */
 
@@ -135,5 +135,5 @@
 int
 _fat_block_get(block_t **block, fat_bs_t *bs, dev_handle_t dev_handle,
-    fat_cluster_t firstc, bn_t bn, int flags)
+    fat_cluster_t firstc, aoff64_t bn, int flags)
 {
 	unsigned bps;
@@ -196,10 +196,10 @@
  * @return		EOK on success or a negative error code.
  */
-int fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, off_t pos)
+int fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, aoff64_t pos)
 {
 	uint16_t bps;
 	unsigned spc;
 	block_t *b;
-	off_t o, boundary;
+	aoff64_t o, boundary;
 	int rc;
 
Index: uspace/srv/fs/fat/fat_fat.h
===================================================================
--- uspace/srv/fs/fat/fat_fat.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/fat/fat_fat.h	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -69,6 +69,6 @@
 
 extern int _fat_block_get(block_t **, struct fat_bs *, dev_handle_t,
-    fat_cluster_t, bn_t, int);
-  
+    fat_cluster_t, aoff64_t, int);
+
 extern int fat_append_clusters(struct fat_bs *, struct fat_node *,
     fat_cluster_t);
@@ -85,5 +85,5 @@
     fat_cluster_t, fat_cluster_t);
 extern int fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
-    off_t);
+    aoff64_t);
 extern int fat_zero_cluster(struct fat_bs *, dev_handle_t, fat_cluster_t);
 extern int fat_sanity_check(struct fat_bs *, dev_handle_t);
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/fat/fat_ops.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -45,4 +45,5 @@
 #include <ipc/services.h>
 #include <ipc/devmap.h>
+#include <macros.h>
 #include <async.h>
 #include <errno.h>
@@ -79,5 +80,5 @@
 static int fat_has_children(bool *, fs_node_t *);
 static fs_index_t fat_index_get(fs_node_t *);
-static size_t fat_size_get(fs_node_t *);
+static aoff64_t fat_size_get(fs_node_t *);
 static unsigned fat_lnkcnt_get(fs_node_t *);
 static char fat_plb_get_char(unsigned);
@@ -738,10 +739,10 @@
 			goto skip_dots;
 		}
-		d = (fat_dentry_t *)b->data;
-		if (fat_classify_dentry(d) == FAT_DENTRY_LAST ||
-		    str_cmp(d->name, FAT_NAME_DOT) == 0) {
+		d = (fat_dentry_t *) b->data;
+		if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) ||
+		    (str_cmp((char *) d->name, FAT_NAME_DOT)) == 0) {
 			memset(d, 0, sizeof(fat_dentry_t));
-			str_cpy(d->name, 8, FAT_NAME_DOT);
-			str_cpy(d->ext, 3, FAT_EXT_PAD);
+			str_cpy((char *) d->name, 8, FAT_NAME_DOT);
+			str_cpy((char *) d->ext, 3, FAT_EXT_PAD);
 			d->attr = FAT_ATTR_SUBDIR;
 			d->firstc = host2uint16_t_le(childp->firstc);
@@ -749,9 +750,9 @@
 		}
 		d++;
-		if (fat_classify_dentry(d) == FAT_DENTRY_LAST ||
-		    str_cmp(d->name, FAT_NAME_DOT_DOT) == 0) {
+		if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) ||
+		    (str_cmp((char *) d->name, FAT_NAME_DOT_DOT) == 0)) {
 			memset(d, 0, sizeof(fat_dentry_t));
-			str_cpy(d->name, 8, FAT_NAME_DOT_DOT);
-			str_cpy(d->ext, 3, FAT_EXT_PAD);
+			str_cpy((char *) d->name, 8, FAT_NAME_DOT_DOT);
+			str_cpy((char *) d->ext, 3, FAT_EXT_PAD);
 			d->attr = FAT_ATTR_SUBDIR;
 			d->firstc = (parentp->firstc == FAT_CLST_ROOT) ?
@@ -915,5 +916,5 @@
 }
 
-size_t fat_size_get(fs_node_t *fn)
+aoff64_t fat_size_get(fs_node_t *fn)
 {
 	return FAT_NODE(fn)->size;
@@ -1157,7 +1158,8 @@
 void fat_read(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
-	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	off_t pos = (off_t)IPC_GET_ARG3(*request);
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	aoff64_t pos =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
 	fs_node_t *fn;
 	fat_node_t *nodep;
@@ -1223,5 +1225,5 @@
 	} else {
 		unsigned bnum;
-		off_t spos = pos;
+		aoff64_t spos = pos;
 		char name[FAT_NAME_LEN + 1 + FAT_EXT_LEN + 1];
 		fat_dentry_t *d;
@@ -1239,5 +1241,5 @@
 		bnum = (pos * sizeof(fat_dentry_t)) / bps;
 		while (bnum < nodep->size / bps) {
-			off_t o;
+			aoff64_t o;
 
 			rc = fat_block_get(&b, bs, nodep, bnum,
@@ -1295,7 +1297,8 @@
 void fat_write(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
-	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	off_t pos = (off_t)IPC_GET_ARG3(*request);
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	aoff64_t pos =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
 	fs_node_t *fn;
 	fat_node_t *nodep;
@@ -1306,5 +1309,5 @@
 	unsigned spc;
 	unsigned bpc;		/* bytes per cluster */
-	off_t boundary;
+	aoff64_t boundary;
 	int flags = BLOCK_FLAGS_NONE;
 	int rc;
@@ -1452,7 +1455,8 @@
 void fat_truncate(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
-	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	size_t size = (off_t)IPC_GET_ARG3(*request);
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	aoff64_t size =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
 	fs_node_t *fn;
 	fat_node_t *nodep;
Index: uspace/srv/fs/tmpfs/tmpfs.h
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/tmpfs/tmpfs.h	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -29,5 +29,5 @@
 /** @addtogroup fs
  * @{
- */ 
+ */
 
 #ifndef TMPFS_TMPFS_H_
@@ -40,8 +40,4 @@
 #include <bool.h>
 #include <adt/hash_table.h>
-
-#ifndef dprintf
-#define dprintf(...)	printf(__VA_ARGS__)
-#endif
 
 #define TMPFS_NODE(node)	((node) ? (tmpfs_node_t *)(node)->data : NULL)
Index: uspace/srv/fs/tmpfs/tmpfs_dump.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_dump.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/tmpfs/tmpfs_dump.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -55,6 +55,6 @@
 
 static bool
-tmpfs_restore_recursion(dev_handle_t dev, off_t *bufpos, size_t *buflen,
-    off_t *pos, fs_node_t *pfn)
+tmpfs_restore_recursion(dev_handle_t dev, size_t *bufpos, size_t *buflen,
+    aoff64_t *pos, fs_node_t *pfn)
 {
 	struct rdentry entry;
@@ -171,7 +171,7 @@
 		return false; 
 	
-	off_t bufpos = 0;
+	size_t bufpos = 0;
 	size_t buflen = 0;
-	off_t pos = 0;
+	aoff64_t pos = 0;
 	
 	char tag[6];
Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -29,5 +29,5 @@
 /** @addtogroup fs
  * @{
- */ 
+ */
 
 /**
@@ -40,4 +40,6 @@
 #include "../../vfs/vfs.h"
 #include <ipc/ipc.h>
+#include <macros.h>
+#include <limits.h>
 #include <async.h>
 #include <errno.h>
@@ -93,5 +95,5 @@
 }
 
-static size_t tmpfs_size_get(fs_node_t *fn)
+static aoff64_t tmpfs_size_get(fs_node_t *fn)
 {
 	return TMPFS_NODE(fn)->size;
@@ -509,8 +511,9 @@
 void tmpfs_read(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
-	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	off_t pos = (off_t)IPC_GET_ARG3(*request);
-
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	aoff64_t pos =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
+	
 	/*
 	 * Lookup the respective TMPFS node.
@@ -528,5 +531,5 @@
 	tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
 	    nh_link);
-
+	
 	/*
 	 * Receive the read request.
@@ -535,5 +538,5 @@
 	size_t size;
 	if (!async_data_read_receive(&callid, &size)) {
-		ipc_answer_0(callid, EINVAL);	
+		ipc_answer_0(callid, EINVAL);
 		ipc_answer_0(rid, EINVAL);
 		return;
@@ -542,5 +545,5 @@
 	size_t bytes;
 	if (nodep->type == TMPFS_FILE) {
-		bytes = max(0, min(nodep->size - pos, size));
+		bytes = min(nodep->size - pos, size);
 		(void) async_data_read_finalize(callid, nodep->data + pos,
 		    bytes);
@@ -548,5 +551,5 @@
 		tmpfs_dentry_t *dentryp;
 		link_t *lnk;
-		int i;
+		aoff64_t i;
 		
 		assert(nodep->type == TMPFS_DIRECTORY);
@@ -558,5 +561,5 @@
 		 */
 		for (i = 0, lnk = nodep->cs_head.next;
-		    i < pos && lnk != &nodep->cs_head;
+		    (i < pos) && (lnk != &nodep->cs_head);
 		    i++, lnk = lnk->next)
 			;
@@ -583,8 +586,9 @@
 void tmpfs_write(ipc_callid_t rid, ipc_call_t *request)
 {
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
-	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	off_t pos = (off_t)IPC_GET_ARG3(*request);
-
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	aoff64_t pos =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
+	
 	/*
 	 * Lookup the respective TMPFS node.
@@ -647,11 +651,61 @@
 void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request)
 {
+	dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
+	aoff64_t size =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
+	
+	/*
+	 * Lookup the respective TMPFS node.
+	 */
+	unsigned long key[] = {
+		[NODES_KEY_DEV] = dev_handle,
+		[NODES_KEY_INDEX] = index
+	};
+	link_t *hlp = hash_table_find(&nodes, key);
+	if (!hlp) {
+		ipc_answer_0(rid, ENOENT);
+		return;
+	}
+	tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
+	    nh_link);
+	
+	if (size == nodep->size) {
+		ipc_answer_0(rid, EOK);
+		return;
+	}
+	
+	if (size > SIZE_MAX) {
+		ipc_answer_0(rid, ENOMEM);
+		return;
+	}
+	
+	void *newdata = realloc(nodep->data, size);
+	if (!newdata) {
+		ipc_answer_0(rid, ENOMEM);
+		return;
+	}
+	
+	if (size > nodep->size) {
+		size_t delta = size - nodep->size;
+		memset(newdata + nodep->size, 0, delta);
+	}
+	
+	nodep->size = size;
+	nodep->data = newdata;
+	ipc_answer_0(rid, EOK);
+}
+
+void tmpfs_close(ipc_callid_t rid, ipc_call_t *request)
+{
+	ipc_answer_0(rid, EOK);
+}
+
+void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
+{
 	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
 	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	size_t size = (off_t)IPC_GET_ARG3(*request);
-
-	/*
-	 * Lookup the respective TMPFS node.
-	 */
+	int rc;
+
 	link_t *hlp;
 	unsigned long key[] = {
@@ -666,47 +720,4 @@
 	tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
 	    nh_link);
-
-	if (size == nodep->size) {
-		ipc_answer_0(rid, EOK);
-		return;
-	}
-
-	void *newdata = realloc(nodep->data, size);
-	if (!newdata) {
-		ipc_answer_0(rid, ENOMEM);
-		return;
-	}
-	if (size > nodep->size) {
-		size_t delta = size - nodep->size;
-		memset(newdata + nodep->size, 0, delta);
-	}
-	nodep->size = size;
-	nodep->data = newdata;
-	ipc_answer_0(rid, EOK);
-}
-
-void tmpfs_close(ipc_callid_t rid, ipc_call_t *request)
-{
-	ipc_answer_0(rid, EOK);
-}
-
-void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
-{
-	dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
-	fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
-	int rc;
-
-	link_t *hlp;
-	unsigned long key[] = {
-		[NODES_KEY_DEV] = dev_handle,
-		[NODES_KEY_INDEX] = index
-	};
-	hlp = hash_table_find(&nodes, key);
-	if (!hlp) {
-		ipc_answer_0(rid, ENOENT);
-		return;
-	}
-	tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
-	    nh_link);
 	rc = tmpfs_destroy_node(FS_NODE(nodep));
 	ipc_answer_0(rid, rc);
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/vfs/vfs.h	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -42,8 +42,7 @@
 #include <ipc/vfs.h>
 
-// FIXME: according to CONFIG_DEBUG
-// #define dprintf(...)  printf(__VA_ARGS__)
-
-#define dprintf(...)
+#ifndef dprintf
+	#define dprintf(...)
+#endif
 
 /**
@@ -93,6 +92,6 @@
 	vfs_triplet_t triplet;
 	vfs_node_type_t type;
-	size_t size;
-	unsigned lnkcnt;
+	aoff64_t size;
+	unsigned int lnkcnt;
 } vfs_lookup_res_t;
 
@@ -117,5 +116,5 @@
 	vfs_node_type_t type;	/**< Partial info about the node type. */
 
-	size_t size;		/**< Cached size if the node is a file. */
+	aoff64_t size;		/**< Cached size if the node is a file. */
 
 	/**
@@ -141,6 +140,6 @@
 	bool append;
 
-	/** Current position in the file. */
-	off_t pos;
+	/** Current absolute position in the file. */
+	aoff64_t pos;
 } vfs_file_t;
 
@@ -214,5 +213,4 @@
 extern void vfs_truncate(ipc_callid_t, ipc_call_t *);
 extern void vfs_fstat(ipc_callid_t, ipc_call_t *);
-extern void vfs_fstat(ipc_callid_t, ipc_call_t *);
 extern void vfs_stat(ipc_callid_t, ipc_call_t *);
 extern void vfs_mkdir(ipc_callid_t, ipc_call_t *);
Index: uspace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/vfs/vfs_lookup.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -38,4 +38,5 @@
 #include "vfs.h"
 #include <ipc/ipc.h>
+#include <macros.h>
 #include <async.h>
 #include <errno.h>
@@ -99,6 +100,6 @@
 	entry.len = len;
 
-	off_t first;	/* the first free index */
-	off_t last;	/* the last free index */
+	size_t first;	/* the first free index */
+	size_t last;	/* the last free index */
 
 	if (list_empty(&plb_head)) {
@@ -177,20 +178,23 @@
 	memset(plb, 0, cnt2);
 	fibril_mutex_unlock(&plb_mutex);
-
-	if ((rc == EOK) && (result)) {
-		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);
-		if (lflag & L_FILE)
-			result->type = VFS_NODE_FILE;
-		else if (lflag & L_DIRECTORY)
-			result->type = VFS_NODE_DIRECTORY;
-		else
-			result->type = VFS_NODE_UNKNOWN;
-	}
-
-	return rc;
+	
+	if (((int) rc < EOK) || (!result))
+		return (int) rc;
+	
+	result->triplet.fs_handle = (fs_handle_t) rc;
+	result->triplet.dev_handle = (dev_handle_t) IPC_GET_ARG1(answer);
+	result->triplet.index = (fs_index_t) IPC_GET_ARG2(answer);
+	result->size =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(answer), IPC_GET_ARG4(answer));
+	result->lnkcnt = (unsigned int) IPC_GET_ARG5(answer);
+	
+	if (lflag & L_FILE)
+		result->type = VFS_NODE_FILE;
+	else if (lflag & L_DIRECTORY)
+		result->type = VFS_NODE_DIRECTORY;
+	else
+		result->type = VFS_NODE_UNKNOWN;
+	
+	return EOK;
 }
 
@@ -214,9 +218,10 @@
 	
 	if (rc == EOK) {
-		result->size = (size_t) IPC_GET_ARG1(answer);
-		result->lnkcnt = (unsigned) IPC_GET_ARG2(answer);
-		if (IPC_GET_ARG3(answer) & L_FILE)
+		result->size =
+		    MERGE_LOUP32(IPC_GET_ARG1(answer), IPC_GET_ARG2(answer));
+		result->lnkcnt = (unsigned int) IPC_GET_ARG3(answer);
+		if (IPC_GET_ARG4(answer) & L_FILE)
 			result->type = VFS_NODE_FILE;
-		else if (IPC_GET_ARG3(answer) & L_DIRECTORY)
+		else if (IPC_GET_ARG4(answer) & L_DIRECTORY)
 			result->type = VFS_NODE_DIRECTORY;
 		else
Index: uspace/srv/vfs/vfs_node.c
===================================================================
--- uspace/srv/vfs/vfs_node.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/vfs/vfs_node.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -242,5 +242,5 @@
 {
 	vfs_node_t *node = hash_table_get_instance(item, vfs_node_t, nh_link);
-	return (node->fs_handle == key[KEY_FS_HANDLE]) &&
+	return (node->fs_handle == (fs_handle_t) key[KEY_FS_HANDLE]) &&
 	    (node->dev_handle == key[KEY_DEV_HANDLE]) &&
 	    (node->index == key[KEY_INDEX]);
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
+++ uspace/srv/vfs/vfs_ops.c	(revision ed90317444652a29e89501a128d66020aaea52b5)
@@ -38,4 +38,6 @@
 #include "vfs.h"
 #include <ipc/ipc.h>
+#include <macros.h>
+#include <limits.h>
 #include <async.h>
 #include <errno.h>
@@ -53,5 +55,5 @@
 
 /* Forward declarations of static functions. */
-static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t);
+static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, aoff64_t);
 
 /**
@@ -353,5 +355,4 @@
 	vfs_lookup_res_t mp_res;
 	vfs_lookup_res_t mr_res;
-	vfs_node_t *mp_node;
 	vfs_node_t *mr_node;
 	int phone;
@@ -503,5 +504,4 @@
 	int oflag = IPC_GET_ARG2(*request);
 	int mode = IPC_GET_ARG3(*request);
-	size_t len;
 
 	/* Ignore mode for now. */
@@ -887,8 +887,8 @@
 {
 	int fd = (int) IPC_GET_ARG1(*request);
-	off_t off = (off_t) IPC_GET_ARG2(*request);
-	int whence = (int) IPC_GET_ARG3(*request);
-
-
+	off64_t off =
+	    (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request));
+	int whence = (int) IPC_GET_ARG4(*request);
+	
 	/* Lookup the file structure corresponding to the file descriptor. */
 	vfs_file_t *file = vfs_file_get(fd);
@@ -897,47 +897,69 @@
 		return;
 	}
-
-	off_t newpos;
+	
 	fibril_mutex_lock(&file->lock);
-	if (whence == SEEK_SET) {
-		file->pos = off;
-		fibril_mutex_unlock(&file->lock);
-		ipc_answer_1(rid, EOK, off);
-		return;
-	}
-	if (whence == SEEK_CUR) {
-		if (file->pos + off < file->pos) {
+	
+	off64_t newoff;
+	switch (whence) {
+		case SEEK_SET:
+			if (off >= 0) {
+				file->pos = (aoff64_t) off;
+				fibril_mutex_unlock(&file->lock);
+				ipc_answer_1(rid, EOK, off);
+				return;
+			}
+			break;
+		case SEEK_CUR:
+			if ((off >= 0) && (file->pos + off < file->pos)) {
+				fibril_mutex_unlock(&file->lock);
+				ipc_answer_0(rid, EOVERFLOW);
+				return;
+			}
+			
+			if ((off < 0) && (file->pos < (aoff64_t) -off)) {
+				fibril_mutex_unlock(&file->lock);
+				ipc_answer_0(rid, EOVERFLOW);
+				return;
+			}
+			
+			file->pos += off;
+			newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos;
+			
 			fibril_mutex_unlock(&file->lock);
-			ipc_answer_0(rid, EOVERFLOW);
+			ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
 			return;
-		}
-		file->pos += off;
-		newpos = file->pos;
-		fibril_mutex_unlock(&file->lock);
-		ipc_answer_1(rid, EOK, newpos);
-		return;
-	}
-	if (whence == SEEK_END) {
-		fibril_rwlock_read_lock(&file->node->contents_rwlock);
-		size_t size = file->node->size;
-		fibril_rwlock_read_unlock(&file->node->contents_rwlock);
-		if (size + off < size) {
+		case SEEK_END:
+			fibril_rwlock_read_lock(&file->node->contents_rwlock);
+			aoff64_t size = file->node->size;
+			
+			if ((off >= 0) && (size + off < size)) {
+				fibril_rwlock_read_unlock(&file->node->contents_rwlock);
+				fibril_mutex_unlock(&file->lock);
+				ipc_answer_0(rid, EOVERFLOW);
+				return;
+			}
+			
+			if ((off < 0) && (size < (aoff64_t) -off)) {
+				fibril_rwlock_read_unlock(&file->node->contents_rwlock);
+				fibril_mutex_unlock(&file->lock);
+				ipc_answer_0(rid, EOVERFLOW);
+				return;
+			}
+			
+			file->pos = size + off;
+			newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos;
+			
+			fibril_rwlock_read_unlock(&file->node->contents_rwlock);
 			fibril_mutex_unlock(&file->lock);
-			ipc_answer_0(rid, EOVERFLOW);
+			ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff));
 			return;
-		}
-		newpos = size + off;
-		file->pos = newpos;
-		fibril_mutex_unlock(&file->lock);
-		ipc_answer_1(rid, EOK, newpos);
-		return;
-	}
+	}
+	
 	fibril_mutex_unlock(&file->lock);
 	ipc_answer_0(rid, EINVAL);
 }
 
-int
-vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle,
-    fs_index_t index, size_t size)
+int vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle,
+    fs_index_t index, aoff64_t size)
 {
 	ipcarg_t rc;
@@ -945,6 +967,6 @@
 	
 	fs_phone = vfs_grab_phone(fs_handle);
-	rc = async_req_3_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t)dev_handle,
-	    (ipcarg_t)index, (ipcarg_t)size);
+	rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t) dev_handle,
+	    (ipcarg_t) index, LOWER32(size), UPPER32(size));
 	vfs_release_phone(fs_phone);
 	return (int)rc;
@@ -954,5 +976,6 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	size_t size = IPC_GET_ARG2(*request);
+	aoff64_t size =
+	    (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), IPC_GET_ARG3(*request));
 	int rc;
 
