Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -43,4 +43,5 @@
 #include <stdio.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <sys/types.h>
 #include <ipc/services.h>
@@ -892,21 +893,44 @@
 }
 
-int statfs(const char *path, struct statfs *buf)
-{
-	sysarg_t rc;
-	//aid_t req;
-
-	if ( NULL == buf )
-		return 1;
-
-	sysarg_t value;
-	async_exch_t *exch = vfs_exchange_begin();	
-	rc = async_req_0_1(exch, VFS_IN_STATFS, &value);
-	if (rc != EOK)
-		goto exit;
-
-	buf->f_bsize = value;
-exit:
-	vfs_exchange_end(exch);
+#include <stdio.h>
+int statfs(const char *path, struct statfs *statfs)
+{
+	sysarg_t rc;
+	sysarg_t rc_orig;
+	aid_t req;
+	size_t pa_size;
+	
+	char *pa = absolutize(path, &pa_size);
+	if (!pa)
+		return ENOMEM;
+	
+	async_exch_t *exch = vfs_exchange_begin();
+	
+	req = async_send_0(exch, VFS_IN_STATFS, NULL);
+	rc = async_data_write_start(exch, pa, pa_size);
+	if (rc != EOK) {
+		vfs_exchange_end(exch);
+		free(pa);
+		async_wait_for(req, &rc_orig);
+		if (rc_orig == EOK)
+			return (int) rc;
+		else
+			return (int) rc_orig;
+	}
+	printf("TRACE: send VFS_IN_STATFS\n");
+	rc = async_data_read_start(exch, statfs, sizeof(struct statfs));
+	if (rc != EOK) {
+		printf("TRACE: error reply\n");
+		vfs_exchange_end(exch);
+		free(pa);
+		async_wait_for(req, &rc_orig);
+		if (rc_orig == EOK)
+			return (int) rc;
+		else
+			return (int) rc_orig;
+	}
+	vfs_exchange_end(exch);
+	free(pa);
+	async_wait_for(req, &rc);
 	return rc;
 }
Index: uspace/lib/c/include/ipc/vfs.h
===================================================================
--- uspace/lib/c/include/ipc/vfs.h	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/c/include/ipc/vfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -99,5 +99,6 @@
 	VFS_OUT_LOOKUP,
 	VFS_OUT_DESTROY,
-	VFS_OUT_LAST
+	VFS_OUT_LAST,
+	VFS_OUT_STATFS
 } vfs_out_request_t;
 
Index: uspace/lib/c/include/sys/statfs.h
===================================================================
--- uspace/lib/c/include/sys/statfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
+++ uspace/lib/c/include/sys/statfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013 Manuele Conti
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_SYS_STATFS_H_
+#define LIBC_SYS_STATFS_H_
+
+#include <sys/types.h>
+
+struct statfs { 
+	short   f_type;     /* type of file system  */
+	long    f_bsize;    /* fundamental file system block size */
+	long    f_blocks;   /* total data blocks in file system */
+	long    f_bfree;    /* free blocks in fs */
+};
+
+extern int statfs(const char *, struct statfs *);
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/c/include/vfs/vfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -49,11 +49,4 @@
 };
 
-struct statfs { 
-	short   f_type;     /* type of file system  */
-	long    f_bsize;    /* fundamental file system block size */
-	long    f_blocks;   /* total data blocks in file system */
-	long    f_bfree;    /* free blocks in fs */
-};
-
 
 extern char *absolutize(const char *, size_t *);
@@ -70,5 +63,4 @@
 extern async_exch_t *vfs_exchange_begin(void);
 extern void vfs_exchange_end(async_exch_t *);
-extern int statfs(const char *path, struct statfs *buf);
 #endif
 
Index: uspace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/fs/libfs.c	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -45,4 +45,5 @@
 #include <mem.h>
 #include <sys/stat.h>
+#include <sys/statfs.h>
 #include <stdlib.h>
 
@@ -218,4 +219,35 @@
 	async_answer_0(rid, rc);
 }
+#include<stdio.h>
+static void vfs_out_statfs(ipc_callid_t rid, ipc_call_t *req)
+{	
+	printf("TRACE: vfs_out_statfs\n");
+	service_id_t service_id = (service_id_t) IPC_GET_ARG1(*req);
+	fs_index_t index = (fs_index_t) IPC_GET_ARG2(*req);
+	
+	fs_node_t *fn;
+	int rc = libfs_ops->node_get(&fn, service_id, index);
+	on_error(rc, answer_and_return(rid, rc));
+	
+	ipc_callid_t callid;
+	size_t size;
+	if ((!async_data_read_receive(&callid, &size)) ||
+	    (size != sizeof(struct stat))) {
+		libfs_ops->node_put(fn);
+		async_answer_0(callid, EINVAL);
+		async_answer_0(rid, EINVAL);
+		return;
+	}
+	
+	struct statfs statfs;
+	memset(&statfs, 0, sizeof(struct statfs));
+	
+	statfs.f_bsize = libfs_ops->size_block(service_id);
+
+	libfs_ops->node_put(fn);
+	
+	async_data_read_finalize(callid, &statfs, sizeof(struct statfs));
+	async_answer_0(rid, EOK);
+}
 
 static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
@@ -276,4 +308,7 @@
 		case VFS_OUT_SYNC:
 			vfs_out_sync(callid, &call);
+			break;
+		case VFS_OUT_STATFS:
+			vfs_out_statfs(callid, &call);
 			break;
 		default:
Index: uspace/lib/fs/libfs.h
===================================================================
--- uspace/lib/fs/libfs.h	(revision 663664703394632860eadef65798f751d575e737)
+++ uspace/lib/fs/libfs.h	(revision 9dc60836000ffdf197fc061f8e4b17e63ef4e2c8)
@@ -93,5 +93,5 @@
 	bool (* is_file)(fs_node_t *);
 	service_id_t (* service_get)(fs_node_t *);
-	unsigned int (* size_block)(fs_node_t *);
+	long (* size_block)(service_id_t);
 } libfs_ops_t;
 
