Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -236,5 +236,5 @@
 			 */
 			if (force && !interactive) {
-				if (unlink(dest_path) != 0) {
+				if (vfs_unlink_path(dest_path) != EOK) {
 					printf("Unable to remove %s\n",
 					    dest_path);
@@ -247,5 +247,5 @@
 				if (overwrite) {
 					printf("Overwriting file: %s\n", dest_path);
-					if (unlink(dest_path) != 0) {
+					if (vfs_unlink_path(dest_path) != EOK) {
 						printf("Unable to remove %s\n", dest_path);
 						goto exit;
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -36,4 +36,5 @@
 #include <mem.h>
 #include <str.h>
+#include <vfs/vfs.h>
 
 #include "config.h"
@@ -132,5 +133,5 @@
 static unsigned int rm_single(const char *path)
 {
-	if (unlink(path) != 0) {
+	if (vfs_unlink_path(path) != EOK) {
 		cli_error(CL_EFAIL, "rm: could not remove file %s", path);
 		return 1;
@@ -201,6 +202,6 @@
 
 	/* First see if it will just go away */
-	rc = rmdir(path);
-	if (rc == 0)
+	rc = vfs_unlink_path(path);
+	if (rc == EOK)
 		return 0;
 
@@ -209,7 +210,7 @@
 
 	/* Delete directory */
-	rc = rmdir(path);
-	if (rc == 0)
-		return errno;
+	rc = vfs_unlink_path(path);
+	if (rc == EOK)
+		return EOK;
 
 	cli_error(CL_ENOTSUP, "Can not remove %s", path);
Index: uspace/app/tester/mm/pager1.c
===================================================================
--- uspace/app/tester/mm/pager1.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/app/tester/mm/pager1.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -28,5 +28,5 @@
 
 #include <stdio.h>
-#include <unistd.h>
+#include <vfs/vfs.h>
 #include <fcntl.h>
 #include <stdlib.h>
@@ -51,5 +51,5 @@
 	if (fd < 0)
 		return NULL;
-	(void) unlink(TEST_FILE);
+	(void) vfs_unlink_path(TEST_FILE);
 
 	if (write(fd, (aoff64_t []) {0}, text, sizeof(text)) != sizeof(text)) {
Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/app/tester/vfs/vfs1.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -117,10 +117,10 @@
 	TPRINTF("Renamed %s to %s\n", TEST_FILE, TEST_FILE2);
 	
-	if (unlink(TEST_FILE2) != 0)
-		return "unlink() failed";
+	if (vfs_unlink_path(TEST_FILE2) != EOK)
+		return "vfs_unlink_path() failed";
 	TPRINTF("Unlinked %s\n", TEST_FILE2);
 	
-	if (rmdir(TEST_DIRECTORY) != 0)
-		return "rmdir() failed";
+	if (vfs_unlink_path(TEST_DIRECTORY) != EOK)
+		return "vfs_unlink_path() failed";
 	TPRINTF("Removed directory %s\n", TEST_DIRECTORY);
 	
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -792,5 +792,5 @@
 }
 
-static int _vfs_unlink(int parent, const char *path, int expect, int wflag)
+int vfs_unlink(int parent, const char *child, int expect)
 {
 	sysarg_t rc;
@@ -799,6 +799,6 @@
 	async_exch_t *exch = vfs_exchange_begin();
 	
-	req = async_send_3(exch, VFS_IN_UNLINK, parent, expect, wflag, NULL);
-	rc = async_data_write_start(exch, path, str_size(path));
+	req = async_send_2(exch, VFS_IN_UNLINK, parent, expect, NULL);
+	rc = async_data_write_start(exch, child, str_size(child));
 	
 	vfs_exchange_end(exch);
@@ -815,63 +815,40 @@
  *
  * @param path Path
- * @return EOk on success, error code on error
- */
-int unlink(const char *path)
+ * @return EOk on success or a negative error code otherwise
+ */
+int vfs_unlink_path(const char *path)
 {
 	size_t pa_size;
 	char *pa = vfs_absolutize(path, &pa_size);
-	if (!pa) {
-		errno = ENOMEM;
-		return -1;
-	}
-	
-	int root = vfs_root();
-	if (root < 0) {
+	if (!pa)
+		return ENOMEM;
+
+	int parent;
+	int expect = vfs_lookup(path, 0);
+	if (expect < 0) {
 		free(pa);
-		errno = ENOENT;
-		return -1;
-	}
-	
-	int rc = _vfs_unlink(root, pa, -1, 0);
-	
-	if (rc != EOK) {
-		errno = rc;
-		rc = -1;
-	}
-
+		return expect;
+	}
+
+	char *slash = str_rchr(pa, L'/');
+	if (slash != pa) {
+		*slash = '\0';
+		parent = vfs_lookup(pa, 0);
+		*slash = '/';
+	} else {
+		parent = vfs_root();
+	}
+
+	if (parent < 0) {
+		free(pa);
+		close(expect);
+		return parent;
+	}
+
+	int rc = vfs_unlink(parent, slash, expect);
+	
 	free(pa);
-	close(root);
-	return rc;
-}
-
-/** Remove empty directory.
- *
- * @param path Path
- * @return 0 on success. On error returns -1 and sets errno.
- */
-int rmdir(const char *path)
-{
-	size_t pa_size;
-	char *pa = vfs_absolutize(path, &pa_size);
-	if (!pa) {
-		errno = ENOMEM;
-		return -1;
-	}
-	
-	int root = vfs_root();
-	if (root < 0) {
-		free(pa);
-		errno = ENOENT;
-		return -1;
-	}
-	
-	int rc = _vfs_unlink(root, pa, -1, WALK_DIRECTORY);
-	if (rc != EOK) {
-		errno = rc;
-		rc = -1;
-	}
-	
-	free(pa);
-	close(root);
+	close(parent);
+	close(expect);
 	return rc;
 }
Index: uspace/lib/c/include/unistd.h
===================================================================
--- uspace/lib/c/include/unistd.h	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/lib/c/include/unistd.h	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -65,8 +65,6 @@
 extern int close(int);
 extern int fsync(int);
-extern int unlink(const char *);
 
 extern char *getcwd(char *, size_t);
-extern int rmdir(const char *);
 extern int chdir(const char *);
 
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/lib/c/include/vfs/vfs.h	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -94,4 +94,6 @@
 extern int vfs_statfs(int, struct statfs *);
 extern int vfs_statfs_path(const char *, struct statfs *);
+extern int vfs_unlink(int, const char *, int);
+extern int vfs_unlink_path(const char *);
 
 int vfs_mount(int, const char *, service_id_t, const char *, unsigned, unsigned, int *);
Index: uspace/lib/pcut/src/os/helenos.c
===================================================================
--- uspace/lib/pcut/src/os/helenos.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/lib/pcut/src/os/helenos.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -43,4 +43,5 @@
 #include <fcntl.h>
 #include <fibril_synch.h>
+#include <vfs/vfs.h>
 #include "../internal.h"
 
@@ -219,5 +220,5 @@
 leave_close_tempfile:
 	close(tempfile);
-	unlink(tempfile_name);
+	vfs_unlink_path(tempfile_name);
 
 	pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
Index: uspace/lib/posix/source/stdio.c
===================================================================
--- uspace/lib/posix/source/stdio.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/lib/posix/source/stdio.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -576,5 +576,8 @@
 int posix_remove(const char *path)
 {
-	return negerrno(unlink, path);
+	if (rcerrno(vfs_unlink_path, path) != EOK)
+		return -1;
+	else
+		return 0;
 }
 
Index: uspace/lib/posix/source/unistd.c
===================================================================
--- uspace/lib/posix/source/unistd.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/lib/posix/source/unistd.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -270,5 +270,8 @@
 int posix_rmdir(const char *path)
 {
-	return negerrno(rmdir, path);
+	if (rcerrno(vfs_unlink_path, path) != EOK)
+		return -1;
+	else
+		return 0;
 }
 
@@ -281,5 +284,8 @@
 int posix_unlink(const char *path)
 {
-	return negerrno(unlink, path);
+	if (rcerrno(vfs_unlink_path, path) != EOK)
+		return -1;
+	else
+		return 0;
 }
 
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/srv/vfs/vfs.h	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -215,5 +215,5 @@
 extern int vfs_op_sync(int fd);
 extern int vfs_op_truncate(int fd, int64_t size);
-extern int vfs_op_unlink(int parentfd, int expectfd, int wflag, char *path);
+extern int vfs_op_unlink(int parentfd, int expectfd, char *path);
 extern int vfs_op_unmount(int mpfd);
 extern int vfs_op_wait_handle(bool high_fd);
Index: uspace/srv/vfs/vfs_ipc.c
===================================================================
--- uspace/srv/vfs/vfs_ipc.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/srv/vfs/vfs_ipc.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -194,10 +194,9 @@
 	int parentfd = IPC_GET_ARG1(*request);
 	int expectfd = IPC_GET_ARG2(*request);
-	int wflag = IPC_GET_ARG3(*request);
 	
 	char *path;
 	int rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
 	if (rc == EOK)
-		rc = vfs_op_unlink(parentfd, expectfd, wflag, path);
+		rc = vfs_op_unlink(parentfd, expectfd, path);
 	
 	async_answer_0(rid, rc);
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision ae7bfbbd6c5f88b20c47f0b8dec92d82046a2b33)
+++ uspace/srv/vfs/vfs_ops.c	(revision 79ea5af7eec765b8d511aeadc76b09d6eebb8be0)
@@ -672,5 +672,5 @@
 }
 
-int vfs_op_unlink(int parentfd, int expectfd, int wflag, char *path)
+int vfs_op_unlink(int parentfd, int expectfd, char *path)
 {
 	int rc = EOK;
@@ -683,6 +683,4 @@
 	fibril_rwlock_write_lock(&namespace_rwlock);
 	
-	int lflag = (wflag & WALK_DIRECTORY) ? L_DIRECTORY: 0;
-
 	/* 
 	 * Files are retrieved in order of file descriptors, to prevent
@@ -717,5 +715,5 @@
 	if (expectfd >= 0) {
 		vfs_lookup_res_t lr;
-		rc = vfs_lookup_internal(parent->node, path, lflag, &lr);
+		rc = vfs_lookup_internal(parent->node, path, 0, &lr);
 		if (rc != EOK)
 			goto exit;
@@ -733,5 +731,5 @@
 	
 	vfs_lookup_res_t lr;
-	rc = vfs_lookup_internal(parent->node, path, lflag | L_UNLINK, &lr);
+	rc = vfs_lookup_internal(parent->node, path, L_UNLINK, &lr);
 	if (rc != EOK)
 		goto exit;
