Index: kernel/arch/amd64/include/asm.h
===================================================================
--- kernel/arch/amd64/include/asm.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ kernel/arch/amd64/include/asm.h	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -41,6 +41,4 @@
 #include <trace.h>
 
-#define IO_SPACE_BOUNDARY	((void *) (64 * 1024))
-
 /** Return base address of current stack.
  *
@@ -79,4 +77,6 @@
 }
 
+#define IO_SPACE_BOUNDARY	((void *) (64 * 1024))
+
 /** Byte from port
  *
@@ -91,5 +91,4 @@
 	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
 		uint8_t val;
-		
 		asm volatile (
 			"inb %w[port], %b[val]\n"
@@ -97,8 +96,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint8_t) *port;
+	}
 }
 
@@ -115,5 +114,4 @@
 	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
 		uint16_t val;
-		
 		asm volatile (
 			"inw %w[port], %w[val]\n"
@@ -121,8 +119,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint16_t) *port;
+	}
 }
 
@@ -139,5 +137,4 @@
 	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
 		uint32_t val;
-		
 		asm volatile (
 			"inl %w[port], %[val]\n"
@@ -145,8 +142,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint32_t) *port;
+	}
 }
 
@@ -166,6 +163,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);	
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -185,6 +183,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -204,6 +203,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);
-	} else
+	} else {
 		*port = val;
+	}
 }
 
Index: kernel/arch/ia32/include/asm.h
===================================================================
--- kernel/arch/ia32/include/asm.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ kernel/arch/ia32/include/asm.h	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -118,6 +118,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);	
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -137,6 +138,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -156,6 +158,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -172,5 +175,4 @@
 	if (((void *)port) < IO_SPACE_BOUNDARY) {
 		uint8_t val;
-		
 		asm volatile (
 			"inb %w[port], %b[val]\n"
@@ -178,8 +180,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint8_t) *port;
+	}
 }
 
@@ -196,5 +198,4 @@
 	if (((void *)port) < IO_SPACE_BOUNDARY) {
 		uint16_t val;
-		
 		asm volatile (
 			"inw %w[port], %w[val]\n"
@@ -202,8 +203,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint16_t) *port;
+	}
 }
 
@@ -220,5 +221,4 @@
 	if (((void *)port) < IO_SPACE_BOUNDARY) {
 		uint32_t val;
-		
 		asm volatile (
 			"inl %w[port], %[val]\n"
@@ -226,8 +226,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint32_t) *port;
+	}
 }
 
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/Makefile	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -176,5 +176,4 @@
 	lib/block \
 	lib/clui \
-	lib/fmtutil \
 	lib/scsi \
 	lib/softint \
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/Makefile.common	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -112,5 +112,4 @@
 LIBIMGMAP_PREFIX = $(LIB_PREFIX)/imgmap
 LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
-LIBFMTUTIL_PREFIX = $(LIB_PREFIX)/fmtutil
 
 LIBEXT2_PREFIX = $(LIB_PREFIX)/ext2
Index: uspace/app/bdsh/Makefile
===================================================================
--- uspace/app/bdsh/Makefile	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/app/bdsh/Makefile	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -29,8 +29,7 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a \
-	$(LIBFMTUTIL_PREFIX)/libfmtutil.a
-EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) \
-	-I$(LIBFMTUTIL_PREFIX) -I. -Icmds/ -Icmds/builtins -Icmds/modules
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a
+EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) -I. -Icmds/ \
+	-Icmds/builtins -Icmds/modules
 BINARY = bdsh
 
Index: uspace/app/bdsh/cmds/modules/help/help.c
===================================================================
--- uspace/app/bdsh/cmds/modules/help/help.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/app/bdsh/cmds/modules/help/help.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -1,5 +1,4 @@
 /*
  * Copyright (c) 2008 Tim Post
- * Copyright (c) 2011 Martin Sucha
  * All rights reserved.
  *
@@ -31,5 +30,4 @@
 #include <stdlib.h>
 #include <str.h>
-#include <fmtutil.h>
 
 #include "config.h"
@@ -130,28 +128,26 @@
 static void help_survival(void)
 {
-	print_wrapped_console(
-	    "Don't panic!\n\n"
+	printf("Don't panic!\n\n");
 
-	    "This is Bdsh, the Brain dead shell, currently "
+	printf("This is Bdsh, the Brain dead shell, currently "
 	    "the primary user interface to HelenOS. Bdsh allows you to enter "
 	    "commands and supports history (Up, Down arrow keys), "
 	    "line editing (Left Arrow, Right Arrow, Home, End, Backspace), "
 	    "selection (Shift + movement keys), copy and paste (Ctrl-C, "
-	    "Ctrl-V), similar to common desktop environments.\n\n"
+	    "Ctrl-V), similar to common desktop environments.\n\n");
 
-	    "The most basic filesystem commands are Bdsh builtins. Type "
+	printf("The most basic filesystem commands are Bdsh builtins. Type "
 	    "'help commands' [Enter] to see the list of Bdsh builtin commands. "
 	    "Other commands are external executables located in the /app and "
 	    "/srv directories. Type 'ls /app' [Enter] and 'ls /srv' [Enter] "
 	    "to see their list. You can execute an external command simply "
-	    "by entering its name (e.g. type 'tetris' [Enter]).\n\n"
+	    "by entering its name (e.g. type 'tetris' [Enter]).\n\n");
 
-	    "HelenOS has virtual consoles (VCs). You can switch between "
-	    "these using the F1-F11 keys.\n\n"
+	printf("HelenOS has virtual consoles (VCs). You can switch between "
+	    "these using the F1-F11 keys.\n\n");
 
-	    "This is but a small glimpse of what you can do with HelenOS. "
+	printf("This is but a small glimpse of what you can do with HelenOS. "
 	    "To learn more please point your browser to the HelenOS User's "
-	    "Guide: http://trac.helenos.org/wiki/UsersGuide\n\n",
-	    ALIGN_LEFT);
+	    "Guide: http://trac.helenos.org/trac.fcgi/wiki/UsersGuide\n\n");
 }
 
Index: uspace/app/bdsh/compl.c
===================================================================
--- uspace/app/bdsh/compl.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/app/bdsh/compl.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -90,22 +90,16 @@
 {
 	compl_t *cs = NULL;
+	size_t pref_size;
 	char *stext = NULL;
 	char *prefix = NULL;
 	char *dirname = NULL;
-	int retval;
-	
-	token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
-	if (tokens == NULL) {
-		retval = ENOMEM;
-		goto error;
-	}
-	
-	size_t pref_size;
 	char *rpath_sep;
 	static const char *dirlist_arg[] = { ".", NULL };
+	int retval;
 	tokenizer_t tok;
-	ssize_t current_token;
+	token_t tokens[WORD_MAX];
+	unsigned int current_token;
 	size_t tokens_length;
-	
+
 	cs = calloc(1, sizeof(compl_t));
 	if (!cs) {
@@ -113,5 +107,5 @@
 		goto error;
 	}
-	
+
 	/* Convert text buffer to string */
 	stext = wstr_to_astr(text);
@@ -133,11 +127,8 @@
 	
 	/* Find the current token */
-	for (current_token = 0; current_token < (ssize_t) tokens_length;
-	    current_token++) {
+	for (current_token = 0; current_token < tokens_length; current_token++) {
 		token_t *t = &tokens[current_token];
 		size_t end = t->char_start + t->char_length;
-		
-		/*
-		 * Check if the caret lies inside the token or immediately
+		/* Check if the caret lies inside the token or immediately
 		 * after it
 		 */
@@ -147,14 +138,12 @@
 	}
 	
-	if (tokens_length == 0)
-		current_token = -1;
-	
-	if ((current_token >= 0) && (tokens[current_token].type != TOKTYPE_SPACE))
+	if (tokens[current_token].type != TOKTYPE_SPACE) {
 		*cstart = tokens[current_token].char_start;
-	else
+	}
+	else {
 		*cstart = pos;
-	
-	/*
-	 * Extract the prefix being completed
+	}
+	
+	/* Extract the prefix being completed
 	 * XXX: handle strings, etc.
 	 */
@@ -165,10 +154,7 @@
 		goto error;
 	}
-	prefix[pref_size] = 0;
-
-	if (current_token >= 0) {
-		str_ncpy(prefix, pref_size + 1, stext +
-		    tokens[current_token].byte_start, pref_size);
-	}
+
+	str_ncpy(prefix, pref_size + 1, stext +
+	    tokens[current_token].byte_start, pref_size);
 
 	/*
@@ -179,13 +165,14 @@
 
 	/* Skip any whitespace before current token */
-	ssize_t prev_token = current_token - 1;
-	if ((prev_token >= 0) && (tokens[prev_token].type == TOKTYPE_SPACE))
+	int prev_token = current_token - 1;
+	if (prev_token != -1 && tokens[prev_token].type == TOKTYPE_SPACE) {
 		prev_token--;
-	
+	}
+
 	/*
 	 * It is a command if it is the first token or if it immediately
 	 * follows a pipe token.
 	 */
-	if ((prev_token < 0) || (tokens[prev_token].type == TOKTYPE_SPACE))
+	if (prev_token == -1 || tokens[prev_token].type == TOKTYPE_SPACE)
 		cs->is_command = true;
 	else
@@ -262,6 +249,4 @@
 	if (cs != NULL)
 		free(cs);
-	if (tokens != NULL)
-		free(tokens);
 
 	return retval;
Index: uspace/app/bdsh/input.c
===================================================================
--- uspace/app/bdsh/input.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/app/bdsh/input.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -67,9 +67,7 @@
 int process_input(cliuser_t *usr)
 {
-	token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
-	if (tokens == NULL)
-		return ENOMEM;
-	
 	char *cmd[WORD_MAX];
+	token_t tokens_space[WORD_MAX];
+	token_t *tokens = tokens_space;
 	int rc = 0;
 	tokenizer_t tok;
@@ -79,8 +77,6 @@
 	char *redir_to = NULL;
 
-	if (usr->line == NULL) {
-		free(tokens);
+	if (NULL == usr->line)
 		return CL_EFAIL;
-	}
 
 	rc = tok_init(&tok, usr->line, tokens, WORD_MAX);
@@ -213,5 +209,4 @@
 	}
 	tok_fini(&tok);
-	free(tokens);
 
 	return rc;
Index: uspace/app/tester/stdio/stdio1.c
===================================================================
--- uspace/app/tester/stdio/stdio1.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/app/tester/stdio/stdio1.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -39,5 +39,5 @@
 {
 	FILE *file;
-	const char *file_name = "/textdemo";
+	const char *file_name = "/readme";
 	
 	TPRINTF("Open file \"%s\"...", file_name);
Index: uspace/dist/readme
===================================================================
--- uspace/dist/readme	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
+++ uspace/dist/readme	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -0,0 +1,10 @@
+Multilingual text test
+----------------------
+
+English:  Quick brown fox jumps over the lazy dog
+Czech:    Příliš žluťoučký kůň úpěl ďábelské ódy
+Greek:    Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε
+Hebrew:   משוואת ברנולי היא משוואה בהידרודינמיקה
+Arabic:   التوزيع الجغرافي للحمل العنقودي
+Russian:  Леннон познакомился с художницей-авангардисткой
+Armenian: Սկսեց հրատարակվել Երուսաղեմի հայկական
Index: uspace/dist/src/sysel/demos/htxtfile.sy
===================================================================
--- uspace/dist/src/sysel/demos/htxtfile.sy	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/dist/src/sysel/demos/htxtfile.sy	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -35,5 +35,5 @@
 		var out_file : TextFile;
 
-		name = "/textdemo";
+		name = "/readme";
 
 		in_file = new TextFile();
Index: pace/dist/textdemo
===================================================================
--- uspace/dist/textdemo	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ 	(revision )
@@ -1,10 +1,0 @@
-Multilingual text test
-----------------------
-
-English:  Quick brown fox jumps over the lazy dog
-Czech:    Příliš žluťoučký kůň úpěl ďábelské ódy
-Greek:    Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε
-Hebrew:   משוואת ברנולי היא משוואה בהידרודינמיקה
-Arabic:   التوزيع الجغرافي للحمل العنقودي
-Russian:  Леннон познакомился с художницей-авангардисткой
-Armenian: Սկսեց հրատարակվել Երուսաղեմի հայկական
Index: uspace/lib/c/arch/ia32/include/ddi.h
===================================================================
--- uspace/lib/c/arch/ia32/include/ddi.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/arch/ia32/include/ddi.h	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -43,5 +43,4 @@
 	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
 		uint8_t val;
-		
 		asm volatile (
 			"inb %w[port], %b[val]\n"
@@ -49,8 +48,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint8_t) *port;
+	}
 }
 
@@ -59,5 +58,4 @@
 	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
 		uint16_t val;
-		
 		asm volatile (
 			"inw %w[port], %w[val]\n"
@@ -65,8 +63,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint16_t) *port;
+	}
 }
 
@@ -75,5 +73,4 @@
 	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
 		uint32_t val;
-		
 		asm volatile (
 			"inl %w[port], %[val]\n"
@@ -81,8 +78,8 @@
 			: [port] "d" (port)
 		);
-		
 		return val;
-	} else
+	} else {
 		return (uint32_t) *port;
+	}
 }
 
@@ -94,6 +91,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);	
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -105,6 +103,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);
-	} else
+	} else {
 		*port = val;
+	}
 }
 
@@ -116,6 +115,7 @@
 			:: [val] "a" (val), [port] "d" (port)
 		);
-	} else
+	} else {
 		*port = val;
+	}
 }
 
Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/generic/async.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -1656,22 +1656,4 @@
 	
 	return sess;
-}
-
-/** Set arguments for new connections.
- *
- * FIXME This is an ugly hack to work around the problem that parallel
- * exchanges are implemented using parallel connections. When we create
- * a callback session, the framework does not know arguments for the new
- * connections.
- *
- * The proper solution seems to be to implement parallel exchanges using
- * tagging.
- */
-void async_sess_args_set(async_sess_t *sess, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3)
-{
-	sess->arg1 = arg1;
-	sess->arg2 = arg2;
-	sess->arg3 = arg3;
 }
 
Index: uspace/lib/c/generic/devman.c
===================================================================
--- uspace/lib/c/generic/devman.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/generic/devman.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -89,5 +89,5 @@
 			if (devman_driver_block_sess == NULL)
 				devman_driver_block_sess =
-				    service_connect_blocking(EXCHANGE_PARALLEL,
+				    service_connect_blocking(EXCHANGE_SERIALIZE,
 				    SERVICE_DEVMAN, DEVMAN_DRIVER, 0);
 		}
@@ -138,5 +138,5 @@
 		if (devman_driver_sess == NULL)
 			devman_driver_sess =
-			    service_connect(EXCHANGE_PARALLEL, SERVICE_DEVMAN,
+			    service_connect(EXCHANGE_SERIALIZE, SERVICE_DEVMAN,
 			    DEVMAN_DRIVER, 0);
 		
Index: uspace/lib/c/generic/ns.c
===================================================================
--- uspace/lib/c/generic/ns.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/generic/ns.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -56,11 +56,4 @@
 	async_exchange_end(exch);
 	
-	/*
-	 * FIXME Ugly hack to work around limitation of implementing
-	 * parallel exchanges using multiple connections. Shift out
-	 * first argument for non-initial connections.
-	 */
-	async_sess_args_set(sess, arg2, arg3, 0);
-	
 	return sess;
 }
@@ -73,11 +66,4 @@
 	    async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
 	async_exchange_end(exch);
-	
-	/*
-	 * FIXME Ugly hack to work around limitation of implementing
-	 * parallel exchanges using multiple connections. Shift out
-	 * first argument for non-initial connections.
-	 */
-	async_sess_args_set(sess, arg2, arg3, 0);
 	
 	return sess;
Index: uspace/lib/c/generic/str.c
===================================================================
--- uspace/lib/c/generic/str.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/generic/str.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -2,5 +2,4 @@
  * Copyright (c) 2005 Martin Decky
  * Copyright (c) 2008 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
  * All rights reserved.
  *
@@ -719,23 +718,4 @@
 
 	dest[dlen - 1] = '\0';
-}
-
-/** Convert string to wide string.
- *
- * Convert string @a src to wide string. A new wide NULL-terminated
- * string will be allocated on the heap.
- *
- * @param src	Source string.
- */
-wchar_t *str_to_awstr(const char *str)
-{
-	size_t len = str_length(str);
-	
-	wchar_t *wstr = calloc(len+1, sizeof(wchar_t));
-	if (wstr == NULL)
-		return NULL;
-	
-	str_to_wstr(wstr, len + 1, str);
-	return wstr;
 }
 
Index: uspace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/include/async.h	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -337,10 +337,4 @@
 
 /*
- * FIXME These functions just work around problems with parallel exchange
- * management. Proper solution needs to be implemented.
- */
-void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
-
-/*
  * User-friendly wrappers for async_share_in_start().
  */
Index: uspace/lib/c/include/str.h
===================================================================
--- uspace/lib/c/include/str.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/lib/c/include/str.h	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -83,5 +83,4 @@
 extern char *wstr_to_astr(const wchar_t *src);
 extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
-extern wchar_t *str_to_awstr(const char *src);
 
 extern char *str_chr(const char *str, wchar_t ch);
Index: pace/lib/fmtutil/Makefile
===================================================================
--- uspace/lib/fmtutil/Makefile	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2011 Martin Sucha
-# 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.
-#
-
-USPACE_PREFIX = ../..
-EXTRA_CFLAGS = -I.
-LIBRARY = libfmtutil
-
-SOURCES = \
-	fmtutil.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: pace/lib/fmtutil/fmtutil.c
===================================================================
--- uspace/lib/fmtutil/fmtutil.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ 	(revision )
@@ -1,238 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * 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.
- */
-
-#include <io/console.h>
-#include <errno.h>
-#include <malloc.h>
-#include <fmtutil.h>
-
-typedef struct {
-	align_mode_t alignment;
-	bool newline_always;
-	size_t width;
-} printmode_t;
-
-int print_wrapped_console(const char *str, align_mode_t alignment)
-{
-	console_ctrl_t *console = console_init(stdin, stdout);
-	if (console == NULL) {
-		printf("%s", str);
-		return EOK;
-	}
-	sysarg_t con_rows, con_cols, con_col, con_row;
-	int rc = console_get_size(console, &con_cols, &con_rows);
-	if (rc != EOK) {
-		return rc;
-	}
-	rc = console_get_pos(console, &con_col, &con_row);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (con_col != 0) {
-		printf("\n");
-	}
-	return print_wrapped(str, con_cols, alignment);
-}
-
-/** Line consumer that prints the lines aligned according to spec
- *
- **/
-static int print_line(wchar_t *wstr, size_t chars, bool last, void *data)
-{
-	printmode_t *pm = (printmode_t *) data;
-	wchar_t old_char = wstr[chars];
-	wstr[chars] = 0;
-	int rc = print_aligned_w(wstr, pm->width, last, pm->alignment);
-	wstr[chars] = old_char;
-	return rc;
-}
-
-int print_wrapped(const char *str, size_t width, align_mode_t mode)
-{
-	printmode_t pm;
-	pm.alignment = mode;
-	pm.newline_always = false;
-	pm.width = width;
-	wchar_t *wstr = str_to_awstr(str);
-	if (wstr == NULL) {
-		return ENOMEM;
-	}
-	int rc = wrap(wstr, width, print_line, &pm);
-	free(wstr);
-	return rc;
-}
-
-int print_aligned_w(const wchar_t *wstr, size_t width, bool last,
-    align_mode_t mode)
-{
-	size_t i;
-	size_t len = wstr_length(wstr);
-	if (mode == ALIGN_LEFT || (mode == ALIGN_JUSTIFY && last)) {
-		for (i = 0; i < width; i++) {
-			if (i < len)
-				putchar(wstr[i]);
-			else
-				putchar(' ');
-		}
-	}
-	else if (mode == ALIGN_RIGHT) {
-		for (i = 0; i < width; i++) {
-			if (i < width - len)
-				putchar(' ');
-			else
-				putchar(wstr[i- (width - len)]);
-		}
-	}
-	else if (mode == ALIGN_CENTER) {
-		size_t padding = (width - len) / 2;
-		for (i = 0; i < width; i++) {
-			if ((i < padding) || ((i - padding) >= len))
-				putchar(' ');
-			else
-				putchar(wstr[i-padding]);
-		}
-	}
-	else if (mode == ALIGN_JUSTIFY) {
-		size_t words = 0;
-		size_t word_chars = 0;
-		bool space = true;
-		for (i = 0; i < len; i++) {
-			if (space && wstr[i] != ' ') {
-				words++;
-			}
-			space = wstr[i] == ' ';
-			if (!space) word_chars++;
-		}
-		size_t done_words = 0;
-		size_t done_chars = 0;
-		if (words == 0)
-			goto skip_words;
-		size_t excess_spaces = width - word_chars - (words-1);
-		space = true;
-		i = 0;
-		size_t j;
-		while (i < len) {
-			/* Find a word */
-			while (i < len && wstr[i] == ' ') i++;
-			if (i == len) break;
-			if (done_words) {
-				size_t spaces = 1 + (((done_words *
-				    excess_spaces) / (words - 1)) -
-				    (((done_words - 1) * excess_spaces) /
-				    (words - 1)));
-				for (j = 0; j < spaces; j++) {
-					putchar(' ');
-				}
-				done_chars += spaces;
-			}
-			while (i < len && wstr[i] != ' ') {
-				putchar(wstr[i++]);
-				done_chars++;
-			}
-			done_words++;
-		}
-skip_words:
-		while (done_chars < width) {
-			putchar(' ');
-			done_chars++;
-		}
-	}
-	else {
-		return EINVAL;
-	}
-	
-	return EOK;
-}
-int print_aligned(const char *str, size_t width, bool last, align_mode_t mode)
-{
-	wchar_t *wstr = str_to_awstr(str);
-	if (wstr == NULL) {
-		return ENOMEM;
-	}
-	int rc = print_aligned_w(wstr, width, last, mode);
-	free(wstr);
-	return rc;
-}
-
-int wrap(wchar_t *wstr, size_t width, line_consumer_fn consumer, void *data)
-{
-	size_t word_start = 0;
-	size_t last_word_end = 0;
-	size_t line_start = 0;
-	size_t line_len = 0;
-	size_t pos = 0;
-	
-	/*
-	 * Invariants:
-	 *  * line_len = last_word_end - line_start
-	 *  * line_start <= last_word_end <= word_start <= pos
-	 */
-	
-	while (wstr[pos] != 0) {
-		/* Skip spaces and process newlines */
-		while (wstr[pos] == ' ' || wstr[pos] == '\n') {
-			if (wstr[pos] == '\n') {
-				consumer(wstr + line_start, line_len, true,
-				    data);
-				last_word_end = line_start = pos + 1;
-				line_len = 0;
-			}
-			pos++;
-		}
-		word_start = pos;
-		/* Find end of word */
-		while (wstr[pos] != 0 && wstr[pos] != ' ' &&
-		    wstr[pos] != '\n')
-			pos++;
-		bool last = wstr[pos] == 0;
-		/* Check if the line still fits width */
-		if (pos - line_start > width) {
-			if (line_len > 0)
-				consumer(wstr + line_start, line_len, last,
-				    data);
-			line_start = last_word_end = word_start;
-			line_len = 0;
-		}
-		/* Check if we need to force wrap of long word*/
-		if (pos - word_start > width) {
-			consumer(wstr + word_start, width, last, data);
-			pos = line_start = last_word_end = word_start + width;
-			line_len = 0;
-		}
-		last_word_end = pos;
-		line_len = last_word_end - line_start;
-	}
-	/* Here we have less than width chars starting from line_start.
-	 * Moreover, the last portion does not contain spaces or newlines 
-	 */
-	if (pos - line_start > 0)
-		consumer(wstr + line_start, pos - line_start, true, data);
-
-	return EOK;
-}
-
Index: pace/lib/fmtutil/fmtutil.h
===================================================================
--- uspace/lib/fmtutil/fmtutil.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * 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.
- */
-
-typedef enum {
-	ALIGN_LEFT,
-	ALIGN_RIGHT,
-	ALIGN_CENTER,
-	ALIGN_JUSTIFY
-} align_mode_t;
-
-/** Callback that processes a line of characters.
- * (e.g. as a result of wrap operation)
- * 
- * @param content pointer to line data (note: this is NOT null-terminated)
- * @param size number of characters in line
- * @param end_of_para true if the line is the last line of the paragraph
- * @param data user data
- * 
- * @returns EOK on success or error code on failure
- */
-typedef int (*line_consumer_fn)(wchar_t *, size_t, bool, void *);
-
-extern int print_aligned_w(const wchar_t *, size_t, bool, align_mode_t);
-extern int print_aligned(const char *, size_t, bool, align_mode_t);
-extern int print_wrapped(const char *, size_t, align_mode_t);
-extern int print_wrapped_console(const char *, align_mode_t);
-
-/** Wrap characters in a wide string to the given length.
- *
- * @param wstr the null-terminated wide string to wrap
- * @param size number of characters to wrap to
- * @param consumer the function that receives wrapped lines
- * @param data user data to pass to the consumer function
- */
-extern int wrap(wchar_t *, size_t, line_consumer_fn, void *);
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/srv/devman/devman.h	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -63,9 +63,4 @@
 typedef struct fun_node fun_node_t;
 
-typedef struct {
-	fibril_mutex_t mutex;
-	struct driver *driver;
-} client_t;
-
 typedef enum {
 	/** Driver has not been started. */
Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision ec7f8b191f6709e9dbff29090376b4a072c8e1d0)
+++ uspace/srv/devman/main.c	(revision c4a8e4a6d787a9acf91debd36e746fe8a11a6869)
@@ -65,18 +65,25 @@
 static dev_tree_t device_tree;
 
-static int init_running_drv(void *drv);
-
 /** Register running driver. */
-static driver_t *devman_driver_register(ipc_callid_t callid, ipc_call_t *call)
-{
+static driver_t *devman_driver_register(void)
+{
+	ipc_call_t icall;
+	ipc_callid_t iid;
 	driver_t *driver = NULL;
+
+	log_msg(LVL_DEBUG, "devman_driver_register");
+	
+	iid = async_get_call(&icall);
+	if (IPC_GET_IMETHOD(icall) != DEVMAN_DRIVER_REGISTER) {
+		async_answer_0(iid, EREFUSED);
+		return NULL;
+	}
+	
 	char *drv_name = NULL;
-
-	log_msg(LVL_DEBUG, "devman_driver_register");
 	
 	/* Get driver name. */
 	int rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0);
 	if (rc != EOK) {
-		async_answer_0(callid, rc);
+		async_answer_0(iid, rc);
 		return NULL;
 	}
@@ -91,5 +98,5 @@
 		free(drv_name);
 		drv_name = NULL;
-		async_answer_0(callid, ENOENT);
+		async_answer_0(iid, ENOENT);
 		return NULL;
 	}
@@ -105,5 +112,5 @@
 		    driver->name);
 		fibril_mutex_unlock(&driver->driver_mutex);
-		async_answer_0(callid, EEXISTS);
+		async_answer_0(iid, EEXISTS);
 		return NULL;
 	}
@@ -127,12 +134,12 @@
 	log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.",
 	    driver->name);
-	driver->sess = async_callback_receive(EXCHANGE_PARALLEL);
+	driver->sess = async_callback_receive(EXCHANGE_SERIALIZE);
 	if (!driver->sess) {
 		fibril_mutex_unlock(&driver->driver_mutex);
-		async_answer_0(callid, ENOTSUP);
+		async_answer_0(iid, ENOTSUP);
 		return NULL;
 	}
-	/* FIXME: Work around problem with callback sessions */
-	async_sess_args_set(driver->sess, DRIVER_DEVMAN, 0, 0);
+	
+	fibril_mutex_unlock(&driver->driver_mutex);
 	
 	log_msg(LVL_NOTE,
@@ -140,22 +147,6 @@
 	    driver->name);
 	
-	/*
-	 * Initialize the driver as running (e.g. pass assigned devices to it)
-	 * in a separate fibril; the separate fibril is used to enable the
-	 * driver to use devman service during the driver's initialization.
-	 */
-	fid_t fid = fibril_create(init_running_drv, driver);
-	if (fid == 0) {
-		log_msg(LVL_ERROR, "Failed to create initialization fibril " \
-		    "for driver `%s'.", driver->name);
-		fibril_mutex_unlock(&driver->driver_mutex);
-		async_answer_0(callid, ENOMEM);
-		return NULL;
-	}
-	
-	fibril_add_ready(fid);
-	fibril_mutex_unlock(&driver->driver_mutex);
-	
-	async_answer_0(callid, EOK);
+	async_answer_0(iid, EOK);
+	
 	return driver;
 }
@@ -438,15 +429,23 @@
 static void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall)
 {
-	client_t *client;
-	driver_t *driver;
-	
 	/* Accept the connection. */
 	async_answer_0(iid, EOK);
 	
-	client = async_get_client_data();
-	if (client == NULL) {
-		log_msg(LVL_ERROR, "Failed to allocate client data.");
-		return;
-	}
+	driver_t *driver = devman_driver_register();
+	if (driver == NULL)
+		return;
+	
+	/*
+	 * Initialize the driver as running (e.g. pass assigned devices to it)
+	 * in a separate fibril; the separate fibril is used to enable the
+	 * driver to use devman service during the driver's initialization.
+	 */
+	fid_t fid = fibril_create(init_running_drv, driver);
+	if (fid == 0) {
+		log_msg(LVL_ERROR, "Failed to create initialization fibril " \
+		    "for driver `%s'.", driver->name);
+		return;
+	}
+	fibril_add_ready(fid);
 	
 	while (true) {
@@ -457,26 +456,5 @@
 			break;
 		
-		if (IPC_GET_IMETHOD(call) != DEVMAN_DRIVER_REGISTER) {
-			fibril_mutex_lock(&client->mutex);
-			driver = client->driver;
-			fibril_mutex_unlock(&client->mutex);
-			if (driver == NULL) {
-				/* First call must be to DEVMAN_DRIVER_REGISTER */
-				async_answer_0(callid, ENOTSUP);
-				continue;
-			}
-		}
-		
 		switch (IPC_GET_IMETHOD(call)) {
-		case DEVMAN_DRIVER_REGISTER:
-			fibril_mutex_lock(&client->mutex);
-			if (client->driver != NULL) {
-				fibril_mutex_unlock(&client->mutex);
-				async_answer_0(callid, EINVAL);
-				continue;
-			}
-			client->driver = devman_driver_register(callid, &call);
-			fibril_mutex_unlock(&client->mutex);
-			break;
 		case DEVMAN_ADD_FUNCTION:
 			devman_add_function(callid, &call);
@@ -836,5 +814,5 @@
 static void devman_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
 {
-	/* Select port. */
+	/* Select interface. */
 	switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
 	case DEVMAN_DRIVER:
@@ -862,21 +840,4 @@
 }
 
-static void *devman_client_data_create(void)
-{
-	client_t *client;
-	
-	client = calloc(1, sizeof(client_t));
-	if (client == NULL)
-		return NULL;
-	
-	fibril_mutex_initialize(&client->mutex);
-	return client;
-}
-
-static void devman_client_data_destroy(void *data)
-{
-	free(data);
-}
-
 /** Initialize device manager internal structures. */
 static bool devman_init(void)
@@ -925,7 +886,5 @@
 	}
 	
-	/* Set handlers for incoming connections. */
-	async_set_client_data_constructor(devman_client_data_create);
-	async_set_client_data_destructor(devman_client_data_destroy);
+	/* Set a handler of incomming connections. */
 	async_set_client_connection(devman_connection);
 
