Index: tools/check.sh
===================================================================
--- tools/check.sh	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ tools/check.sh	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -66,5 +66,5 @@
 do
 	echo -n ">>>> Building $P... "
-	( make distclean && make PROFILE=$P HANDS_OFF=y "$@" ) >>/dev/null 2>>/dev/null
+	( make distclean && make PROFILE=$P HANDS_OFF=y $1 ) >>/dev/null 2>>/dev/null
 	if [ $? -ne 0 ];
 	then
Index: tools/mkfat.py
===================================================================
--- tools/mkfat.py	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ tools/mkfat.py	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -168,107 +168,47 @@
 """
 
-LFN_ENTRY = """little:
-	uint8_t pos
-	uint16_t name1[5]
-	uint8_t attr
-	uint8_t type
-	uint8_t csum
-	uint16_t name2[6]
-	uint16_t fc
-	uint16_t name3[2]
-"""
-
-# Global variable to hold the file names in 8.3 format. Needed to 
-# keep track of "number" when creating a short fname from a LFN.
-name83_list = []
-
-def name83(fname):
-	"Create a 8.3 name for the given fname"
-
+def mangle_fname(name):
 	# FIXME: filter illegal characters
-	parts = fname.split('.')
-	
-	name = ''
-	ext = ''
-	lfn = False
-
-	if len(fname) > 11 :
-		lfn = True
-
+	parts = name.split('.')
+	
 	if len(parts) > 0:
-		name = parts[0]
-		if len(name) > 8 :
-			lfn = True
-
-	if len(parts) > 1 :
-		ext = parts[-1]
-		if len(ext) > 3 :
-			lfn = True
-
-	if len(parts) > 2 :
-		lfn = True
-
-	if (lfn == False) :
-		return (name.ljust(8)[0:8], ext.ljust(3)[0:3], False)
-
-	# For filenames with multiple extensions, we treat the last one
-	# as the actual extension. The rest of the filename is stripped
-	# of dots and concatenated to form the short name
-	for _name in parts[1:-1]:
-		name = name + _name		
-
-	global name83_list
-	for number in range(1, 10000) :
-		number_str = '~' + str(number)
-
-		if len(name) + len(number_str) > 8 :
-			name = name[0:8 - len(number_str)]
-
-		name = name + number_str;
-
-		if (name + ext) not in name83_list :
-			break
-			
-	name83_list.append(name + ext)	
-
-	return (name.ljust(8)[0:8], ext.ljust(3)[0:3], True)
-
-def get_utf16(name, l) :
-	"Create a int array out of a string which we can store in uint16_t arrays"
-
-	bs = [0xFFFF for i in range(l)]
-
-	for i in range(len(name)) :
-		bs[i] = ord(name[i])
-	
-	if (len(name) < l) :
-		bs[len(name)] = 0;
-	
-	return bs
-
-def create_lfn_entry(name_index) :
-	(name, index) = name_index
-	entry = xstruct.create(LFN_ENTRY)
-
-	entry.name1 = get_utf16(name[0:5], 5)
-	entry.name2 = get_utf16(name[5:11], 6)
-	entry.name3 = get_utf16(name[11:13], 2)
-	entry.pos = index
-
-	entry.attr = 0xF
-	entry.fc = 0
-	entry.type = 0
-
-	return entry
+		fname = parts[0]
+	else:
+		fname = ''
+	
+	if len(fname) > 8:
+		sys.stdout.write("mkfat.py: error: Directory entry " + name +
+		    " base name is longer than 8 characters\n")
+		sys.exit(1);
+	
+	return (fname + '          ').upper()[0:8]
+
+def mangle_ext(name):
+	# FIXME: filter illegal characters
+	parts = name.split('.')
+	
+	if len(parts) > 1:
+		ext = parts[1]
+	else:
+		ext = ''
+	
+	if len(parts) > 2:
+		sys.stdout.write("mkfat.py: error: Directory entry " + name +
+		    " has more than one extension\n")
+		sys.exit(1);
+	
+	if len(ext) > 3:
+		sys.stdout.write("mkfat.py: error: Directory entry " + name +
+		    " extension is longer than 3 characters\n")
+		sys.exit(1);
+	
+	return (ext + '   ').upper()[0:3]
 
 def create_dirent(name, directory, cluster, size):
-	
 	dir_entry = xstruct.create(DIR_ENTRY)
 	
-	dir_entry.name, dir_entry.ext, lfn = name83(name)
-
-	dir_entry.name = dir_entry.name.upper().encode('ascii')
-	dir_entry.ext = dir_entry.ext.upper().encode('ascii')
-
+	dir_entry.name = mangle_fname(name).encode('ascii')
+	dir_entry.ext = mangle_ext(name).encode('ascii')
+	
 	if (directory):
 		dir_entry.attr = 0x30
@@ -290,27 +230,5 @@
 		dir_entry.size = size
 	
-
-	if not lfn:
-		return [dir_entry]
-
-	n = (int) (len(name) / 13 + 1)
-	names = [(name[i * 13: (i + 1) * 13 + 1], i + 1) for i in range(n)]
-
-	entries = sorted(map (create_lfn_entry, names), reverse = True, key = lambda e : e.pos)
-	entries[0].pos |= 0x40
-
-	fname11 = str(dir_entry.name + dir_entry.ext)
-
-	csum = 0
-	for i in range(0, 11) :
-		csum = ((csum & 1) << 7) + (csum  >> 1) + ord(fname11[i])
-		csum = csum & 0xFF
-	
-	for e in entries :
-		e.csum = csum;
-	
-	entries.append(dir_entry)
-
-	return entries
+	return dir_entry
 
 def create_dot_dirent(empty_cluster):
@@ -370,8 +288,8 @@
 		if item.is_file:
 			rv = write_file(item, outf, cluster_size, data_start, fat, reserved_clusters)
-			directory.extend(create_dirent(item.name, False, rv[0], rv[1]))
+			directory.append(create_dirent(item.name, False, rv[0], rv[1]))
 		elif item.is_dir:
 			rv = recursion(False, item.path, outf, cluster_size, root_start, data_start, fat, reserved_clusters, dirent_size, empty_cluster)
-			directory.extend(create_dirent(item.name, True, rv[0], rv[1]))
+			directory.append(create_dirent(item.name, True, rv[0], rv[1]))
 	
 	if (head):
Index: tools/mkuimage.py
===================================================================
--- tools/mkuimage.py	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ tools/mkuimage.py	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -124,5 +124,5 @@
 	header.img_type = 2		# Kernel
 	header.compression = 0		# None
-	header.img_name = image_name.encode('ascii')
+	header.img_name = image_name
 
 	header_crc = calc_crc32(header.pack())
Index: uspace/app/bdsh/cmds/builtins/cd/cd.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/cd/cd.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/builtins/cd/cd.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -63,13 +63,4 @@
 	argc = cli_count_args(argv);
 
-	/* Handle cd -- -. Override to switch to a directory named '-' */
-	bool hyphen_override = false;
-	if (argc == 3) {
-		if(!str_cmp(argv[1], "--")) {
-			hyphen_override = true;
-			argc--;
-		}
-	}
-
 	/* We don't yet play nice with whitespace, a getopt implementation should
 	 * protect "quoted\ destination" as a single argument. Its not our job to
@@ -88,32 +79,8 @@
 	}
 
-	/* We have the correct # of arguments */
-	// TODO: handle tidle (~) expansion? */
+	/* We have the correct # of arguments
+     * TODO: handle tidle (~) expansion? */
 
-	/* Handle 'cd -' first. */
-	if (!str_cmp(argv[1], "-") && !hyphen_override) {
-		char *buffer = (char *) malloc(PATH_MAX);
-		if (!buffer) {
-			cli_error(CL_ENOMEM, "Cannot switch to previous directory");
-			return CMD_FAILURE;
-		}
-		memset(buffer, 0, PATH_MAX);
-		getprevwd(buffer, PATH_MAX);
-		if (*buffer == '\0') {
-			cli_error(CL_EFAIL, "No previous directory to switch to");
-			free(buffer);
-			return CMD_FAILURE;
-		} else {
-			rc = chdir(buffer);
-			free(buffer);
-		}
-	} else if (hyphen_override) {
-		/* Handles 'cd -- <dirname>'.
-		 * Override for directory named '-'.
-		 */
-		rc = chdir(argv[2]);
-	} else {
-		rc = chdir(argv[1]);
-	}
+	rc = chdir(argv[1]);
 
 	if (rc == 0) {
Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -52,6 +52,6 @@
 #define CAT_VERSION "0.0.1"
 #define CAT_DEFAULT_BUFLEN 1024
-#define CAT_FULL_FILE 0
-
+
+static const char *cat_oops = "That option is not yet supported\n";
 static const char *hexchars = "0123456789abcdef";
 
@@ -163,12 +163,10 @@
 }
 
-static unsigned int cat_file(const char *fname, size_t blen, bool hex,
-    off64_t head, off64_t tail, bool tail_first)
+static unsigned int cat_file(const char *fname, size_t blen, bool hex)
 {
 	int fd, bytes = 0, count = 0, reads = 0;
 	char *buff = NULL;
 	int i;
-	size_t offset = 0, copied_bytes = 0;
-	off64_t file_size = 0, length = 0;
+	size_t offset = 0;
 
 	fd = open(fname, O_RDONLY);
@@ -185,34 +183,8 @@
 	}
 
-	if (tail != CAT_FULL_FILE) {
-		file_size = lseek(fd, 0, SEEK_END);
-		if (head == CAT_FULL_FILE) {
-			head = file_size;
-			length = tail;
-		} else if (tail_first) {
-			length = head;
-		} else {
-			if (tail > head)
-				tail = head;
-			length = tail;
-		}
-
-		if (tail_first) {
-			lseek(fd, (tail >= file_size) ? 0 : (file_size - tail), SEEK_SET);
-		} else {
-			lseek(fd, ((head - tail) >= file_size) ? 0 : (head - tail), SEEK_SET);
-		}
-	} else
-		length = head;
-
 	do {
-		bytes = read(fd, buff + copied_bytes, (
-			(length != CAT_FULL_FILE && length - (off64_t)count <= (off64_t)(blen - copied_bytes)) ?
-			(size_t)(length - count) :
-			(blen - copied_bytes) ) );
-		bytes += copied_bytes;
-		copied_bytes = 0;
-
+		bytes = read(fd, buff, blen);
 		if (bytes > 0) {
+			count += bytes;
 			buff[bytes] = '\0';
 			offset = 0;
@@ -221,5 +193,4 @@
 					paged_char(hexchars[((uint8_t)buff[i])/16]);
 					paged_char(hexchars[((uint8_t)buff[i])%16]);
-					paged_char(((count+i+1) & 0xf) == 0 ? '\n' : ' ');
 				}
 				else {
@@ -228,10 +199,4 @@
 						/* Reached end of string */
 						break;
-					} else if (c == U_SPECIAL && offset + 2 >= (size_t)bytes) {
-						/* If an extended character is cut off due to the size of the buffer,
-						   we will copy it over to the next buffer so it can be read correctly. */
-						copied_bytes = bytes - offset + 1;
-						memcpy(buff, buff + offset - 1, copied_bytes);
-						break;
 					}
 					paged_char(c);
@@ -239,8 +204,7 @@
 				
 			}
-			count += bytes;
 			reads++;
 		}
-	} while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
+	} while (bytes > 0 && !should_quit);
 
 	close(fd);
@@ -259,11 +223,8 @@
 int cmd_cat(char **argv)
 {
-	unsigned int argc, i, ret = 0;
-	size_t buffer = 0;
+	unsigned int argc, i, ret = 0, buffer = 0;
 	int c, opt_ind;
-	aoff64_t head = CAT_FULL_FILE, tail = CAT_FULL_FILE;
 	bool hex = false;
 	bool more = false;
-	bool tailFirst = false;
 	sysarg_t rows, cols;
 	int rc;
@@ -293,22 +254,11 @@
 			return CMD_SUCCESS;
 		case 'H':
-			if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK ) {
-				puts("Invalid head size\n");
-				return CMD_FAILURE;
-			}
-			break;
+			printf("%s", cat_oops);
+			return CMD_FAILURE;
 		case 't':
-			if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK ) {
-				puts("Invalid tail size\n");
-				return CMD_FAILURE;
-			}
-			if (head == CAT_FULL_FILE)
-				tailFirst = true;
-			break;
+			printf("%s", cat_oops);
+			return CMD_FAILURE;
 		case 'b':
-			if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK ) {
-				puts("Invalid buffer size\n");
-				return CMD_FAILURE;
-			}
+			printf("%s", cat_oops);
 			break;
 		case 'm':
@@ -329,5 +279,5 @@
 	}
 
-	if (buffer < 4)
+	if (buffer <= 0)
 		buffer = CAT_DEFAULT_BUFLEN;
 	
@@ -345,5 +295,5 @@
 
 	for (i = optind; argv[i] != NULL && !should_quit; i++)
-		ret += cat_file(argv[i], buffer, hex, head, tail, tailFirst);
+		ret += cat_file(argv[i], buffer, hex);
 
 	if (ret)
Index: uspace/app/bdsh/cmds/modules/cat/cat.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -4,4 +4,6 @@
 /* Prototypes for the cat command, excluding entry points */
 
+static unsigned int cat_file(const char *, size_t, bool);
+
 #endif /* CAT_H */
 
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -30,6 +30,4 @@
 #include <stdlib.h>
 #include <unistd.h>
-#include <io/console.h>
-#include <io/keycode.h>
 #include <getopt.h>
 #include <str.h>
@@ -48,10 +46,8 @@
 
 static const char *cmdname = "cp";
-static console_ctrl_t *con;
 
 static struct option const long_options[] = {
 	{ "buffer", required_argument, 0, 'b' },
 	{ "force", no_argument, 0, 'f' },
-	{ "interactive", no_argument, 0, 'i'},
 	{ "recursive", no_argument, 0, 'r' },
 	{ "help", no_argument, 0, 'h' },
@@ -143,39 +139,6 @@
 }
 
-static bool get_user_decision(bool bdefault, const char *message, ...)
-{
-	va_list args;
-
-	va_start(args, message);
-	vprintf(message, args);
-	va_end(args);
-
-	while (true) {
-		kbd_event_t ev;
-		console_flush(con);
-		console_get_kbd_event(con, &ev);
-		if ((ev.type != KEY_PRESS)
-		    || (ev.mods & (KM_CTRL | KM_ALT)) != 0) {
-			continue;
-		}
-
-		switch(ev.key) {
-		case KC_Y:
-			printf("y\n");
-			return true;
-		case KC_N:
-			printf("n\n");
-			return false;
-		case KC_ENTER:
-			printf("%c\n", bdefault ? 'Y' : 'N');
-			return bdefault;
-		default:
-			break;
-		}
-	}
-}
-
 static int64_t do_copy(const char *src, const char *dest,
-    size_t blen, int vb, int recursive, int force, int interactive)
+    size_t blen, int vb, int recursive, int force)
 {
 	int r = -1;
@@ -229,9 +192,8 @@
 			/* e.g. cp file_name existing_file */
 
-			/* dest already exists, 
-			 * if force is set we will try to remove it.
-			 * if interactive is set user input is required.
+			/* dest already exists, if force is set we will
+			 * try to remove it.
 			 */
-			if (force && !interactive) {
+			if (force) {
 				if (unlink(dest_path)) {
 					printf("Unable to remove %s\n",
@@ -239,21 +201,6 @@
 					goto exit;
 				}
-			} else if (!force && interactive) {
-				bool overwrite = get_user_decision(false,
-				    "File already exists: %s. Overwrite? [y/N]: ",
-				    dest_path);
-				if (overwrite) {
-					printf("Overwriting file: %s\n", dest_path);
-					if (unlink(dest_path)) {
-						printf("Unable to remove %s\n", dest_path);
-						goto exit;
-					}
-				} else {
-					printf("Not overwriting file: %s\n", dest_path);
-					r = 0;
-					goto exit;
-				}
 			} else {
-				printf("File already exists: %s\n", dest_path);
+				printf("file already exists: %s\n", dest_path);
 				goto exit;
 			}
@@ -355,5 +302,5 @@
 			/* Recursively call do_copy() */
 			r = do_copy(src_dent, dest_dent, blen, vb, recursive,
-			    force, interactive);
+			    force);
 			if (r)
 				goto exit;
@@ -368,4 +315,5 @@
 	return r;
 }
+
 
 static int64_t copy_file(const char *src, const char *dest,
@@ -432,6 +380,5 @@
 	    "  -v, --version    Print version information and exit\n"
 	    "  -V, --verbose    Be annoyingly noisy about what's being done\n"
-	    "  -f, --force      Do not complain when <dest> exists (overrides a previous -i)\n"
-	    "  -i, --interactive Ask what to do when <dest> exists (overrides a previous -f)\n"
+	    "  -f, --force      Do not complain when <dest> exists\n"
 	    "  -r, --recursive  Copy entire directories\n"
 	    "  -b, --buffer ## Set the read buffer size to ##\n";
@@ -450,13 +397,12 @@
 	unsigned int argc, verbose = 0;
 	int buffer = 0, recursive = 0;
-	int force = 0, interactive = 0;
+	int force = 0;
 	int c, opt_ind;
 	int64_t ret;
 
-	con = console_init(stdin, stdout);
 	argc = cli_count_args(argv);
 
 	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "hvVfrb:", long_options, &opt_ind);
 		switch (c) { 
 		case 'h':
@@ -470,10 +416,5 @@
 			break;
 		case 'f':
-			interactive = 0;
 			force = 1;
-			break;
-		case 'i':
-			force = 0;
-			interactive = 1;
 			break;
 		case 'r':
@@ -485,5 +426,4 @@
 				    "(should be a number greater than zero)\n",
 				    cmdname);
-				console_done(con);
 				return CMD_FAILURE;
 			}
@@ -502,12 +442,9 @@
 		printf("%s: invalid number of arguments. Try %s --help\n",
 		    cmdname, cmdname);
-		console_done(con);
 		return CMD_FAILURE;
 	}
 
 	ret = do_copy(argv[optind], argv[optind + 1], buffer, verbose,
-	    recursive, force, interactive);
-
-	console_done(con);
+	    recursive, force);
 
 	if (ret == 0)
Index: uspace/app/bdsh/cmds/modules/help/help.h
===================================================================
--- uspace/app/bdsh/cmds/modules/help/help.h	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/help/help.h	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -3,4 +3,5 @@
 
 /* Prototypes for the help command (excluding entry points) */
+static int is_mod_or_builtin(char *);
 
 #endif
Index: uspace/app/bdsh/cmds/modules/mkdir/mkdir.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir.h	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/mkdir/mkdir.h	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -4,4 +4,5 @@
 /* Prototypes for the mkdir command, excluding entry points */
 
+static unsigned int create_directory(const char *, unsigned int);
 #endif /* MKDIR_H */
 
Index: uspace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -46,4 +46,6 @@
 #define RM_VERSION "0.0.1"
 
+static rm_job_t rm;
+
 static struct option const long_options[] = {
 	{ "help", no_argument, 0, 'h' },
@@ -55,38 +57,4 @@
 };
 
-/* Return values for rm_scope() */
-#define RM_BOGUS 0
-#define RM_FILE  1
-#define RM_DIR   2
-
-/* Flags for rm_update() */
-#define _RM_ENTRY   0
-#define _RM_ADVANCE 1
-#define _RM_REWIND  2
-#define _RM_EXIT    3
-
-/* A simple job structure */
-typedef struct {
-	/* Options set at run time */
-	unsigned int force;      /* -f option */
-	unsigned int recursive;  /* -r option */
-	unsigned int safe;       /* -s option */
-
-	/* Keeps track of the job in progress */
-	int advance; /* How far deep we've gone since entering */
-	DIR *entry;  /* Entry point to the tree being removed */
-	char *owd;   /* Where we were when we invoked rm */
-	char *cwd;   /* Current directory being transversed */
-	char *nwd;   /* Next directory to be transversed */
-
-	/* Counters */
-	int f_removed; /* Number of files unlinked */
-	int d_removed; /* Number of directories unlinked */
-} rm_job_t;
-
-static rm_job_t rm;
-
-static unsigned int rm_recursive(const char *);
-
 static unsigned int rm_start(rm_job_t *rm)
 {
@@ -127,33 +95,4 @@
 	if (NULL != rm->cwd)
 		free(rm->cwd);
-}
-
-static unsigned int rm_single(const char *path)
-{
-	if (unlink(path)) {
-		cli_error(CL_EFAIL, "rm: could not remove file %s", path);
-		return 1;
-	}
-	return 0;
-}
-
-static unsigned int rm_scope(const char *path)
-{
-	int fd;
-	DIR *dirp;
-
-	dirp = opendir(path);
-	if (dirp) {
-		closedir(dirp);
-		return RM_DIR;
-	}
-
-	fd = open(path, O_RDONLY);
-	if (fd > 0) {
-		close(fd);
-		return RM_FILE;
-	}
-
-	return RM_BOGUS;
 }
 
@@ -215,4 +154,33 @@
 
 	return ret + 1;
+}
+
+static unsigned int rm_single(const char *path)
+{
+	if (unlink(path)) {
+		cli_error(CL_EFAIL, "rm: could not remove file %s", path);
+		return 1;
+	}
+	return 0;
+}
+
+static unsigned int rm_scope(const char *path)
+{
+	int fd;
+	DIR *dirp;
+
+	dirp = opendir(path);
+	if (dirp) {
+		closedir(dirp);
+		return RM_DIR;
+	}
+
+	fd = open(path, O_RDONLY);
+	if (fd > 0) {
+		close(fd);
+		return RM_FILE;
+	}
+
+	return RM_BOGUS;
 }
 
Index: uspace/app/bdsh/cmds/modules/rm/rm.h
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.h	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/rm/rm.h	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -2,5 +2,41 @@
 #define RM_H
 
+/* Return values for rm_scope() */
+#define RM_BOGUS 0
+#define RM_FILE  1
+#define RM_DIR   2
+
+/* Flags for rm_update() */
+#define _RM_ENTRY   0
+#define _RM_ADVANCE 1
+#define _RM_REWIND  2
+#define _RM_EXIT    3
+
+/* A simple job structure */
+typedef struct {
+	/* Options set at run time */
+	unsigned int force;      /* -f option */
+	unsigned int recursive;  /* -r option */
+	unsigned int safe;       /* -s option */
+
+	/* Keeps track of the job in progress */
+	int advance; /* How far deep we've gone since entering */
+	DIR *entry;  /* Entry point to the tree being removed */
+	char *owd;   /* Where we were when we invoked rm */
+	char *cwd;   /* Current directory being transversed */
+	char *nwd;   /* Next directory to be transversed */
+
+	/* Counters */
+	int f_removed; /* Number of files unlinked */
+	int d_removed; /* Number of directories unlinked */
+} rm_job_t;
+
+
 /* Prototypes for the rm command, excluding entry points */
+static unsigned int rm_start(rm_job_t *);
+static void rm_end(rm_job_t *rm);
+static unsigned int rm_recursive(const char *);
+static unsigned int rm_single(const char *);
+static unsigned int rm_scope(const char *);
 
 #endif /* RM_H */
Index: uspace/app/bdsh/cmds/modules/sleep/sleep.c
===================================================================
--- uspace/app/bdsh/cmds/modules/sleep/sleep.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/bdsh/cmds/modules/sleep/sleep.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -27,8 +27,6 @@
  */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include "config.h"
 #include "util.h"
@@ -43,68 +41,7 @@
 void help_cmd_sleep(unsigned int level)
 {
-	if (level == HELP_SHORT) {
-		printf("`%s' pauses for a given time interval\n", cmdname);
-	} else {
-		help_cmd_sleep(HELP_SHORT);
-		printf(
-		    "Usage:  %s <duration>\n"
-		    "The duration is a decimal number of seconds.\n",
-		    cmdname);
-	}
-
+	printf("This is the %s help for '%s'.\n",
+		level ? EXT_HELP : SHORT_HELP, cmdname);
 	return;
-}
-
-/** Convert string containing decimal seconds to useconds_t.
- *
- * @param nptr   Pointer to string.
- * @param result Result of the conversion.
- * @return EOK if conversion was successful.
- */
-static int decimal_to_useconds(const char *nptr, useconds_t *result)
-{
-	int ret;
-	uint64_t whole_seconds;
-	uint64_t frac_seconds;
-	char *endptr;
-
-	/* Check for whole seconds */
-	if (*nptr == '.') {
-		whole_seconds = 0;
-		endptr = (char *)nptr;
-	} else {
-		ret = str_uint64_t(nptr, &endptr, 10, false, &whole_seconds);
-		if (ret != EOK)
-			return ret;
-	}
-
-	/* Check for fractional seconds */
-	if (*endptr == '\0') {
-		frac_seconds = 0;
-	} else if (*endptr == '.' && endptr[1] == '\0') {
-		frac_seconds = 0;
-	} else if (*endptr == '.') {
-		nptr = endptr + 1;
-		ret = str_uint64_t(nptr, &endptr, 10, true, &frac_seconds);
-		if (ret != EOK)
-			return ret;
-
-		int ndigits = endptr - nptr;
-		for (; ndigits < 6; ndigits++) 
-			frac_seconds *= 10;
-		for (; ndigits > 6; ndigits--)
-			frac_seconds /= 10;
-	} else {
-		return EINVAL;
-	}
-
-	/* Check for overflow */
-	useconds_t total = whole_seconds * 1000000 + frac_seconds;
-	if (total / 1000000 != whole_seconds)
-		return EOVERFLOW;
-
-	*result = total;
-
-	return EOK;
 }
 
@@ -112,24 +49,21 @@
 int cmd_sleep(char **argv)
 {
-	int ret;
 	unsigned int argc;
-	useconds_t duration;
+	unsigned int i;
 
 	/* Count the arguments */
-	argc = cli_count_args(argv);
+	for (argc = 0; argv[argc] != NULL; argc ++);
 
-	if (argc != 2) {
-		printf("%s - incorrect number of arguments. Try `help %s'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
+	printf("%s %s\n", TEST_ANNOUNCE, cmdname);
+	printf("%d arguments passed to %s", argc - 1, cmdname);
+
+	if (argc < 2) {
+		printf("\n");
+		return CMD_SUCCESS;
 	}
 
-	ret = decimal_to_useconds(argv[1], &duration);
-	if (ret != EOK) {
-		printf("%s - invalid duration.\n", cmdname);
-		return CMD_FAILURE;
-	}
-
-	(void) usleep(duration);
+	printf(":\n");
+	for (i = 1; i < argc; i++)
+		printf("[%d] -> %s\n", i, argv[i]);
 
 	return CMD_SUCCESS;
Index: uspace/app/sportdmp/sportdmp.c
===================================================================
--- uspace/app/sportdmp/sportdmp.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/sportdmp/sportdmp.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -27,20 +27,20 @@
  */
 
+#include <errno.h>
+#include <stdio.h>
+#include <devman.h>
+#include <ipc/devman.h>
 #include <device/char_dev.h>
-#include <errno.h>
 #include <ipc/serial_ctl.h>
-#include <loc.h>
-#include <stdio.h>
 
 #define BUF_SIZE 1
 
-static void syntax_print(void)
-{
-	fprintf(stderr, "Usage: sportdmp <baud> <device_service>\n");
+static void syntax_print() {
+	fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n");
 }
 
 int main(int argc, char **argv)
 {
-	const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a";
+	const char* devpath = "/hw/pci0/00:01.0/com1/a";
 	sysarg_t baud = 9600;
 	
@@ -56,5 +56,5 @@
 	
 	if (argc > 2) {
-		svc_path = argv[2];
+		devpath = argv[2];
 	}
 	
@@ -64,15 +64,15 @@
 	}
 	
-	service_id_t svc_id;
-	int rc = loc_service_get_id(svc_path, &svc_id, IPC_FLAG_BLOCKING);
+	devman_handle_t device;
+	int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING);
 	if (rc != EOK) {
-		fprintf(stderr, "Cannot find device service %s\n", svc_path);
+		fprintf(stderr, "Cannot open device %s\n", devpath);
 		return 1;
 	}
 	
-	async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
+	async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, device,
 	    IPC_FLAG_BLOCKING);
 	if (!sess) {
-		fprintf(stderr, "Failed connecting to service %s\n", svc_path);
+		fprintf(stderr, "Cannot connect device\n");
 	}
 	
@@ -83,5 +83,5 @@
 	
 	if (rc != EOK) {
-		fprintf(stderr, "Failed setting serial properties\n");
+		fprintf(stderr, "Cannot set serial properties\n");
 		return 2;
 	}
@@ -89,5 +89,5 @@
 	uint8_t *buf = (uint8_t *) malloc(BUF_SIZE);
 	if (buf == NULL) {
-		fprintf(stderr, "Failed allocating buffer\n");
+		fprintf(stderr, "Cannot allocate buffer\n");
 		return 3;
 	}
Index: uspace/app/tester/hw/serial/serial1.c
===================================================================
--- uspace/app/tester/hw/serial/serial1.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/tester/hw/serial/serial1.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -42,5 +42,6 @@
 #include <async.h>
 #include <ipc/services.h>
-#include <loc.h>
+#include <ipc/devman.h>
+#include <devman.h>
 #include <device/char_dev.h>
 #include <str.h>
@@ -70,19 +71,19 @@
 		}
 	
-	service_id_t svc_id;
-	int res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a",
-	    &svc_id, IPC_FLAG_BLOCKING);
+	devman_handle_t handle;
+	int res = devman_fun_get_handle("/hw/pci0/00:01.0/com1/a", &handle,
+	    IPC_FLAG_BLOCKING);
 	if (res != EOK)
-		return "Failed getting serial port service ID";
-	
-	async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
+		return "Could not get serial device handle";
+	
+	async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, handle,
 	    IPC_FLAG_BLOCKING);
 	if (!sess)
-		return "Failed connecting to serial device";
+		return "Unable to connect to serial device";
 	
 	char *buf = (char *) malloc(cnt + 1);
 	if (buf == NULL) {
 		async_hangup(sess);
-		return "Failed allocating input buffer";
+		return "Failed to allocate input buffer";
 	}
 	
@@ -111,9 +112,9 @@
 		free(buf);
 		async_hangup(sess);
-		return "Failed setting serial communication parameters";
-	}
-	
-	TPRINTF("Trying reading %zu characters from serial device "
-	    "(svc_id=%" PRIun ")\n", cnt, svc_id);
+		return "Failed to set serial communication parameters";
+	}
+	
+	TPRINTF("Trying to read %zu characters from serial device "
+	    "(handle=%" PRIun ")\n", cnt, handle);
 	
 	size_t total = 0;
@@ -129,5 +130,5 @@
 			free(buf);
 			async_hangup(sess);
-			return "Failed reading from serial device";
+			return "Failed read from serial device";
 		}
 		
@@ -164,5 +165,5 @@
 				free(buf);
 				async_hangup(sess);
-				return "Failed writing to serial device";
+				return "Failed write to serial device";
 			}
 			
Index: uspace/app/websrv/websrv.c
===================================================================
--- uspace/app/websrv/websrv.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/app/websrv/websrv.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -200,5 +200,5 @@
 {
 	if (str_cmp(uri, "/") == 0)
-		uri = "/index.html";
+		uri = "/index.htm";
 	
 	char *fname;
Index: uspace/dist/data/web/bar.htm
===================================================================
--- uspace/dist/data/web/bar.htm	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
+++ uspace/dist/data/web/bar.htm	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -0,0 +1,10 @@
+<html>
+    <head>
+	<title>Bar!</title>
+    </head>
+    <body>
+	<h1>Bar!</h1>
+
+	<a href="/">Back to top</a>
+    </body>
+</html>
Index: pace/dist/data/web/bar.html
===================================================================
--- uspace/dist/data/web/bar.html	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<html>
-    <head>
-	<title>Bar!</title>
-    </head>
-    <body>
-	<h1>Bar!</h1>
-
-	<a href="/">Back to top</a>
-    </body>
-</html>
Index: uspace/dist/data/web/foo.htm
===================================================================
--- uspace/dist/data/web/foo.htm	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
+++ uspace/dist/data/web/foo.htm	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -0,0 +1,10 @@
+<html>
+    <head>
+	<title>Foo!</title>
+    </head>
+    <body>
+	<h1>Foo!</h1>
+
+	<a href="/">Back to top</a>
+    </body>
+</html>
Index: pace/dist/data/web/foo.html
===================================================================
--- uspace/dist/data/web/foo.html	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<html>
-    <head>
-	<title>Foo!</title>
-    </head>
-    <body>
-	<h1>Foo!</h1>
-
-	<a href="/">Back to top</a>
-    </body>
-</html>
Index: uspace/dist/data/web/index.htm
===================================================================
--- uspace/dist/data/web/index.htm	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
+++ uspace/dist/data/web/index.htm	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -0,0 +1,19 @@
+<html>
+    <head>
+        <title>
+    	    Hello from HelenOS!
+        </title>
+    </head>
+    <body>
+        <h1>Hello from HelenOS!</h1>
+        <img src="helenos.png" alt="" style="float: left; margin: 6px;">
+        <p>
+            This web page is brought to you by courtesy of HelenOS web server
+    	    and TCP/IP stack.
+        </p>
+	<p>
+    	    Now <a href="foo.htm">go to page foo</a> or <a href="bar.htm">go
+    	    to bar</a>.
+        </p>
+    </body>
+</html>
Index: pace/dist/data/web/index.html
===================================================================
--- uspace/dist/data/web/index.html	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ 	(revision )
@@ -1,19 +1,0 @@
-<html>
-    <head>
-        <title>
-    	    Hello from HelenOS!
-        </title>
-    </head>
-    <body>
-        <h1>Hello from HelenOS!</h1>
-        <img src="helenos.png" alt="" style="float: left; margin: 6px;">
-        <p>
-            This web page is brought to you by courtesy of HelenOS web server
-    	    and TCP/IP stack.
-        </p>
-	<p>
-    	    Now <a href="foo.html">go to page foo</a> or <a href="bar.html">go
-    	    to bar</a>.
-        </p>
-    </body>
-</html>
Index: uspace/drv/bus/isa/isa.c
===================================================================
--- uspace/drv/bus/isa/isa.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/bus/isa/isa.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -66,4 +66,6 @@
 #include <ops/hw_res.h>
 
+#include <devman.h>
+#include <ipc/devman.h>
 #include <device/hw_res.h>
 
Index: uspace/drv/bus/usb/uhcirh/port.c
===================================================================
--- uspace/drv/bus/usb/uhcirh/port.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/bus/usb/uhcirh/port.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -37,4 +37,5 @@
 #include <str_error.h>
 #include <async.h>
+#include <devman.h>
 
 #include <usb/usb.h>    /* usb_address_t */
Index: uspace/drv/bus/usb/usbhub/port.c
===================================================================
--- uspace/drv/bus/usb/usbhub/port.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/bus/usb/usbhub/port.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -35,4 +35,5 @@
 
 #include <bool.h>
+#include <devman.h>
 #include <errno.h>
 #include <str_error.h>
Index: uspace/drv/char/ns8250/ns8250.c
===================================================================
--- uspace/drv/char/ns8250/ns8250.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/char/ns8250/ns8250.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -74,56 +74,4 @@
 #define DLAB_MASK (1 << 7)
 
-/** Interrupt Enable Register definition. */
-#define	NS8250_IER_RXREADY	(1 << 0)
-#define	NS8250_IER_THRE		(1 << 1)
-#define	NS8250_IER_RXSTATUS	(1 << 2)
-#define	NS8250_IER_MODEM_STATUS	(1 << 3)
-
-/** Interrupt ID Register definition. */
-#define	NS8250_IID_ACTIVE	(1 << 0)
-
-/** FIFO Control Register definition. */
-#define	NS8250_FCR_FIFOENABLE	(1 << 0)
-#define	NS8250_FCR_RXFIFORESET	(1 << 1)
-#define	NS8250_FCR_TXFIFORESET	(1 << 2)
-#define	NS8250_FCR_DMAMODE	(1 << 3)
-#define	NS8250_FCR_RXTRIGGERLOW	(1 << 6)
-#define	NS8250_FCR_RXTRIGGERHI	(1 << 7)
-
-/** Line Control Register definition. */
-#define	NS8250_LCR_STOPBITS	(1 << 2)
-#define	NS8250_LCR_PARITY	(1 << 3)
-#define	NS8250_LCR_SENDBREAK	(1 << 6)
-#define	NS8250_LCR_DLAB		(1 << 7)
-
-/** Modem Control Register definition. */
-#define	NS8250_MCR_DTR		(1 << 0)
-#define	NS8250_MCR_RTS		(1 << 1)
-#define	NS8250_MCR_OUT1		(1 << 2)
-#define	NS8250_MCR_OUT2		(1 << 3)
-#define	NS8250_MCR_LOOPBACK	(1 << 4)
-#define	NS8250_MCR_ALL		(0x1f)
-
-/** Line Status Register definition. */
-#define	NS8250_LSR_RXREADY	(1 << 0)
-#define	NS8250_LSR_OE		(1 << 1)
-#define	NS8250_LSR_PE		(1 << 2)
-#define	NS8250_LSR_FE		(1 << 3)
-#define	NS8250_LSR_BREAK	(1 << 4)
-#define	NS8250_LSR_THRE		(1 << 5)
-#define	NS8250_LSR_TSE		(1 << 6)
-
-/** Modem Status Register definition. */
-#define	NS8250_MSR_DELTACTS	(1 << 0)
-#define	NS8250_MSR_DELTADSR	(1 << 1)
-#define	NS8250_MSR_RITRAILING	(1 << 2)
-#define	NS8250_MSR_DELTADCD	(1 << 3)
-#define	NS8250_MSR_CTS		(1 << 4)
-#define	NS8250_MSR_DSR		(1 << 5)
-#define	NS8250_MSR_RI		(1 << 6)
-#define	NS8250_MSR_DCD		(1 << 7)
-#define	NS8250_MSR_SIGNALS	(NS8250_MSR_CTS | NS8250_MSR_DSR \
-    | NS8250_MSR_RI | NS8250_MSR_DCD)
-
 /** Obtain soft-state structure from function node */
 #define NS8250(fnode) ((ns8250_t *) ((fnode)->dev->driver_data))
@@ -148,15 +96,4 @@
 } stop_bit_t;
 
-/** 8250 UART registers layout. */
-typedef struct {
-	ioport8_t data;		/**< Data register. */
-	ioport8_t ier;		/**< Interrupt Enable Reg. */
-	ioport8_t iid;		/**< Interrupt ID Reg. */
-	ioport8_t lcr;		/**< Line Control Reg. */
-	ioport8_t mcr;		/**< Modem Control Reg. */
-	ioport8_t lsr;		/**< Line Status Reg. */
-	ioport8_t msr;		/**< Modem Status Reg. */
-} ns8250_regs_t;
-
 /** The driver data for the serial port devices. */
 typedef struct ns8250 {
@@ -165,6 +102,4 @@
 	/** DDF function node */
 	ddf_fun_t *fun;
-	/** I/O registers **/
-	ns8250_regs_t *regs;
 	/** Is there any client conntected to the device? */
 	bool client_connected;
@@ -189,7 +124,7 @@
  *			otherwise.
  */
-static bool ns8250_received(ns8250_regs_t *regs)
-{
-	return (pio_read_8(&regs->lsr) & NS8250_LSR_RXREADY) != 0;
+static bool ns8250_received(ioport8_t *port)
+{
+	return (pio_read_8(port + 5) & 1) != 0;
 }
 
@@ -199,7 +134,7 @@
  * @return		The data read.
  */
-static uint8_t ns8250_read_8(ns8250_regs_t *regs)
-{
-	return pio_read_8(&regs->data);
+static uint8_t ns8250_read_8(ioport8_t *port)
+{
+	return pio_read_8(port);
 }
 
@@ -208,7 +143,7 @@
  * @param port		The base address of the serial port device's ports.
  */
-static bool is_transmit_empty(ns8250_regs_t *regs)
-{
-	return (pio_read_8(&regs->lsr) & NS8250_LSR_THRE) != 0;
+static bool is_transmit_empty(ioport8_t *port)
+{
+	return (pio_read_8(port + 5) & 0x20) != 0;
 }
 
@@ -218,10 +153,10 @@
  * @param c		The character to be written to the serial port device.
  */
-static void ns8250_write_8(ns8250_regs_t *regs, uint8_t c)
-{
-	while (!is_transmit_empty(regs))
+static void ns8250_write_8(ioport8_t *port, uint8_t c)
+{
+	while (!is_transmit_empty(port))
 		;
 	
-	pio_write_8(&regs->data, c);
+	pio_write_8(port, c);
 }
 
@@ -258,5 +193,5 @@
 {
 	fibril_mutex_lock(&ns->mutex);
-	ns8250_write_8(ns->regs, c);
+	ns8250_write_8(ns->port, c);
 	fibril_mutex_unlock(&ns->mutex);
 }
@@ -277,5 +212,5 @@
 		ns8250_putchar(ns, (uint8_t) buf[idx]);
 	
-	return count;
+	return 0;
 }
 
@@ -331,6 +266,4 @@
 		return false;
 	}
-
-	ns->regs = (ns8250_regs_t *)ns->port;
 	
 	return true;
@@ -346,19 +279,19 @@
 	ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ns->dev->name);
 	
+	ioport8_t *port_addr = ns->port;
 	bool res = true;
 	uint8_t olddata;
 	
-	olddata = pio_read_8(&ns->regs->mcr);
-	
-	pio_write_8(&ns->regs->mcr, NS8250_MCR_LOOPBACK);
-	if (pio_read_8(&ns->regs->msr) & NS8250_MSR_SIGNALS)
+	olddata = pio_read_8(port_addr + 4);
+	
+	pio_write_8(port_addr + 4, 0x10);
+	if (pio_read_8(port_addr + 6) & 0xf0)
 		res = false;
 	
-	pio_write_8(&ns->regs->mcr, NS8250_MCR_ALL);
-	if ((pio_read_8(&ns->regs->msr) & NS8250_MSR_SIGNALS) 
-	    != NS8250_MSR_SIGNALS)
+	pio_write_8(port_addr + 4, 0x1f);
+	if ((pio_read_8(port_addr + 6) & 0xf0) != 0xf0)
 		res = false;
 	
-	pio_write_8(&ns->regs->mcr, olddata);
+	pio_write_8(port_addr + 4, olddata);
 	
 	if (!res) {
@@ -457,10 +390,8 @@
  * @param port		The base address of the serial port device's ports.
  */
-static inline void ns8250_port_interrupts_enable(ns8250_regs_t *regs)
-{
-	/* Interrupt when data received. */
-	pio_write_8(&regs->ier, NS8250_IER_RXREADY);
-	pio_write_8(&regs->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS 
-	    | NS8250_MCR_OUT2);
+static inline void ns8250_port_interrupts_enable(ioport8_t *port)
+{
+	pio_write_8(port + 1, 0x1);	/* Interrupt when data received. */
+	pio_write_8(port + 4, 0xB);
 }
 
@@ -469,7 +400,7 @@
  * @param port		The base address of the serial port device's ports
  */
-static inline void ns8250_port_interrupts_disable(ns8250_regs_t *regs)
-{
-	pio_write_8(&regs->ier, 0x0);	/* Disable all interrupts. */
+static inline void ns8250_port_interrupts_disable(ioport8_t *port)
+{
+	pio_write_8(port + 1, 0x0);	/* Disable all interrupts. */
 }
 
@@ -500,5 +431,5 @@
 
 	/* Enable interrupt on the serial port. */
-	ns8250_port_interrupts_enable(ns->regs);
+	ns8250_port_interrupts_enable(ns->port);
 	
 	return EOK;
@@ -512,8 +443,8 @@
  * @param port		The base address of the serial port device's ports.
  */
-static inline void enable_dlab(ns8250_regs_t *regs)
-{
-	uint8_t val = pio_read_8(&regs->lcr);
-	pio_write_8(&regs->lcr, val | NS8250_LCR_DLAB);
+static inline void enable_dlab(ioport8_t *port)
+{
+	uint8_t val = pio_read_8(port + 3);
+	pio_write_8(port + 3, val | DLAB_MASK);
 }
 
@@ -522,8 +453,8 @@
  * @param port		The base address of the serial port device's ports.
  */
-static inline void clear_dlab(ns8250_regs_t *regs)
-{
-	uint8_t val = pio_read_8(&regs->lcr);
-	pio_write_8(&regs->lcr, val & (~NS8250_LCR_DLAB));
+static inline void clear_dlab(ioport8_t *port)
+{
+	uint8_t val = pio_read_8(port + 3);
+	pio_write_8(port + 3, val & (~DLAB_MASK));
 }
 
@@ -535,5 +466,5 @@
  *			if the specified baud_rate is not valid).
  */
-static int ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
+static int ns8250_port_set_baud_rate(ioport8_t *port, unsigned int baud_rate)
 {
 	uint16_t divisor;
@@ -551,12 +482,12 @@
 	
 	/* Enable DLAB to be able to access baud rate divisor. */
-	enable_dlab(regs);
+	enable_dlab(port);
 	
 	/* Set divisor low byte. */
-	pio_write_8(&regs->data, div_low);
+	pio_write_8(port + 0, div_low);
 	/* Set divisor high byte. */
-	pio_write_8(&regs->ier, div_high);
-	
-	clear_dlab(regs);
+	pio_write_8(port + 1, div_high);
+	
+	clear_dlab(port);
 	
 	return EOK;
@@ -568,5 +499,5 @@
  * @param baud_rate	The ouput parameter to which the baud rate is stored.
  */
-static unsigned int ns8250_port_get_baud_rate(ns8250_regs_t *regs)
+static unsigned int ns8250_port_get_baud_rate(ioport8_t *port)
 {
 	uint16_t divisor;
@@ -574,12 +505,12 @@
 	
 	/* Enable DLAB to be able to access baud rate divisor. */
-	enable_dlab(regs);
+	enable_dlab(port);
 	
 	/* Get divisor low byte. */
-	div_low = pio_read_8(&regs->data);
+	div_low = pio_read_8(port + 0);
 	/* Get divisor high byte. */
-	div_high = pio_read_8(&regs->ier);
-	
-	clear_dlab(regs);
+	div_high = pio_read_8(port + 1);
+	
+	clear_dlab(port);
 	
 	divisor = (div_high << 8) | div_low;
@@ -594,11 +525,11 @@
  * @param stop_bits	The number of stop bits used (one or two).
  */
-static void ns8250_port_get_com_props(ns8250_regs_t *regs, unsigned int *parity,
+static void ns8250_port_get_com_props(ioport8_t *port, unsigned int *parity,
     unsigned int *word_length, unsigned int *stop_bits)
 {
 	uint8_t val;
 	
-	val = pio_read_8(&regs->lcr);
-	*parity = ((val >> NS8250_LCR_PARITY) & 7);
+	val = pio_read_8(port + 3);
+	*parity = ((val >> 3) & 7);
 	
 	switch (val & 3) {
@@ -617,5 +548,5 @@
 	}
 	
-	if ((val >> NS8250_LCR_STOPBITS) & 1)
+	if ((val >> 2) & 1)
 		*stop_bits = 2;
 	else
@@ -631,5 +562,5 @@
  *			is invalid.
  */
-static int ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
+static int ns8250_port_set_com_props(ioport8_t *port, unsigned int parity,
     unsigned int word_length, unsigned int stop_bits)
 {
@@ -655,8 +586,8 @@
 	switch (stop_bits) {
 	case 1:
-		val |= ONE_STOP_BIT << NS8250_LCR_STOPBITS;
+		val |= ONE_STOP_BIT << 2;
 		break;
 	case 2:
-		val |= TWO_STOP_BITS << NS8250_LCR_STOPBITS;
+		val |= TWO_STOP_BITS << 2;
 		break;
 	default:
@@ -670,5 +601,5 @@
 	case SERIAL_MARK_PARITY:
 	case SERIAL_SPACE_PARITY:
-		val |= parity << NS8250_LCR_PARITY;
+		val |= parity << 3;
 		break;
 	default:
@@ -676,5 +607,5 @@
 	}
 	
-	pio_write_8(&regs->lcr, val);
+	pio_write_8(port + 3, val);
 	
 	return EOK;
@@ -689,20 +620,19 @@
 static void ns8250_initialize_port(ns8250_t *ns)
 {
+	ioport8_t *port = ns->port;
+	
 	/* Disable interrupts. */
-	ns8250_port_interrupts_disable(ns->regs);
+	ns8250_port_interrupts_disable(port);
 	/* Set baud rate. */
-	ns8250_port_set_baud_rate(ns->regs, 38400);
+	ns8250_port_set_baud_rate(port, 38400);
 	/* 8 bits, no parity, two stop bits. */
-	ns8250_port_set_com_props(ns->regs, SERIAL_NO_PARITY, 8, 2);
+	ns8250_port_set_com_props(port, SERIAL_NO_PARITY, 8, 2);
 	/* Enable FIFO, clear them, with 14-byte threshold. */
-	pio_write_8(&ns->regs->iid, NS8250_FCR_FIFOENABLE
-	    | NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET 
-	    | NS8250_FCR_RXTRIGGERLOW | NS8250_FCR_RXTRIGGERHI);
+	pio_write_8(port + 2, 0xC7);
 	/*
 	 * RTS/DSR set (Request to Send and Data Terminal Ready lines enabled),
 	 * Aux Output2 set - needed for interrupts.
 	 */
-	pio_write_8(&ns->regs->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS
-	    | NS8250_MCR_OUT2);
+	pio_write_8(port + 4, 0x0B);
 }
 
@@ -714,9 +644,9 @@
 {
 	/* Disable FIFO */
-	pio_write_8(&ns->regs->iid, 0x00);
+	pio_write_8(ns->port + 2, 0x00);
 	/* Disable DTR, RTS, OUT1, OUT2 (int. enable) */
-	pio_write_8(&ns->regs->mcr, 0x00);
+	pio_write_8(ns->port + 4, 0x00);
 	/* Disable all interrupts from the port */
-	ns8250_port_interrupts_disable(ns->regs);
+	ns8250_port_interrupts_disable(ns->port);
 }
 
@@ -728,5 +658,5 @@
 static void ns8250_read_from_device(ns8250_t *ns)
 {
-	ns8250_regs_t *regs = ns->regs;
+	ioport8_t *port = ns->port;
 	bool cont = true;
 	
@@ -734,7 +664,7 @@
 		fibril_mutex_lock(&ns->mutex);
 		
-		cont = ns8250_received(regs);
+		cont = ns8250_received(port);
 		if (cont) {
-			uint8_t val = ns8250_read_8(regs);
+			uint8_t val = ns8250_read_8(port);
 			
 			if (ns->client_connected) {
@@ -966,11 +896,11 @@
 {
 	ns8250_t *data = (ns8250_t *) dev->driver_data;
-	ns8250_regs_t *regs = data->regs;
+	ioport8_t *port = data->port;
 	
 	fibril_mutex_lock(&data->mutex);
-	ns8250_port_interrupts_disable(regs);
-	*baud_rate = ns8250_port_get_baud_rate(regs);
-	ns8250_port_get_com_props(regs, parity, word_length, stop_bits);
-	ns8250_port_interrupts_enable(regs);
+	ns8250_port_interrupts_disable(port);
+	*baud_rate = ns8250_port_get_baud_rate(port);
+	ns8250_port_get_com_props(port, parity, word_length, stop_bits);
+	ns8250_port_interrupts_enable(port);
 	fibril_mutex_unlock(&data->mutex);
 	
@@ -997,13 +927,13 @@
 	
 	ns8250_t *data = (ns8250_t *) dev->driver_data;
-	ns8250_regs_t *regs = data->regs;
+	ioport8_t *port = data->port;
 	int ret;
 	
 	fibril_mutex_lock(&data->mutex);
-	ns8250_port_interrupts_disable(regs);
-	ret = ns8250_port_set_baud_rate(regs, baud_rate);
+	ns8250_port_interrupts_disable(port);
+	ret = ns8250_port_set_baud_rate(port, baud_rate);
 	if (ret == EOK)
-		ret = ns8250_port_set_com_props(regs, parity, word_length, stop_bits);
-	ns8250_port_interrupts_enable(regs);
+		ret = ns8250_port_set_com_props(port, parity, word_length, stop_bits);
+	ns8250_port_interrupts_enable(port);
 	fibril_mutex_unlock(&data->mutex);
 	
Index: uspace/drv/char/ps2mouse/main.c
===================================================================
--- uspace/drv/char/ps2mouse/main.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/char/ps2mouse/main.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -35,4 +35,5 @@
 #include <libarch/inttypes.h>
 #include <ddf/driver.h>
+#include <devman.h>
 #include <device/hw_res_parsed.h>
 #include <errno.h>
Index: uspace/drv/char/xtkbd/main.c
===================================================================
--- uspace/drv/char/xtkbd/main.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/char/xtkbd/main.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -35,4 +35,5 @@
 #include <libarch/inttypes.h>
 #include <ddf/driver.h>
+#include <devman.h>
 #include <device/hw_res_parsed.h>
 #include <errno.h>
Index: uspace/drv/infrastructure/root/root.c
===================================================================
--- uspace/drv/infrastructure/root/root.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/infrastructure/root/root.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -53,4 +53,6 @@
 #include <ddf/driver.h>
 #include <ddf/log.h>
+#include <devman.h>
+#include <ipc/devman.h>
 
 #define NAME "root"
Index: uspace/drv/infrastructure/rootpc/rootpc.c
===================================================================
--- uspace/drv/infrastructure/rootpc/rootpc.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/infrastructure/rootpc/rootpc.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -48,4 +48,6 @@
 #include <ddf/driver.h>
 #include <ddf/log.h>
+#include <devman.h>
+#include <ipc/devman.h>
 #include <ipc/dev_iface.h>
 #include <ops/hw_res.h>
Index: uspace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/drv/nic/e1k/e1k.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -46,4 +46,5 @@
 #include <ddf/log.h>
 #include <ddf/interrupt.h>
+#include <devman.h>
 #include <device/hw_res_parsed.h>
 #include <device/pci.h>
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -58,16 +58,9 @@
 static async_sess_t *vfs_sess = NULL;
 
-/* Current (working) directory. */
 static FIBRIL_MUTEX_INITIALIZE(cwd_mutex);
+
 static int cwd_fd = -1;
 static char *cwd_path = NULL;
 static size_t cwd_size = 0;
-
-/* Previous directory. */
-static FIBRIL_MUTEX_INITIALIZE(pwd_mutex);
-static int pwd_fd = -1;
-static char *pwd_path = NULL;
-static size_t pwd_size = 0;
-
 
 /** Start an async exchange on the VFS session.
@@ -758,21 +751,11 @@
 	fibril_mutex_lock(&cwd_mutex);
 	
-
-	fibril_mutex_lock(&pwd_mutex);
-
-	if (pwd_fd >= 0)
-		close(pwd_fd);
-
-
-	if (pwd_path)
-		free(pwd_path);
-
-
-	pwd_fd = cwd_fd;
-	pwd_path = cwd_path;
-	pwd_size = cwd_size;
-
-	fibril_mutex_unlock(&pwd_mutex);
-
+	if (cwd_fd >= 0)
+		close(cwd_fd);
+	
+	
+	if (cwd_path)
+		free(cwd_path);
+	
 	cwd_fd = fd;
 	cwd_path = abs;
@@ -798,23 +781,4 @@
 	fibril_mutex_unlock(&cwd_mutex);
 	
-	return buf;
-}
-
-
-char *getprevwd(char *buf, size_t size)
-{
-	if (size == 0)
-		return NULL;
-
-	fibril_mutex_lock(&pwd_mutex);
-
-	if ((pwd_size == 0) || (size < pwd_size + 1)) {
-		fibril_mutex_unlock(&pwd_mutex);
-		return NULL;
-	}
-
-	str_cpy(buf, size, pwd_path);
-	fibril_mutex_unlock(&pwd_mutex);
-
 	return buf;
 }
Index: uspace/lib/c/include/unistd.h
===================================================================
--- uspace/lib/c/include/unistd.h	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/lib/c/include/unistd.h	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -58,5 +58,5 @@
 #define getpagesize()  (PAGE_SIZE)
 
-extern int dup2(int, int);
+extern int dup2(int oldfd, int newfd);
 
 extern ssize_t write(int, const void *, size_t);
@@ -73,6 +73,5 @@
 extern int unlink(const char *);
 
-extern char *getcwd(char *, size_t);
-extern char *getprevwd(char *, size_t);
+extern char *getcwd(char *buf, size_t);
 extern int rmdir(const char *);
 extern int chdir(const char *);
Index: uspace/lib/net/generic/net_remote.c
===================================================================
--- uspace/lib/net/generic/net_remote.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/lib/net/generic/net_remote.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -40,4 +40,5 @@
 #include <malloc.h>
 #include <async.h>
+#include <devman.h>
 #include <generic.h>
 #include <net/modules.h>
Index: uspace/lib/usb/src/ddfiface.c
===================================================================
--- uspace/lib/usb/src/ddfiface.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/lib/usb/src/ddfiface.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -33,4 +33,5 @@
  * Implementations of DDF interfaces functions (actual implementation).
  */
+#include <ipc/devman.h>
 #include <devman.h>
 #include <async.h>
Index: uspace/lib/usbvirt/src/ipc_dev.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_dev.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/lib/usbvirt/src/ipc_dev.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -38,4 +38,5 @@
 #include <assert.h>
 #include <async.h>
+#include <devman.h>
 #include <usbvirt/device.h>
 #include <usbvirt/ipc.h>
Index: uspace/lib/usbvirt/src/ipc_hc.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_hc.c	(revision 814752508c9a361c0614c3827238008185400fb7)
+++ uspace/lib/usbvirt/src/ipc_hc.c	(revision 6582b36b3085fe964712dc72fe8a8726ff99ad74)
@@ -38,4 +38,5 @@
 #include <assert.h>
 #include <async.h>
+#include <devman.h>
 #include <usbvirt/device.h>
 #include <usbvirt/ipc.h>
