Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -33,5 +33,4 @@
 #include <getopt.h>
 #include <str.h>
-#include <fcntl.h>
 #include <io/console.h>
 #include <io/color.h>
@@ -196,5 +195,5 @@
 		blen = STR_BOUNDS(1);
 	} else
-		fd = open(fname, O_RDONLY);
+		fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
 	
 	if (fd < 0) {
Index: uspace/app/bdsh/cmds/modules/cmp/cmp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -28,5 +28,4 @@
 
 #include <errno.h>
-#include <fcntl.h>
 #include <getopt.h>
 #include <mem.h>
@@ -82,7 +81,7 @@
 
 	for (int i = 0; i < 2; i++) {
-		fd[i] = open(fn[i], O_RDONLY);
+		fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ);
 		if (fd[i] < 0) {
-			rc = errno;
+			rc = fd[i];
 			printf("Unable to open %s\n", fn[i]);
 			goto end;
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -35,5 +35,4 @@
 #include <getopt.h>
 #include <str.h>
-#include <fcntl.h>
 #include <vfs/vfs.h>
 #include <dirent.h>
@@ -383,10 +382,12 @@
 		printf("Copying %s to %s\n", src, dest);
 
-	if (-1 == (fd1 = open(src, O_RDONLY))) {
+	fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ);
+	if (fd1 < 0) {
 		printf("Unable to open source file %s\n", src);
 		return -1;
 	}
 
-	if (-1 == (fd2 = open(dest, O_WRONLY | O_CREAT))) {
+	fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
+	if (fd2 < 0) {
 		printf("Unable to open destination file %s\n", dest);
 		close(fd1);
Index: uspace/app/bdsh/cmds/modules/ls/ls.c
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/ls/ls.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -36,5 +36,4 @@
 #include <unistd.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <getopt.h>
 #include <sys/types.h>
Index: uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -30,5 +30,4 @@
 #include <stdlib.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <sys/types.h>
 #include <getopt.h>
Index: uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -31,5 +31,4 @@
 #include <stdlib.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <sys/types.h>
 #include <macros.h>
@@ -38,4 +37,5 @@
 #include <str.h>
 #include <ctype.h>
+#include <vfs/vfs.h>
 
 #include "config.h"
@@ -156,5 +156,5 @@
 	file_name = argv[optind];
 
-	fd = open(file_name, O_CREAT | O_EXCL | O_WRONLY, 0666);
+	fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE);
 	if (fd < 0) {
 		printf("%s: failed to create file %s.\n", cmdname, file_name);
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -31,5 +31,4 @@
 #include <stdlib.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <dirent.h>
 #include <getopt.h>
@@ -151,5 +150,5 @@
 	}
 
-	fd = open(path, O_RDONLY);
+	fd = vfs_lookup(path, WALK_REGULAR);
 	if (fd >= 0) {
 		close(fd);
Index: uspace/app/bdsh/cmds/modules/touch/touch.c
===================================================================
--- uspace/app/bdsh/cmds/modules/touch/touch.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/cmds/modules/touch/touch.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -35,5 +35,4 @@
 #include <stdlib.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <dirent.h>
 #include <sys/types.h>
@@ -125,5 +124,5 @@
 		if ((!no_create) ||
 		    ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) {
-			fd = open(buff, O_RDWR | O_CREAT);
+			fd = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE);
 		}
 		
Index: uspace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/bdsh/exec.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -37,5 +37,4 @@
 #include <unistd.h>
 #include <str.h>
-#include <fcntl.h>
 #include <str_error.h>
 #include <errno.h>
@@ -60,5 +59,5 @@
 	int fd;
 
-	fd = open(f, O_RDONLY);
+	fd = vfs_lookup_open(f, WALK_REGULAR, MODE_READ);
 	if (fd >= 0) {
 		close(fd);
Index: uspace/app/fontviewer/fontviewer.c
===================================================================
--- uspace/app/fontviewer/fontviewer.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/fontviewer/fontviewer.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -35,5 +35,4 @@
 #include <stdio.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <malloc.h>
Index: uspace/app/getterm/getterm.c
===================================================================
--- uspace/app/getterm/getterm.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/getterm/getterm.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -36,5 +36,4 @@
 
 #include <sys/types.h>
-#include <fcntl.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -59,6 +58,6 @@
 }
 
-static void reopen(FILE **stream, int fd, const char *path, int flags,
-    const char *mode)
+static void reopen(FILE **stream, int fd, const char *path, int mode,
+    const char *fmode)
 {
 	if (fclose(*stream))
@@ -67,5 +66,5 @@
 	*stream = NULL;
 	
-	int oldfd = open(path, flags);
+	int oldfd = vfs_lookup_open(path, WALK_REGULAR, mode);
 	if (oldfd < 0)
 		return;
@@ -79,5 +78,5 @@
 	}
 	
-	*stream = fdopen(fd, mode);
+	*stream = fdopen(fd, fmode);
 }
 
@@ -142,7 +141,7 @@
 	snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term);
 	
-	reopen(&stdin, 0, term_node, O_RDONLY, "r");
-	reopen(&stdout, 1, term_node, O_WRONLY, "w");
-	reopen(&stderr, 2, term_node, O_WRONLY, "w");
+	reopen(&stdin, 0, term_node, MODE_READ, "r");
+	reopen(&stdout, 1, term_node, MODE_WRITE, "w");
+	reopen(&stderr, 2, term_node, MODE_WRITE, "w");
 	
 	if (stdin == NULL)
Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/init/init.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -41,5 +41,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <task.h>
 #include <malloc.h>
Index: uspace/app/redir/redir.c
===================================================================
--- uspace/app/redir/redir.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/redir/redir.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -37,5 +37,4 @@
 #include <sys/types.h>
 #include <stdlib.h>
-#include <fcntl.h>
 #include <unistd.h>
 #include <str.h>
@@ -54,5 +53,6 @@
 }
 
-static void reopen(FILE **stream, int fd, const char *path, int flags, const char *mode)
+static void reopen(FILE **stream, int fd, const char *path, int flags, int mode,
+    const char *fmode)
 {
 	if (fclose(*stream))
@@ -61,5 +61,5 @@
 	*stream = NULL;
 	
-	int oldfd = open(path, flags);
+	int oldfd = vfs_lookup_open(path, WALK_REGULAR | flags, mode);
 	if (oldfd < 0)
 		return;
@@ -73,5 +73,5 @@
 	}
 	
-	*stream = fdopen(fd, mode);
+	*stream = fdopen(fd, fmode);
 }
 
@@ -122,5 +122,5 @@
 				return -2;
 			}
-			reopen(&stdin, 0, argv[i], O_RDONLY, "r");
+			reopen(&stdin, 0, argv[i], 0, MODE_READ, "r");
 		} else if (str_cmp(argv[i], "-o") == 0) {
 			i++;
@@ -129,5 +129,6 @@
 				return -3;
 			}
-			reopen(&stdout, 1, argv[i], O_WRONLY | O_CREAT, "w");
+			reopen(&stdout, 1, argv[i], WALK_MAY_CREATE, MODE_WRITE,
+			    "w");
 		} else if (str_cmp(argv[i], "-e") == 0) {
 			i++;
@@ -136,5 +137,6 @@
 				return -4;
 			}
-			reopen(&stderr, 2, argv[i], O_WRONLY | O_CREAT, "w");
+			reopen(&stderr, 2, argv[i], WALK_MAY_CREATE, MODE_WRITE,
+			    "w");
 		} else if (str_cmp(argv[i], "--") == 0) {
 			i++;
Index: uspace/app/sysinst/futil.c
===================================================================
--- uspace/app/sysinst/futil.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/sysinst/futil.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -35,5 +35,4 @@
 #include <dirent.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -64,9 +63,9 @@
 	printf("Copy '%s' to '%s'.\n", srcp, destp);
 
-	sf = open(srcp, O_RDONLY);
+	sf = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ);
 	if (sf < 0)
 		return EIO;
 
-	df = open(destp, O_CREAT | O_WRONLY, 0);
+	df = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE);
 	if (df < 0)
 		return EIO;
@@ -162,5 +161,5 @@
 	struct stat st;
 
-	sf = open(srcp, O_RDONLY);
+	sf = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ);
 	if (sf < 0)
 		return ENOENT;
Index: uspace/app/taskdump/elf_core.c
===================================================================
--- uspace/app/taskdump/elf_core.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/taskdump/elf_core.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -55,5 +55,4 @@
 #include <sys/types.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <mem.h>
 #include <stdint.h>
@@ -62,4 +61,5 @@
 #include <macros.h>
 #include <libarch/istate.h>
+#include <vfs/vfs.h>
 
 #include "elf_core.h"
@@ -123,5 +123,6 @@
 	}
 
-	fd = open(file_name, O_CREAT | O_WRONLY, 0644);
+	fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE,
+	    MODE_WRITE);
 	if (fd < 0) {
 		printf("Failed opening file.\n");
Index: uspace/app/taskdump/symtab.c
===================================================================
--- uspace/app/taskdump/symtab.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/taskdump/symtab.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -41,5 +41,5 @@
 #include <errno.h>
 #include <sys/types.h>
-#include <fcntl.h>
+#include <vfs/vfs.h>
 
 #include "include/symtab.h"
@@ -81,5 +81,5 @@
 		return ENOMEM;
 
-	fd = open(file_name, O_RDONLY);
+	fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);
 	if (fd < 0) {
 		printf("failed opening file\n");
Index: uspace/app/tester/hw/misc/virtchar1.c
===================================================================
--- uspace/app/tester/hw/misc/virtchar1.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/tester/hw/misc/virtchar1.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -45,5 +45,4 @@
 #include <vfs/vfs.h>
 #include <vfs/vfs_sess.h>
-#include <fcntl.h>
 #include "../../tester.h"
 
@@ -55,5 +54,5 @@
 {
 	TPRINTF("Opening `%s'...\n", path);
-	int fd = open(path, O_RDONLY);
+	int fd = vfs_lookup(path, WALK_REGULAR);
 	if (fd < 0) {
 		TPRINTF("   ...error: %s\n", str_error(errno));
Index: uspace/app/tester/mm/pager1.c
===================================================================
--- uspace/app/tester/mm/pager1.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/tester/mm/pager1.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -29,5 +29,4 @@
 #include <stdio.h>
 #include <vfs/vfs.h>
-#include <fcntl.h>
 #include <stdlib.h>
 #include <malloc.h>
@@ -48,5 +47,6 @@
 	TPRINTF("Creating temporary file...\n");
 
-	fd = open(TEST_FILE, O_RDWR | O_CREAT);
+	fd = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
+	    MODE_READ | MODE_WRITE);
 	if (fd < 0)
 		return NULL;
Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/tester/vfs/vfs1.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -33,5 +33,4 @@
 #include <vfs/vfs.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <dirent.h>
 #include <loc.h>
@@ -79,7 +78,8 @@
 	TPRINTF("Created directory %s\n", TEST_DIRECTORY);
 	
-	int fd0 = open(TEST_FILE, O_RDWR | O_CREAT);
+	int fd0 = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
+	    MODE_READ | MODE_WRITE);
 	if (fd0 < 0)
-		return "open() failed";
+		return "vfs_lookup_open() failed";
 	TPRINTF("Created file %s (fd=%d)\n", TEST_FILE, fd0);
 	
Index: uspace/app/tetris/scores.c
===================================================================
--- uspace/app/tetris/scores.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/tetris/scores.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -65,5 +65,4 @@
 #include <vfs/vfs.h>
 #include <stdlib.h>
-#include <fcntl.h>
 #include <err.h>
 #include <time.h>
Index: uspace/app/viewer/viewer.c
===================================================================
--- uspace/app/viewer/viewer.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/viewer/viewer.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -35,5 +35,4 @@
 #include <stdio.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <vfs/vfs.h>
 #include <errno.h>
@@ -110,5 +109,5 @@
 static bool img_load(const char *fname, surface_t **p_local_surface)
 {
-	int fd = open(fname, O_RDONLY);
+	int fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
 	if (fd < 0)
 		return false;
Index: uspace/app/websrv/websrv.c
===================================================================
--- uspace/app/websrv/websrv.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/app/websrv/websrv.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -40,6 +40,7 @@
 #include <sys/types.h>
 #include <stdlib.h>
-#include <fcntl.h>
 #include <task.h>
+
+#include <vfs/vfs.h>
 
 #include <inet/addr.h>
@@ -224,5 +225,5 @@
 		return ENOMEM;
 	
-	int fd = open(fname, O_RDONLY);
+	int fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ);
 	if (fd < 0) {
 		rc = send_response(conn, msg_not_found);
Index: uspace/dist/src/c/demos/tetris/scores.c
===================================================================
--- uspace/dist/src/c/demos/tetris/scores.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/dist/src/c/demos/tetris/scores.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -65,5 +65,4 @@
 #include <vfs/vfs.h>
 #include <stdlib.h>
-#include <fcntl.h>
 #include <err.h>
 #include <time.h>
Index: uspace/drv/bus/isa/isa.c
===================================================================
--- uspace/drv/bus/isa/isa.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/drv/bus/isa/isa.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -51,5 +51,4 @@
 #include <malloc.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <ipc/irc.h>
 #include <ipc/services.h>
@@ -256,5 +255,5 @@
 	struct stat st;
 
-	fd = open(conf_path, O_RDONLY);
+	fd = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ);
 	if (fd < 0) {
 		ddf_msg(LVL_ERROR, "Unable to open %s", conf_path);
Index: uspace/drv/char/ns8250/ns8250.c
===================================================================
--- uspace/drv/char/ns8250/ns8250.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/drv/char/ns8250/ns8250.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -48,5 +48,4 @@
 #include <malloc.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <ddi.h>
 
Index: uspace/lib/bithenge/src/file.c
===================================================================
--- uspace/lib/bithenge/src/file.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/bithenge/src/file.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -38,5 +38,4 @@
 #include <assert.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -146,5 +145,5 @@
 	assert(filename);
 
-	int fd = open(filename, O_RDONLY);
+	int fd = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ);
 	if (fd < 0)
 		return errno;
Index: uspace/lib/c/generic/elf/elf_mod.c
===================================================================
--- uspace/lib/c/generic/elf/elf_mod.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/c/generic/elf/elf_mod.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -97,5 +97,5 @@
 
 	int ofile = vfs_clone(file, -1, true);
-	int rc = _vfs_open(ofile, MODE_READ);
+	int rc = vfs_open(ofile, MODE_READ);
 	if (rc != EOK) {
 		return rc;
Index: uspace/lib/c/generic/io/io.c
===================================================================
--- uspace/lib/c/generic/io/io.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/c/generic/io/io.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -35,5 +35,4 @@
 #include <stdio.h>
 #include <unistd.h>
-#include <fcntl.h>
 #include <assert.h>
 #include <str.h>
@@ -115,5 +114,5 @@
 		int stdinfd = vfs_clone(infd, -1, false);
 		assert(stdinfd == 0);
-		_vfs_open(stdinfd, MODE_READ);
+		vfs_open(stdinfd, MODE_READ);
 		stdin = fdopen(stdinfd, "r");
 	} else {
@@ -128,5 +127,5 @@
 		while (stdoutfd < 1)
 			stdoutfd = vfs_clone(outfd, -1, false);
-		_vfs_open(stdoutfd, MODE_APPEND);
+		vfs_open(stdoutfd, MODE_APPEND);
 		stdout = fdopen(stdoutfd, "a");
 	} else {
@@ -141,5 +140,5 @@
 		while (stderrfd < 2)
 			stderrfd = vfs_clone(errfd, -1, false);
-		_vfs_open(stderrfd, MODE_APPEND);
+		vfs_open(stderrfd, MODE_APPEND);
 		stderr = fdopen(stderrfd, "a");
 	} else {
@@ -157,8 +156,8 @@
 }
 
-static bool parse_mode(const char *mode, int *flags)
+static bool parse_mode(const char *fmode, int *mode, bool *create, bool *truncate)
 {
 	/* Parse mode except first character. */
-	const char *mp = mode;
+	const char *mp = fmode;
 	if (*mp++ == 0) {
 		errno = EINVAL;
@@ -180,12 +179,18 @@
 		return false;
 	}
-	
-	/* Parse first character of mode and determine flags for open(). */
-	switch (mode[0]) {
+
+	*create = false;
+	*truncate = false;
+	
+	/* Parse first character of fmode and determine mode for vfs_open(). */
+	switch (fmode[0]) {
 	case 'r':
-		*flags = plus ? O_RDWR : O_RDONLY;
+		*mode = plus ? MODE_READ | MODE_WRITE : MODE_READ;
 		break;
 	case 'w':
-		*flags = (O_TRUNC | O_CREAT) | (plus ? O_RDWR : O_WRONLY);
+		*mode = plus ? MODE_READ | MODE_WRITE : MODE_WRITE;
+		*create = true;
+		if (!plus)
+			*truncate = true;
 		break;
 	case 'a':
@@ -195,5 +200,7 @@
 			return false;
 		}
-		*flags = (O_APPEND | O_CREAT) | (plus ? O_RDWR : O_WRONLY);
+
+		*mode = MODE_APPEND | (plus ? MODE_READ | MODE_WRITE : MODE_WRITE);
+		*create = true;
 		break;
 	default:
@@ -269,8 +276,11 @@
  *
  */
-FILE *fopen(const char *path, const char *mode)
-{
-	int flags;
-	if (!parse_mode(mode, &flags))
+FILE *fopen(const char *path, const char *fmode)
+{
+	int mode;
+	bool create;
+	bool truncate;
+
+	if (!parse_mode(fmode, &mode, &create, &truncate))
 		return NULL;
 	
@@ -281,12 +291,34 @@
 		return NULL;
 	}
-	
-	stream->fd = open(path, flags, 0666);
-	if (stream->fd < 0) {
-		/* errno was set by open() */
+
+	int flags = WALK_REGULAR;
+	if (create)
+		flags |= WALK_MAY_CREATE;
+	int file = vfs_lookup(path, flags);
+	if (file < 0) {
+		errno = file;
 		free(stream);
 		return NULL;
 	}
-	
+
+	int rc = vfs_open(file, mode);
+	if (rc != EOK) {
+		errno = rc;
+		close(file);
+		free(stream);
+		return NULL;
+	}
+	
+	if (truncate) {
+		rc = vfs_resize(file, 0);
+		if (rc != EOK) {
+			errno = rc;
+			close(file);
+			free(stream);
+			return NULL;
+		}
+	}
+
+	stream->fd = file;
 	stream->pos = 0;
 	stream->error = false;
Index: uspace/lib/c/generic/rtld/module.c
===================================================================
--- uspace/lib/c/generic/rtld/module.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/c/generic/rtld/module.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -38,5 +38,4 @@
 #include <elf/elf_load.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <loader/pcb.h>
 #include <stdio.h>
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -41,5 +41,4 @@
 #include <unistd.h>
 #include <dirent.h>
-#include <fcntl.h>
 #include <stdio.h>
 #include <sys/types.h>
@@ -155,11 +154,26 @@
 }
 
-int _vfs_open(int fildes, int mode)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	sysarg_t rc = async_req_2_0(exch, VFS_IN_OPEN, fildes, mode);
-	vfs_exchange_end(exch);
-	
-	return (int) rc;
+int vfs_open(int file, int mode)
+{
+	async_exch_t *exch = vfs_exchange_begin();
+	int rc = async_req_2_0(exch, VFS_IN_OPEN, file, mode);
+	vfs_exchange_end(exch);
+	
+	return rc;
+}
+
+int vfs_lookup_open(const char *path, int flags, int mode)
+{
+	int file = vfs_lookup(path, flags);
+	if (file < 0)
+		return file;
+
+	int rc = vfs_open(file, mode);
+	if (rc != EOK) {
+		close(file);
+		return rc;
+	}
+	
+	return file;
 }
 
@@ -353,64 +367,4 @@
 }
 
-static int walk_flags(int oflags)
-{
-	int flags = 0;
-	if (oflags & O_CREAT) {
-		if (oflags & O_EXCL)
-			flags |= WALK_MUST_CREATE;
-		else
-			flags |= WALK_MAY_CREATE;
-	}
-	return flags;
-}
-
-/** Open file.
- *
- * @param path File path
- * @param oflag O_xxx flags
- * @param mode File mode (only with O_CREAT)
- *
- * @return Nonnegative file descriptor on success. On error -1 is returned
- *         and errno is set.
- */
-int open(const char *path, int oflag, ...)
-{
-	if (((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == 0) ||
-	    ((oflag & (O_RDONLY | O_WRONLY)) == (O_RDONLY | O_WRONLY)) ||
-	    ((oflag & (O_RDONLY | O_RDWR)) == (O_RDONLY | O_RDWR)) ||
-	    ((oflag & (O_WRONLY | O_RDWR)) == (O_WRONLY | O_RDWR))) {
-		errno = EINVAL;
-		return -1;
-	}
-	
-	int fd = vfs_lookup(path, walk_flags(oflag) | WALK_REGULAR);
-	if (fd < 0) {
-		errno = fd;
-		return -1;
-	}
-	
-	int mode =
-	    ((oflag & O_RDWR) ? MODE_READ | MODE_WRITE : 0) |
-	    ((oflag & O_RDONLY) ? MODE_READ : 0) |
-	    ((oflag & O_WRONLY) ? MODE_WRITE : 0) |
-	    ((oflag & O_APPEND) ? MODE_APPEND : 0);
-	
-	int rc = _vfs_open(fd, mode); 
-	if (rc < 0) {
-		close(fd);
-		errno = rc;
-		return -1;
-	}
-	
-	if (oflag & O_TRUNC) {
-		assert(oflag & O_WRONLY || oflag & O_RDWR);
-		assert(!(oflag & O_APPEND));
-		
-		(void) vfs_resize(fd, 0);
-	}
-
-	return fd;
-}
-
 /** Close file.
  *
@@ -703,5 +657,5 @@
 	}
 	
-	int rc = _vfs_open(fd, MODE_READ);
+	int rc = vfs_open(fd, MODE_READ);
 	if (rc < 0) {
 		free(dirp);
Index: pace/lib/c/include/fcntl.h
===================================================================
--- uspace/lib/c/include/fcntl.h	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2007 Jakub Jermar
- * 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_FCNTL_H_
-#define LIBC_FCNTL_H_
-
-#define O_CREAT   1
-#define O_EXCL    2
-#define O_TRUNC   4
-#define O_APPEND  8
-#define O_RDONLY  16
-#define O_RDWR    32
-#define O_WRONLY  64
-#define O_DESC    128
-
-extern int open(const char *, int, ...);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/c/include/vfs/vfs.h	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -83,6 +83,4 @@
 
 extern int _vfs_walk(int, const char *, int);
-extern int _vfs_open(int, int);
-extern int vfs_lookup(const char *, int);
 
 extern int vfs_pass_handle(async_exch_t *, int, async_exch_t *);
@@ -92,8 +90,11 @@
 extern int vfs_link(int, const char *, vfs_file_kind_t);
 extern int vfs_link_path(const char *, vfs_file_kind_t);
+extern int vfs_lookup(const char *, int);
+extern int vfs_lookup_open(const char *, int, int);
 extern int vfs_mount_path(const char *, const char *, const char *,
     const char *, unsigned int, unsigned int);
 extern int vfs_mount(int, const char *, service_id_t, const char *, unsigned,
     unsigned, int *);
+extern int vfs_open(int, int);
 extern int vfs_resize(int, aoff64_t);
 extern int vfs_root(void);
Index: uspace/lib/pcut/src/os/helenos.c
===================================================================
--- uspace/lib/pcut/src/os/helenos.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/pcut/src/os/helenos.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -41,5 +41,4 @@
 #include <stdio.h>
 #include <task.h>
-#include <fcntl.h>
 #include <fibril_synch.h>
 #include <vfs/vfs.h>
@@ -162,5 +161,5 @@
 	char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
 	snprintf(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1, "pcut_%lld.tmp", (unsigned long long) task_get_id());
-	int tempfile = open(tempfile_name, O_CREAT | O_RDWR);
+	int tempfile = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE);
 	if (tempfile < 0) {
 		pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to create temporary file.", NULL, NULL);
Index: uspace/lib/posix/include/posix/fcntl.h
===================================================================
--- uspace/lib/posix/include/posix/fcntl.h	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/posix/include/posix/fcntl.h	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -41,6 +41,20 @@
 
 #include "sys/types.h"
-#include "libc/fcntl.h"
 #include "errno.h"
+
+#undef O_CREAT
+#undef O_EXCL
+#undef O_TRUNC
+#undef O_APPEND
+#undef O_RDONLY
+#undef O_RDWR
+#undef O_WRONLY
+#define O_CREAT   1
+#define O_EXCL    2
+#define O_TRUNC   4
+#define O_APPEND  8
+#define O_RDONLY  16
+#define O_RDWR    32
+#define O_WRONLY  64
 
 /* Mask for file access modes. */
Index: uspace/lib/posix/source/fcntl.c
===================================================================
--- uspace/lib/posix/source/fcntl.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/posix/source/fcntl.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -100,19 +100,64 @@
  *
  * @param pathname Path to the file.
- * @param flags Access mode flags.
+ * @param posix_flags Access mode flags.
  */
-int posix_open(const char *pathname, int flags, ...)
+int posix_open(const char *pathname, int posix_flags, ...)
 {
-	mode_t mode = 0;
-	if ((flags & O_CREAT) > 0) {
+	int rc;
+	mode_t posix_mode = 0;
+	if (posix_flags & O_CREAT) {
 		va_list args;
-		va_start(args, flags);
-		mode = va_arg(args, mode_t);
+		va_start(args, posix_flags);
+		posix_mode = va_arg(args, mode_t);
 		va_end(args);
+		(void) posix_mode;
 	}
 
-	return negerrno(open, pathname, flags, mode);
+	if (((posix_flags & (O_RDONLY | O_WRONLY | O_RDWR)) == 0) ||
+	    ((posix_flags & (O_RDONLY | O_WRONLY)) == (O_RDONLY | O_WRONLY)) ||
+	    ((posix_flags & (O_RDONLY | O_RDWR)) == (O_RDONLY | O_RDWR)) ||
+	    ((posix_flags & (O_WRONLY | O_RDWR)) == (O_WRONLY | O_RDWR))) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	int flags = WALK_REGULAR;
+	if (posix_flags & O_CREAT) {
+		if (posix_flags & O_EXCL)
+			flags |= WALK_MUST_CREATE;
+		else
+			flags |= WALK_MAY_CREATE;
+	}
+
+	int mode =
+	    ((posix_flags & O_RDWR) ? MODE_READ | MODE_WRITE : 0) |
+	    ((posix_flags & O_RDONLY) ? MODE_READ : 0) |
+	    ((posix_flags & O_WRONLY) ? MODE_WRITE : 0) |
+	    ((posix_flags & O_APPEND) ? MODE_APPEND : 0);
+
+	int file = rcerrno(vfs_lookup, pathname, flags);
+	if (file < 0)
+		return -1;
+
+	rc = rcerrno(vfs_open, file, mode);
+	if (rc != EOK) {
+		close (file);
+		return -1;
+	}
+
+	if (posix_flags & O_TRUNC) {
+		if (posix_flags & (O_RDWR | O_WRONLY)) {
+			rc = rcerrno(vfs_resize, file, 0);
+			if (rc != EOK) {
+				close(file);
+				return -1;
+			}
+		}
+	}
+
+	return file;
 }
 
 /** @}
  */
+
Index: uspace/lib/posix/source/stdlib.c
===================================================================
--- uspace/lib/posix/source/stdlib.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/posix/source/stdlib.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -431,5 +431,5 @@
 		}
 		
-		fd = open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+		fd = posix_open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
 		
 		if (fd == -1) {
Index: uspace/lib/posix/source/unistd.c
===================================================================
--- uspace/lib/posix/source/unistd.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/lib/posix/source/unistd.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -335,9 +335,7 @@
 		 * Check file existence by attempting to open it.
 		 */
-		int fd = negerrno(open, path, O_RDONLY);
-		if (fd < 0) {
-			/* errno was set by open() */
+		int fd = posix_open(path, O_RDONLY);
+		if (fd < 0)
 			return -1;
-		}
 		close(fd);
 		return 0;
Index: uspace/srv/devman/driver.c
===================================================================
--- uspace/srv/devman/driver.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/devman/driver.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -33,5 +33,4 @@
 #include <dirent.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <io/log.h>
 #include <vfs/vfs.h>
Index: uspace/srv/devman/match.c
===================================================================
--- uspace/srv/devman/match.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/devman/match.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -32,5 +32,4 @@
 
 #include <errno.h>
-#include <fcntl.h>
 #include <io/log.h>
 #include <str.h>
@@ -203,5 +202,5 @@
 	struct stat st;
 	
-	fd = open(conf_path, O_RDONLY);
+	fd = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ);
 	if (fd < 0) {
 		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
Index: uspace/srv/hid/input/ctl/kbdev.c
===================================================================
--- uspace/srv/hid/input/ctl/kbdev.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/hid/input/ctl/kbdev.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -39,5 +39,4 @@
 #include <stdbool.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <io/console.h>
 #include <io/keycode.h>
Index: uspace/srv/hid/input/port/adb.c
===================================================================
--- uspace/srv/hid/input/port/adb.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/hid/input/port/adb.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -38,5 +38,4 @@
 #include <async.h>
 #include <vfs/vfs.h>
-#include <fcntl.h>
 #include <errno.h>
 #include <loc.h>
Index: uspace/srv/hid/input/proto/mousedev.c
===================================================================
--- uspace/srv/hid/input/proto/mousedev.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/hid/input/proto/mousedev.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -37,5 +37,4 @@
 
 #include <stdio.h>
-#include <fcntl.h>
 #include <vfs/vfs_sess.h>
 #include <malloc.h>
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/loader/main.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -48,5 +48,4 @@
 #include <unistd.h>
 #include <stdbool.h>
-#include <fcntl.h>
 #include <sys/types.h>
 #include <ipc/services.h>
Index: uspace/srv/vfs/vfs_ipc.c
===================================================================
--- uspace/srv/vfs/vfs_ipc.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/vfs/vfs_ipc.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -99,7 +99,7 @@
 {
 	int fd = IPC_GET_ARG1(*request);
-	int flags = IPC_GET_ARG2(*request);
-
-	int rc = vfs_op_open(fd, flags);
+	int mode = IPC_GET_ARG2(*request);
+
+	int rc = vfs_op_open(fd, mode);
 	async_answer_0(rid, rc);
 }
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 80743a1b2ba5306f70559161509a3376fa381a08)
+++ uspace/srv/vfs/vfs_ops.c	(revision b19e892c22afbf67aa5988554dd3f003efeadc04)
@@ -49,5 +49,4 @@
 #include <unistd.h>
 #include <ctype.h>
-#include <fcntl.h>
 #include <assert.h>
 #include <vfs/canonify.h>
@@ -274,7 +273,7 @@
 }
 
-int vfs_op_open(int fd, int flags)
-{
-	if (flags == 0)
+int vfs_op_open(int fd, int mode)
+{
+	if (mode == 0)
 		return EINVAL;
 
@@ -283,5 +282,5 @@
 		return EBADF;
 	
-	if ((flags & ~file->permissions) != 0) {
+	if ((mode & ~file->permissions) != 0) {
 		vfs_file_put(file);
 		return EPERM;
@@ -293,7 +292,7 @@
 	}
 	
-	file->open_read = (flags & MODE_READ) != 0;
-	file->open_write = (flags & (MODE_WRITE | MODE_APPEND)) != 0;
-	file->append = (flags & MODE_APPEND) != 0;
+	file->open_read = (mode & MODE_READ) != 0;
+	file->open_write = (mode & (MODE_WRITE | MODE_APPEND)) != 0;
+	file->append = (mode & MODE_APPEND) != 0;
 	
 	if (!file->open_read && !file->open_write) {
