Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/devman/main.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -490,4 +490,6 @@
 	if (rc == EOK) {
 		loc_service_add_to_cat(fun->service_id, cat_id);
+		log_msg(LVL_NOTE, "Function `%s' added to category `%s'.",
+		    fun->pathname, cat_name);
 	} else {
 		log_msg(LVL_ERROR, "Failed adding function `%s' to category "
@@ -495,11 +497,8 @@
 	}
 	
-	log_msg(LVL_NOTE, "Function `%s' added to category `%s'.",
-	    fun->pathname, cat_name);
-
 	fibril_rwlock_read_unlock(&device_tree.rwlock);
 	fun_del_ref(fun);
-
-	async_answer_0(callid, EOK);
+	
+	async_answer_0(callid, rc);
 }
 
Index: uspace/srv/fs/cdfs/cdfs.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/cdfs/cdfs.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -52,4 +52,5 @@
 	.concurrent_read_write = false,
 	.write_retains_size = false,
+	.instance = 0,
 };
 
@@ -58,4 +59,13 @@
 	printf("%s: HelenOS cdfs file system server\n", NAME);
 	
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			cdfs_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			return -1;
+		}
+	}
+
 	if (!cdfs_init()) {
 		printf("%s: failed to initialize cdfs\n", NAME);
Index: uspace/srv/fs/exfat/exfat.c
===================================================================
--- uspace/srv/fs/exfat/exfat.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/exfat/exfat.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -54,5 +54,6 @@
 	.name = NAME,
 	.concurrent_read_write = false,
-	.write_retains_size = false,	
+	.write_retains_size = false,
+	.instance = 0,
 };
 
@@ -60,4 +61,13 @@
 {
 	printf(NAME ": HelenOS exFAT file system server\n");
+
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			exfat_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			return -1;
+		}
+	}
 
 	int rc = exfat_idx_init();
Index: uspace/srv/fs/ext2fs/ext2fs.c
===================================================================
--- uspace/srv/fs/ext2fs/ext2fs.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/ext2fs/ext2fs.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -52,4 +52,5 @@
 vfs_info_t ext2fs_vfs_info = {
 	.name = NAME,
+	.instance = 0,
 };
 
@@ -57,4 +58,13 @@
 {
 	printf(NAME ": HelenOS EXT2 file system server\n");
+
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			ext2fs_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			return -1;
+		}
+	}
 	
 	async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
Index: uspace/srv/fs/fat/fat.c
===================================================================
--- uspace/srv/fs/fat/fat.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/fat/fat.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -54,5 +54,6 @@
 	.name = NAME,
 	.concurrent_read_write = false,
-	.write_retains_size = false,	
+	.write_retains_size = false,
+	.instance = 0,
 };
 
@@ -61,4 +62,13 @@
 	printf(NAME ": HelenOS FAT file system server\n");
 	
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			fat_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			return -1;
+		}
+	}
+
 	int rc = fat_idx_init();
 	if (rc != EOK)
Index: uspace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/fat/fat.h	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -230,4 +230,8 @@
 } fat_node_t;
 
+typedef struct {
+	bool lfn_enabled;
+} fat_instance_t;
+
 extern vfs_out_ops_t fat_ops;
 extern libfs_ops_t fat_libfs_ops;
Index: uspace/srv/fs/fat/fat_directory.c
===================================================================
--- uspace/srv/fs/fat/fat_directory.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/fat/fat_directory.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -262,5 +262,10 @@
 {
 	int rc;
-	bool enable_lfn = true; /* TODO: make this a mount option */
+	void *data;
+	fat_instance_t *instance;
+
+	rc = fs_instance_get(di->nodep->idx->service_id, &data);
+	assert(rc == EOK);
+	instance = (fat_instance_t *) data;
 	
 	if (fat_valid_short_name(name)) {
@@ -277,5 +282,5 @@
 		rc = fat_directory_write_dentry(di, de);
 		return rc;
-	} else if (enable_lfn && fat_valid_name(name)) {
+	} else if (instance->lfn_enabled && fat_valid_name(name)) {
 		/* We should create long entries to store name */
 		int long_entry_count;
@@ -292,5 +297,5 @@
 		if (lfn_size % FAT_LFN_ENTRY_SIZE)
 			long_entry_count++;
-		rc = fat_directory_lookup_free(di, long_entry_count+1);
+		rc = fat_directory_lookup_free(di, long_entry_count + 1);
 		if (rc != EOK)
 			return rc;
@@ -328,5 +333,5 @@
 		FAT_LFN_ORDER(d) |= FAT_LFN_LAST;
 
-		rc = fat_directory_seek(di, start_pos+long_entry_count);
+		rc = fat_directory_seek(di, start_pos + long_entry_count);
 		return rc;
 	}
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -871,22 +871,37 @@
     aoff64_t *size, unsigned *linkcnt)
 {
-	enum cache_mode cmode;
+	enum cache_mode cmode = CACHE_MODE_WB;
 	fat_bs_t *bs;
-	int rc;
-
-	/* Check for option enabling write through. */
-	if (str_cmp(opts, "wtcache") == 0)
-		cmode = CACHE_MODE_WT;
-	else
-		cmode = CACHE_MODE_WB;
+	fat_instance_t *instance;
+	int rc;
+
+	instance = malloc(sizeof(fat_instance_t));
+	if (!instance)
+		return ENOMEM;
+	instance->lfn_enabled = true;
+
+	/* Parse mount options. */
+	char *mntopts = (char *) opts;
+	char *saveptr;
+	char *opt;
+	while ((opt = strtok_r(mntopts, " ,", &saveptr)) != NULL) {
+		if (str_cmp(opt, "wtcache") == 0)
+			cmode = CACHE_MODE_WT;
+		else if (str_cmp(opt, "nolfn") == 0)
+			instance->lfn_enabled = false;
+		mntopts = NULL;
+	}
 
 	/* initialize libblock */
 	rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE);
-	if (rc != EOK)
-		return rc;
+	if (rc != EOK) {
+		free(instance);
+		return rc;
+	}
 
 	/* prepare the boot block */
 	rc = block_bb_read(service_id, BS_BLOCK);
 	if (rc != EOK) {
+		free(instance);
 		block_fini(service_id);
 		return rc;
@@ -897,4 +912,5 @@
 	
 	if (BPS(bs) != BS_SIZE) {
+		free(instance);
 		block_fini(service_id);
 		return ENOTSUP;
@@ -904,4 +920,5 @@
 	rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode);
 	if (rc != EOK) {
+		free(instance);
 		block_fini(service_id);
 		return rc;
@@ -911,4 +928,5 @@
 	rc = fat_sanity_check(bs, service_id);
 	if (rc != EOK) {
+		free(instance);
 		(void) block_cache_fini(service_id);
 		block_fini(service_id);
@@ -918,4 +936,5 @@
 	rc = fat_idx_init_by_service_id(service_id);
 	if (rc != EOK) {
+		free(instance);
 		(void) block_cache_fini(service_id);
 		block_fini(service_id);
@@ -926,4 +945,5 @@
 	fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t));
 	if (!rfn) {
+		free(instance);
 		(void) block_cache_fini(service_id);
 		block_fini(service_id);
@@ -935,4 +955,5 @@
 	fat_node_t *rootp = (fat_node_t *)malloc(sizeof(fat_node_t));
 	if (!rootp) {
+		free(instance);
 		free(rfn);
 		(void) block_cache_fini(service_id);
@@ -945,4 +966,5 @@
 	fat_idx_t *ridxp = fat_idx_get_by_pos(service_id, FAT_CLST_ROOTPAR, 0);
 	if (!ridxp) {
+		free(instance);
 		free(rfn);
 		free(rootp);
@@ -964,4 +986,6 @@
 		rc = fat_clusters_get(&clusters, bs, service_id, rootp->firstc);
 		if (rc != EOK) {
+			fibril_mutex_unlock(&ridxp->lock);
+			free(instance);
 			free(rfn);
 			free(rootp);
@@ -974,4 +998,16 @@
 	} else
 		rootp->size = RDE(bs) * sizeof(fat_dentry_t);
+
+	rc = fs_instance_create(service_id, instance);
+	if (rc != EOK) {
+		fibril_mutex_unlock(&ridxp->lock);
+		free(instance);
+		free(rfn);
+		free(rootp);
+		(void) block_cache_fini(service_id);
+		block_fini(service_id);
+		fat_idx_fini_by_service_id(service_id);
+		return rc;
+	}
 
 	rootp->idx = ridxp;
@@ -1024,4 +1060,10 @@
 	(void) block_cache_fini(service_id);
 	block_fini(service_id);
+
+	void *data;
+	if (fs_instance_get(service_id, &data) == EOK) {
+		fs_instance_destroy(service_id);
+		free(data);
+	}
 
 	return EOK;
Index: uspace/srv/fs/locfs/locfs.c
===================================================================
--- uspace/srv/fs/locfs/locfs.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/locfs/locfs.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -55,4 +55,5 @@
 	.concurrent_read_write = false,
 	.write_retains_size = false,
+	.instance = 0,
 };
 
@@ -61,4 +62,14 @@
 	printf("%s: HelenOS Device Filesystem\n", NAME);
 	
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			locfs_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			return -1;
+		}
+	}
+
+
 	if (!locfs_init()) {
 		printf("%s: failed to initialize locfs\n", NAME);
Index: uspace/srv/fs/locfs/locfs_ops.c
===================================================================
--- uspace/srv/fs/locfs/locfs_ops.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/locfs/locfs_ops.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -593,4 +593,8 @@
 		sysarg_t rc;
 		async_wait_for(msg, &rc);
+
+		/* Do not propagate EHANGUP back to VFS. */
+		if ((int) rc == EHANGUP)
+			rc = ENOTSUP;
 		
 		*rbytes = IPC_GET_ARG1(answer);
@@ -655,4 +659,8 @@
 		sysarg_t rc;
 		async_wait_for(msg, &rc);
+
+		/* Do not propagate EHANGUP back to VFS. */
+		if ((int) rc == EHANGUP)
+			rc = ENOTSUP;
 		
 		*wbytes = IPC_GET_ARG1(answer);
Index: uspace/srv/fs/mfs/mfs.c
===================================================================
--- uspace/srv/fs/mfs/mfs.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/mfs/mfs.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -39,4 +39,6 @@
 
 #include <ipc/services.h>
+#include <stdlib.h>
+#include <str.h>
 #include <ns.h>
 #include <async.h>
@@ -52,4 +54,5 @@
 	.concurrent_read_write = false,
 	.write_retains_size = false,
+	.instance = 0,
 };
 
@@ -59,4 +62,14 @@
 
 	printf(NAME ": HelenOS Minix file system server\n");
+
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			mfs_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			rc = -1;
+			goto err;
+		}
+	}
 
 	async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
Index: uspace/srv/fs/mfs/mfs.h
===================================================================
--- uspace/srv/fs/mfs/mfs.h	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/mfs/mfs.h	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -131,5 +131,4 @@
 
 struct mfs_instance {
-	link_t link;
 	service_id_t service_id;
 	struct mfs_sb_info *sbi;
Index: uspace/srv/fs/mfs/mfs_ops.c
===================================================================
--- uspace/srv/fs/mfs/mfs_ops.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/mfs/mfs_ops.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -73,6 +73,4 @@
 
 
-static LIST_INITIALIZE(inst_list);
-static FIBRIL_MUTEX_INITIALIZE(inst_list_mutex);
 static hash_table_t open_nodes;
 static FIBRIL_MUTEX_INITIALIZE(open_nodes_lock);
@@ -178,6 +176,4 @@
 		goto out_error;
 	}
-
-	instance->open_nodes_cnt = 0;
 
 	sb = malloc(MFS_SUPERBLOCK_SIZE);
@@ -271,12 +267,17 @@
 	}
 
-	/*Initialize the instance structure and add it to the list*/
-	link_initialize(&instance->link);
+	/*Initialize the instance structure and remember it*/
 	instance->service_id = service_id;
 	instance->sbi = sbi;
-
-	fibril_mutex_lock(&inst_list_mutex);
-	list_append(&instance->link, &inst_list);
-	fibril_mutex_unlock(&inst_list_mutex);
+	instance->open_nodes_cnt = 0;
+	rc = fs_instance_create(service_id, instance);
+	if (rc != EOK) {
+		free(instance);
+		free(sbi);
+		block_cache_fini(service_id);
+		block_fini(service_id);
+		mfsdebug("fs instance creation failed\n");
+		return rc;
+	}
 
 	mfsdebug("mount successful\n");
@@ -323,9 +324,6 @@
 	block_fini(service_id);
 
-	/* Remove the instance from the list */
-	fibril_mutex_lock(&inst_list_mutex);
-	list_remove(&inst->link);
-	fibril_mutex_unlock(&inst_list_mutex);
-
+	/* Remove and destroy the instance */
+	(void) fs_instance_destroy(service_id);
 	free(inst->sbi);
 	free(inst);
@@ -1020,28 +1018,15 @@
 mfs_instance_get(service_id_t service_id, struct mfs_instance **instance)
 {
-	struct mfs_instance *instance_ptr;
-
-	fibril_mutex_lock(&inst_list_mutex);
-
-	if (list_empty(&inst_list)) {
-		fibril_mutex_unlock(&inst_list_mutex);
-		return EINVAL;
-	}
-
-	list_foreach(inst_list, link) {
-		instance_ptr = list_get_instance(link, struct mfs_instance,
-						 link);
-
-		if (instance_ptr->service_id == service_id) {
-			*instance = instance_ptr;
-			fibril_mutex_unlock(&inst_list_mutex);
-			return EOK;
-		}
-	}
-
-	mfsdebug("Instance not found\n");
-
-	fibril_mutex_unlock(&inst_list_mutex);
-	return EINVAL;
+	void *data;
+	int rc;
+
+	rc = fs_instance_get(service_id, &data);
+	if (rc == EOK) {
+		*instance = (struct mfs_instance *) data;
+	} else {
+		mfsdebug("instance not found\n");
+	}
+
+	return rc;
 }
 
Index: uspace/srv/fs/tmpfs/tmpfs.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/fs/tmpfs/tmpfs.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -59,4 +59,5 @@
 	.concurrent_read_write = false,
 	.write_retains_size = false,
+	.instance = 0,
 };
 
@@ -64,4 +65,13 @@
 {
 	printf(NAME ": HelenOS TMPFS file system server\n");
+
+	if (argc == 3) {
+		if (!str_cmp(argv[1], "--instance"))
+			tmpfs_vfs_info.instance = strtol(argv[2], NULL, 10);
+		else {
+			printf(NAME " Unrecognized parameters");
+			return -1;
+		}
+	}
 	
 	if (!tmpfs_init()) {
Index: uspace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/hid/console/console.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -344,4 +344,19 @@
 }
 
+static console_t *cons_get_active_uspace(void)
+{
+	fibril_mutex_lock(&switch_mtx);
+
+	console_t *active_uspace = active_console;
+	if (active_uspace == kernel_console) {
+		active_uspace = prev_console;
+	}
+	assert(active_uspace != kernel_console);
+
+	fibril_mutex_unlock(&switch_mtx);
+
+	return active_uspace;
+}
+
 static ssize_t limit(ssize_t val, ssize_t lo, ssize_t hi)
 {
@@ -466,5 +481,13 @@
 				event->c = c;
 				
-				prodcons_produce(&active_console->input_pc, &event->link);
+				/* Kernel console does not read events
+				 * from us, so we will redirect them
+				 * to the (last) active userspace console
+				 * if necessary.
+				 */
+				console_t *target_console = cons_get_active_uspace();
+
+				prodcons_produce(&target_console->input_pc,
+				    &event->link);
 			}
 			
@@ -904,4 +927,5 @@
 		atomic_set(&consoles[i].refcnt, 0);
 		fibril_mutex_initialize(&consoles[i].mtx);
+		prodcons_initialize(&consoles[i].input_pc);
 		
 		if (graphics_state == GRAPHICS_FULL) {
@@ -942,5 +966,4 @@
 		}
 		
-		prodcons_initialize(&consoles[i].input_pc);
 		cons_redraw_state(&consoles[i]);
 		
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/vfs/vfs.h	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -171,5 +171,5 @@
 extern void vfs_exchange_release(async_exch_t *);
 
-extern fs_handle_t fs_name_to_handle(char *, bool);
+extern fs_handle_t fs_name_to_handle(unsigned int instance, char *, bool);
 extern vfs_info_t *fs_handle_to_info(fs_handle_t);
 
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/vfs/vfs_ops.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -146,5 +146,6 @@
 
 			rindex = (fs_index_t) IPC_GET_ARG1(answer);
-			rsize = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(answer), IPC_GET_ARG3(answer));
+			rsize = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(answer),
+			    IPC_GET_ARG3(answer));
 			rlnkcnt = (unsigned) IPC_GET_ARG4(answer);
 			
@@ -276,8 +277,8 @@
 	
 	/*
-	 * For now, don't make use of ARG3, but it can be used to
-	 * carry mount options in the future.
-	 */
-	
+	 * Instance number is passed as ARG3.
+	 */
+	unsigned int instance = IPC_GET_ARG3(*request);
+
 	/* We want the client to send us the mount point. */
 	char *mp;
@@ -335,5 +336,5 @@
 	fs_handle_t fs_handle;
 recheck:
-	fs_handle = fs_name_to_handle(fs_name, false);
+	fs_handle = fs_name_to_handle(instance, fs_name, false);
 	if (!fs_handle) {
 		if (flags & IPC_FLAG_BLOCKING) {
Index: uspace/srv/vfs/vfs_register.c
===================================================================
--- uspace/srv/vfs/vfs_register.c	(revision dcc44ca1ab4f31d537b8abf1b1d6de5dfd97884b)
+++ uspace/srv/vfs/vfs_register.c	(revision 1db44ea7ee4de819d854c7584806a032b665d2a0)
@@ -154,5 +154,6 @@
 	 * Check for duplicit registrations.
 	 */
-	if (fs_name_to_handle(fs_info->vfs_info.name, false)) {
+	if (fs_name_to_handle(fs_info->vfs_info.instance,
+	    fs_info->vfs_info.name, false)) {
 		/*
 		 * We already register a fs like this.
@@ -297,5 +298,5 @@
  *
  */
-fs_handle_t fs_name_to_handle(char *name, bool lock)
+fs_handle_t fs_name_to_handle(unsigned int instance, char *name, bool lock)
 {
 	int handle = 0;
@@ -306,5 +307,6 @@
 	list_foreach(fs_list, cur) {
 		fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
-		if (str_cmp(fs->vfs_info.name, name) == 0) {
+		if (str_cmp(fs->vfs_info.name, name) == 0 &&
+		    instance == fs->vfs_info.instance) {
 			handle = fs->fs_handle;
 			break;
