Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision c990ee69dc4e5007aa8d9fe493622ebd36134640)
+++ uspace/srv/vfs/vfs_ops.c	(revision 58898d1d7329ba67528bada931d3269d42936354)
@@ -343,8 +343,8 @@
 }
 
-typedef int (* rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, ipc_call_t *,
-    bool, void *);
-
-static int rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file,
+typedef int (* rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, aoff64_t,
+    ipc_call_t *, bool, void *);
+
+static int rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
     ipc_call_t *answer, bool read, void *data)
 {
@@ -363,9 +363,9 @@
 		rc = async_data_read_forward_4_1(exch, VFS_OUT_READ,
 		    file->node->service_id, file->node->index,
-		    LOWER32(file->pos), UPPER32(file->pos), answer);
+		    LOWER32(pos), UPPER32(pos), answer);
 	} else {
 		rc = async_data_write_forward_4_1(exch, VFS_OUT_WRITE,
 		    file->node->service_id, file->node->index,
-		    LOWER32(file->pos), UPPER32(file->pos), answer);
+		    LOWER32(pos), UPPER32(pos), answer);
 	}
 
@@ -374,5 +374,5 @@
 }
 
-static int rdwr_ipc_internal(async_exch_t *exch, vfs_file_t *file,
+static int rdwr_ipc_internal(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
     ipc_call_t *answer, bool read, void *data)
 {
@@ -383,6 +383,6 @@
 	
 	aid_t msg = async_send_fast(exch, read ? VFS_OUT_READ : VFS_OUT_WRITE,
-	    file->node->service_id, file->node->index, LOWER32(file->pos),
-	    UPPER32(file->pos), answer);
+	    file->node->service_id, file->node->index, LOWER32(pos),
+	    UPPER32(pos), answer);
 	if (msg == 0)
 		return EINVAL;
@@ -402,5 +402,6 @@
 }
 
-static int vfs_rdwr(int fd, bool read, rdwr_ipc_cb_t ipc_cb, void *ipc_cb_data)
+static int vfs_rdwr(int fd, aoff64_t pos, bool read, rdwr_ipc_cb_t ipc_cb,
+    void *ipc_cb_data)
 {
 	/*
@@ -463,6 +464,9 @@
 	async_exch_t *fs_exch = vfs_exchange_grab(file->node->fs_handle);
 	
-	if (!read && file->append)
-		file->pos = file->node->size;
+	if (!read && file->append) {
+		if (file->node->size == -1)
+			file->node->size = vfs_node_get_size(file->node);
+		pos = file->node->size;
+	}
 	
 	/*
@@ -470,9 +474,7 @@
 	 */
 	ipc_call_t answer;
-	int rc = ipc_cb(fs_exch, file, &answer, read, ipc_cb_data);
+	int rc = ipc_cb(fs_exch, file, pos, &answer, read, ipc_cb_data);
 	
 	vfs_exchange_release(fs_exch);
-	
-	size_t bytes = IPC_GET_ARG1(answer);
 	
 	if (file->node->type == VFS_NODE_DIRECTORY)
@@ -491,7 +493,4 @@
 	}
 	
-	/* Update the position pointer and unlock the open file. */
-	if (rc == EOK)
-		file->pos += bytes;
 	vfs_file_put(file);	
 
@@ -499,12 +498,12 @@
 }
 
-int vfs_rdwr_internal(int fd, bool read, rdwr_io_chunk_t *chunk)
-{
-	return vfs_rdwr(fd, read, rdwr_ipc_internal, chunk);
-}
-
-int vfs_op_read(int fd, size_t *out_bytes)
-{
-	return vfs_rdwr(fd, true, rdwr_ipc_client, out_bytes);
+int vfs_rdwr_internal(int fd, aoff64_t pos, bool read, rdwr_io_chunk_t *chunk)
+{
+	return vfs_rdwr(fd, pos, read, rdwr_ipc_internal, chunk);
+}
+
+int vfs_op_read(int fd, aoff64_t pos, size_t *out_bytes)
+{
+	return vfs_rdwr(fd, pos, true, rdwr_ipc_client, out_bytes);
 }
 
@@ -608,60 +607,4 @@
 	fibril_rwlock_write_unlock(&namespace_rwlock);
 	return EOK;
-}
-
-int vfs_op_seek(int fd, int64_t offset, int whence, int64_t *out_offset)
-{
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-	
-	switch (whence) {
-	case SEEK_SET:
-		if (offset < 0) {
-			vfs_file_put(file);
-			return EINVAL;
-		}
-		file->pos = offset;
-		*out_offset = offset;
-		vfs_file_put(file);
-		return EOK;
-	case SEEK_CUR:
-		if (offset > 0 && file->pos > (INT64_MAX - offset)) {
-			vfs_file_put(file);
-			return EOVERFLOW;
-		}
-		
-		if (offset < 0 && -file->pos > offset) {
-			vfs_file_put(file);
-			return EOVERFLOW;
-		}
-		
-		file->pos += offset;
-		*out_offset = file->pos;
-		vfs_file_put(file);
-		return EOK;
-	case SEEK_END:
-		fibril_rwlock_read_lock(&file->node->contents_rwlock);
-		int64_t size = vfs_node_get_size(file->node);
-		fibril_rwlock_read_unlock(&file->node->contents_rwlock);
-		
-		if (offset > 0 && size > (INT64_MAX - offset)) {
-			vfs_file_put(file);
-			return EOVERFLOW;
-		}
-		
-		if (offset < 0 && -size > offset) {
-			vfs_file_put(file);
-			return EOVERFLOW;
-		}
-		
-		file->pos = size + offset;
-		*out_offset = file->pos;
-		vfs_file_put(file);
-		return EOK;
-	}
-	
-	vfs_file_put(file);
-	return EINVAL;
 }
 
@@ -953,7 +896,7 @@
 }
 
-int vfs_op_write(int fd, size_t *out_bytes)
-{
-	return vfs_rdwr(fd, false, rdwr_ipc_client, out_bytes);
+int vfs_op_write(int fd, aoff64_t pos, size_t *out_bytes)
+{
+	return vfs_rdwr(fd, pos, false, rdwr_ipc_client, out_bytes);
 }
 
