Index: uspace/app/tester/devmap/devmap1.c
===================================================================
--- uspace/app/tester/devmap/devmap1.c	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/app/tester/devmap/devmap1.c	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -120,70 +120,69 @@
 char * test_devmap1(bool quiet)
 {
-	int driver_phone;
-	int dev1_handle;
-	int dev2_handle;
-	int dev3_handle;
-	int handle;
-	int rc;
-
+	const char *retval = NULL;
+	
 	/* Register new driver */
-	driver_phone = devmap_driver_register("TestDriver",
-	    driver_client_connection);
-
-	if (driver_phone < 0) {
-		return "Error: Cannot register driver.\n";	
-	}
-
+	int rc = devmap_driver_register("TestDriver", driver_client_connection);
+	if (rc < 0) {
+		retval = "Error: Cannot register driver.\n";
+		goto out;
+	}
+	
 	/* Register new device dev1. */
-	rc = devmap_device_register(driver_phone, TEST_DEVICE1, &dev1_handle);
+	dev_handle_t dev1_handle;
+	rc = devmap_device_register(TEST_DEVICE1, &dev1_handle);
 	if (rc != EOK) {
-		ipc_hangup(driver_phone);
-		return "Error: cannot register device.\n";
-	}
-
+		retval = "Error: cannot register device.\n";
+		goto out;
+	}
+	
 	/*
 	 * Get handle for dev2 (Should fail unless device is already registered
 	 * by someone else).
 	 */
+	dev_handle_t handle;
 	rc = devmap_device_get_handle(TEST_DEVICE2, &handle, 0);
 	if (rc == EOK) {
-		ipc_hangup(driver_phone);
-		return "Error: got handle for dev2 before it was registered.\n";
-	}
-
+		retval = "Error: got handle for dev2 before it was registered.\n";
+		goto out;
+	}
+	
 	/* Register new device dev2. */
-	rc = devmap_device_register(driver_phone, TEST_DEVICE2, &dev2_handle);
+	dev_handle_t dev2_handle;
+	rc = devmap_device_register(TEST_DEVICE2, &dev2_handle);
 	if (rc != EOK) {
-		ipc_hangup(driver_phone);
-		return "Error: cannot register device dev2.\n";
-	}
-
+		retval = "Error: cannot register device dev2.\n";
+		goto out;
+	}
+	
 	/* Register device dev1 again. */
-	rc = devmap_device_register(driver_phone, TEST_DEVICE1, &dev3_handle);
+	dev_handle_t dev3_handle;
+	rc = devmap_device_register(TEST_DEVICE1, &dev3_handle);
 	if (rc == EOK) {
-		return "Error: dev1 registered twice.\n";
-	}
-
+		retval = "Error: dev1 registered twice.\n";
+		goto out;
+	}
+	
 	/* Get handle for dev1. */
 	rc = devmap_device_get_handle(TEST_DEVICE1, &handle, 0);
 	if (rc != EOK) {
-		ipc_hangup(driver_phone);
-		return "Error: cannot get handle for 'DEVMAP_DEVICE1'.\n";
-	}
-
+		retval = "Error: cannot get handle for 'DEVMAP_DEVICE1'.\n";
+		goto out;
+	}
+	
 	if (handle != dev1_handle) {
-		ipc_hangup(driver_phone);
-		return "Error: cannot get handle for 'DEVMAP_DEVICE1'.\n";
-	}
-
+		retval = "Error: cannot get handle for 'DEVMAP_DEVICE1'.\n";
+		goto out;
+	}
+	
 	if (device_client(dev1_handle) != EOK) {
-		ipc_hangup(driver_phone);
-		return "Error: failed client test for 'DEVMAP_DEVICE1'.\n";
-	}
-
-	/* TODO: */
-
-	ipc_hangup(driver_phone);
-
+		retval = "Error: failed client test for 'DEVMAP_DEVICE1'.\n";
+		goto out;
+	}
+	
+out:
+	devmap_hangup_phone(DEVMAP_DRIVER);
+	devmap_hangup_phone(DEVMAP_CLIENT);
+	
 	return NULL;
 }
Index: uspace/lib/libc/generic/devmap.c
===================================================================
--- uspace/lib/libc/generic/devmap.c	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/lib/libc/generic/devmap.c	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -36,27 +36,58 @@
 #include <errno.h>
 
-static int devmap_phone = -1;
+static int devmap_phone_driver = -1;
+static int devmap_phone_client = -1;
 
 /** Get phone to device mapper task. */
-static int devmap_get_phone(unsigned int flags)
-{
-	int phone;
-
-	if (devmap_phone >= 0)
-		return devmap_phone;
-
-	if (flags & IPC_FLAG_BLOCKING) {
-		phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
-		    DEVMAP_CLIENT, 0);
-	} else {
-		phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
-		    DEVMAP_CLIENT, 0);
-	}
-
-	if (phone < 0)
-		return phone;
-
-	devmap_phone = phone;
-	return phone;
+int devmap_get_phone(devmap_interface_t iface, unsigned int flags)
+{
+	switch (iface) {
+	case DEVMAP_DRIVER:
+		if (devmap_phone_driver >= 0)
+			return devmap_phone_driver;
+		
+		if (flags & IPC_FLAG_BLOCKING)
+			devmap_phone_driver = ipc_connect_me_to_blocking(PHONE_NS,
+			    SERVICE_DEVMAP, DEVMAP_DRIVER, 0);
+		else
+			devmap_phone_driver = ipc_connect_me_to(PHONE_NS,
+			    SERVICE_DEVMAP, DEVMAP_DRIVER, 0);
+		
+		return devmap_phone_driver;
+	case DEVMAP_CLIENT:
+		if (devmap_phone_client >= 0)
+			return devmap_phone_client;
+		
+		if (flags & IPC_FLAG_BLOCKING)
+			devmap_phone_client = ipc_connect_me_to_blocking(PHONE_NS,
+			    SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+		else
+			devmap_phone_client = ipc_connect_me_to(PHONE_NS,
+			    SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+		
+		return devmap_phone_client;
+	default:
+		return -1;
+	}
+}
+
+void devmap_hangup_phone(devmap_interface_t iface)
+{
+	switch (iface) {
+	case DEVMAP_DRIVER:
+		if (devmap_phone_driver >= 0) {
+			ipc_hangup(devmap_phone_driver);
+			devmap_phone_driver = -1;
+		}
+		break;
+	case DEVMAP_CLIENT:
+		if (devmap_phone_client >= 0) {
+			ipc_hangup(devmap_phone_client);
+			devmap_phone_client = -1;
+		}
+		break;
+	default:
+		break;
+	}
 }
 
@@ -64,58 +95,54 @@
 int devmap_driver_register(const char *name, async_client_conn_t conn)
 {
-	ipcarg_t retval;
-	aid_t req;
-	ipc_call_t answer;
-	int phone;
+	int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
+	
+	if (phone < 0)
+		return phone;
+	
+	ipc_call_t answer;
+	aid_t req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer);
+	
+	ipcarg_t retval = ipc_data_write_start(phone, name, str_size(name) + 1);
+	
+	if (retval != EOK) {
+		async_wait_for(req, NULL);
+		return -1;
+	}
+	
+	async_set_client_connection(conn);
+	
 	ipcarg_t callback_phonehash;
-
-	phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
-	    DEVMAP_DRIVER, 0);
-
-	if (phone < 0) {
+	ipc_connect_to_me(phone, 0, 0, 0, &callback_phonehash);
+	async_wait_for(req, &retval);
+	
+	return retval;
+}
+
+/** Register new device.
+ *
+ * @param name   Device name.
+ * @param handle Output: Handle to the created instance of device.
+ *
+ */
+int devmap_device_register(const char *name, dev_handle_t *handle)
+{
+	int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
+	
+	if (phone < 0)
 		return phone;
-	}
-	
-	req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer);
-	retval = ipc_data_write_start(phone, name, str_size(name) + 1); 
-
-	if (retval != EOK) {
-		async_wait_for(req, NULL);
-		ipc_hangup(phone);
-		return -1;
-	}
-
-	async_set_client_connection(conn);
-
-	ipc_connect_to_me(phone, 0, 0, 0, &callback_phonehash);
-	async_wait_for(req, &retval);
-
-	return phone;
-}
-
-int devmap_device_get_handle(const char *name, dev_handle_t *handle,
-    unsigned int flags)
-{
-	ipcarg_t retval;
-	aid_t req;
-	ipc_call_t answer;
-	int phone;
-
-	phone = devmap_get_phone(flags);
-	if (phone < 0)
-		return phone;
-
-	req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, flags, 0,
+	
+	ipc_call_t answer;
+	aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, 0, 0,
 	    &answer);
-
-	retval = ipc_data_write_start(phone, name, str_size(name) + 1);
-
-	if (retval != EOK) {
-		async_wait_for(req, NULL);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
+	
+	ipcarg_t retval = ipc_data_write_start(phone, name, str_size(name) + 1);
+	
+	if (retval != EOK) {
+		async_wait_for(req, NULL);
+		return retval;
+	}
+	
+	async_wait_for(req, &retval);
+	
 	if (retval != EOK) {
 		if (handle != NULL)
@@ -123,15 +150,47 @@
 		return retval;
 	}
-
+	
 	if (handle != NULL)
-		*handle = (int) IPC_GET_ARG1(answer);
-
+		*handle = (dev_handle_t) IPC_GET_ARG1(answer);
+	
 	return retval;
 }
 
+int devmap_device_get_handle(const char *name, dev_handle_t *handle, unsigned int flags)
+{
+	int phone = devmap_get_phone(DEVMAP_CLIENT, flags);
+	
+	if (phone < 0)
+		return phone;
+	
+	ipc_call_t answer;
+	aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, flags, 0,
+	    &answer);
+	
+	ipcarg_t retval = ipc_data_write_start(phone, name, str_size(name) + 1);
+	
+	if (retval != EOK) {
+		async_wait_for(req, NULL);
+		return retval;
+	}
+	
+	async_wait_for(req, &retval);
+	
+	if (retval != EOK) {
+		if (handle != NULL)
+			*handle = -1;
+		return retval;
+	}
+	
+	if (handle != NULL)
+		*handle = (dev_handle_t) IPC_GET_ARG1(answer);
+	
+	return retval;
+}
+
 int devmap_device_connect(dev_handle_t handle, unsigned int flags)
 {
 	int phone;
-
+	
 	if (flags & IPC_FLAG_BLOCKING) {
 		phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP,
@@ -141,39 +200,45 @@
 		    DEVMAP_CONNECT_TO_DEVICE, handle);
 	}
-
+	
 	return phone;
 }
 
-/** Register new device.
- *
- * @param driver_phone
- * @param name Device name.
- * @param handle Output: Handle to the created instance of device.
- */
-int devmap_device_register(int driver_phone, const char *name, int *handle)
-{
-	ipcarg_t retval;
-	aid_t req;
-	ipc_call_t answer;
-
-	req = async_send_2(driver_phone, DEVMAP_DEVICE_REGISTER, 0, 0,
-	    &answer);
-
-	retval = ipc_data_write_start(driver_phone, name, str_size(name) + 1);
-
-	if (retval != EOK) {
-		async_wait_for(req, NULL);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		if (handle != NULL)
-			*handle = -1;
-		return retval;
-	}
-
-	*handle = (int) IPC_GET_ARG1(answer);
-	return retval;
-}
+ipcarg_t devmap_device_get_count(void)
+{
+	int phone = devmap_get_phone(DEVMAP_CLIENT, IPC_FLAG_BLOCKING);
+	
+	if (phone < 0)
+		return 0;
+	
+	ipcarg_t count;
+	int retval = ipc_call_sync_0_1(phone, DEVMAP_DEVICE_GET_COUNT, &count);
+	if (retval != EOK)
+		return 0;
+	
+	return count;
+}
+
+ipcarg_t devmap_device_get_devices(ipcarg_t count, dev_desc_t *data)
+{
+	int phone = devmap_get_phone(DEVMAP_CLIENT, IPC_FLAG_BLOCKING);
+	
+	if (phone < 0)
+		return 0;
+	
+	ipc_call_t answer;
+	aid_t req = async_send_0(phone, DEVMAP_DEVICE_GET_DEVICES, &answer);
+	
+	ipcarg_t retval = ipc_data_read_start(phone, data, count * sizeof(dev_desc_t));
+	
+	if (retval != EOK) {
+		async_wait_for(req, NULL);
+		return 0;
+	}
+	
+	async_wait_for(req, &retval);
+	
+	if (retval != EOK)
+		return 0;
+	
+	return IPC_GET_ARG1(answer);
+}
Index: uspace/lib/libc/include/devmap.h
===================================================================
--- uspace/lib/libc/include/devmap.h	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/lib/libc/include/devmap.h	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -39,11 +39,15 @@
 #include <async.h>
 
-typedef int dev_handle_t;
+extern int devmap_get_phone(devmap_interface_t, unsigned int);
+extern void devmap_hangup_phone(devmap_interface_t iface);
 
 extern int devmap_driver_register(const char *, async_client_conn_t);
-extern int devmap_device_get_handle(const char *, dev_handle_t *,
-    unsigned int);
+extern int devmap_device_register(const char *, dev_handle_t *);
+
+extern int devmap_device_get_handle(const char *, dev_handle_t *, unsigned int);
 extern int devmap_device_connect(dev_handle_t, unsigned int);
-extern int devmap_device_register(int, const char *, int *);
+
+extern ipcarg_t devmap_device_get_count(void);
+extern ipcarg_t devmap_device_get_devices(ipcarg_t, dev_desc_t *);
 
 #endif
Index: uspace/lib/libc/include/ipc/devmap.h
===================================================================
--- uspace/lib/libc/include/ipc/devmap.h	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/lib/libc/include/ipc/devmap.h	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -38,5 +38,7 @@
 #include <libadt/list.h>
 
-#define DEVMAP_NAME_MAXLEN 512
+#define DEVMAP_NAME_MAXLEN  255
+
+typedef ipcarg_t dev_handle_t;
 
 typedef enum {
@@ -46,55 +48,29 @@
 	DEVMAP_DEVICE_UNREGISTER,
 	DEVMAP_DEVICE_GET_NAME,
-	DEVMAP_DEVICE_GET_HANDLE
+	DEVMAP_DEVICE_GET_HANDLE,
+	DEVMAP_DEVICE_GET_COUNT,
+	DEVMAP_DEVICE_GET_DEVICES
 } devmap_request_t;
 
-/** Representation of device driver.
- * Each driver is responsible for a set of devices.
- */
-typedef struct {
-		/** Pointers to previous and next drivers in linked list */
-	link_t drivers;	
-		/** Pointer to the linked list of devices controlled by
-		 * this driver */
-	link_t devices;
-		/** Phone asociated with this driver */
-	ipcarg_t phone;
-		/** Device driver name */
-	char *name;	
-		/** Futex for list of devices owned by this driver */
-	atomic_t devices_futex;
-} devmap_driver_t;
-
-/** Info about registered device
+/** Interface provided by devmap.
+ *
+ * Every process that connects to devmap must ask one of following
+ * interfaces otherwise connection will be refused.
  *
  */
-typedef struct {
-		/** Pointer to the previous and next device in the list of all devices */
-	link_t devices;
-		/** Pointer to the previous and next device in the list of devices
-		 owned by one driver */
-	link_t driver_devices;
-		/** Unique device identifier  */
-	int handle;
-		/** Device name */
-	char *name;
-		/** Device driver handling this device */
-	devmap_driver_t *driver;
-} devmap_device_t;
-
-/** Interface provided by devmap. 
- * Every process that connects to devmap must ask one of following
- * interfaces otherwise connection will be refused.
- */
 typedef enum {
-		/** Connect as device driver */
-	DEVMAP_DRIVER = 1,	
-		/** Connect as client */
+	/** Connect as device driver */
+	DEVMAP_DRIVER = 1,
+	/** Connect as client */
 	DEVMAP_CLIENT,
-		/** Create new connection to instance of device that
-		 * is specified by second argument of call. */
+	/** Create new connection to instance of device that
+	    is specified by second argument of call. */
 	DEVMAP_CONNECT_TO_DEVICE
 } devmap_interface_t;
 
+typedef struct {
+	dev_handle_t handle;
+	char name[DEVMAP_NAME_MAXLEN + 1];
+} dev_desc_t;
+
 #endif
-
Index: uspace/srv/bd/gxe_bd/gxe_bd.c
===================================================================
--- uspace/srv/bd/gxe_bd/gxe_bd.c	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/srv/bd/gxe_bd/gxe_bd.c	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -116,5 +116,4 @@
 static int gxe_bd_init(void)
 {
-	int driver_phone;
 	dev_handle_t dev_handle;
 	void *vaddr;
@@ -126,5 +125,4 @@
 		return rc;
 	}
-	driver_phone = rc;
 
 	rc = pio_enable((void *) dev_physical, sizeof(gxe_bd_t), &vaddr);
@@ -144,7 +142,7 @@
 	devbuf = vaddr;
 
-	rc = devmap_device_register(driver_phone, "disk0", &dev_handle);
+	rc = devmap_device_register("disk0", &dev_handle);
 	if (rc != EOK) {
-		ipc_hangup(driver_phone);
+		devmap_hangup_phone(DEVMAP_DRIVER);
 		printf(NAME ": Unable to register device.\n");
 		return rc;
Index: uspace/srv/devmap/devmap.c
===================================================================
--- uspace/srv/devmap/devmap.c	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/srv/devmap/devmap.c	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -49,4 +49,39 @@
 #define NAME  "devmap"
 
+/** Representation of device driver.
+ *
+ * Each driver is responsible for a set of devices.
+ *
+ */
+typedef struct {
+	/** Pointers to previous and next drivers in linked list */
+	link_t drivers;
+	/** Pointer to the linked list of devices controlled by this driver */
+	link_t devices;
+	/** Phone asociated with this driver */
+	ipcarg_t phone;
+	/** Device driver name */
+	char *name;
+	/** Futex for list of devices owned by this driver */
+	atomic_t devices_futex;
+} devmap_driver_t;
+
+/** Info about registered device
+ *
+ */
+typedef struct {
+	/** Pointer to the previous and next device in the list of all devices */
+	link_t devices;
+	/** Pointer to the previous and next device in the list of devices
+	    owned by one driver */
+	link_t driver_devices;
+	/** Unique device identifier  */
+	dev_handle_t handle;
+	/** Device name */
+	char *name;
+	/** Device driver handling this device */
+	devmap_driver_t *driver;
+} devmap_device_t;
+
 /** Pending lookup structure. */
 typedef struct {
@@ -71,9 +106,8 @@
 static atomic_t create_handle_futex = FUTEX_INITIALIZER;
 
-static int devmap_create_handle(void)
-{
-	static int last_handle = 0;
-	int handle;
-	
+static dev_handle_t last_handle = 0;
+
+static dev_handle_t devmap_create_handle(void)
+{
 	/* TODO: allow reusing old handles after their unregistration
 	 * and implement some version of LRU algorithm
@@ -82,23 +116,8 @@
 	/* FIXME: overflow */
 	futex_down(&create_handle_futex);
-	
-	last_handle += 1;
-	handle = last_handle;
-	
+	last_handle++;
 	futex_up(&create_handle_futex);
 	
-	return handle;
-}
-
-
-/** Initialize device mapper.
- *
- *
- */
-static int devmap_init()
-{
-	/* TODO: */
-	
-	return EOK;
+	return last_handle;
 }
 
@@ -130,5 +149,5 @@
  *
  */
-static devmap_device_t *devmap_device_find_handle(int handle)
+static devmap_device_t *devmap_device_find_handle(dev_handle_t handle)
 {
 	futex_down(&devices_list_futex);
@@ -298,11 +317,11 @@
 	futex_down(&drivers_list_futex);
 	
-	ipc_hangup(driver->phone);
-	
-	/* remove it from list of drivers */
+	if (driver->phone != 0)
+		ipc_hangup(driver->phone);
+	
+	/* Remove it from list of drivers */
 	list_remove(&(driver->drivers));
 	
-	/* unregister all its devices */
-	
+	/* Unregister all its devices */
 	futex_down(&devices_list_futex);
 	futex_down(&(driver->devices_futex));
@@ -319,5 +338,5 @@
 	
 	/* free name and driver */
-	if (NULL != driver->name)
+	if (driver->name != NULL)
 		free(driver->name);
 	
@@ -455,13 +474,13 @@
 	 * Get handle from request
 	 */
-	int handle = IPC_GET_ARG2(*call);
+	dev_handle_t handle = IPC_GET_ARG2(*call);
 	devmap_device_t *dev = devmap_device_find_handle(handle);
 	
-	if (NULL == dev) {
+	if ((dev == NULL) || (dev->driver == NULL) || (dev->driver->phone == 0)) {
 		ipc_answer_0(callid, ENOENT);
 		return;
 	}
 	
-	ipc_forward_fast(callid, dev->driver->phone, (ipcarg_t)(dev->handle),
+	ipc_forward_fast(callid, dev->driver->phone, dev->handle,
 	    IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
 }
@@ -496,5 +515,5 @@
 	 * Allocate buffer for device name.
 	 */
-	char *name = (char *) malloc(size);
+	char *name = (char *) malloc(size + 1);
 	if (name == NULL) {
 		ipc_answer_0(callid, ENOMEM);
@@ -550,5 +569,5 @@
  *
  */
-static void devmap_get_name(ipc_callid_t iid, ipc_call_t *icall) 
+static void devmap_get_name(ipc_callid_t iid, ipc_call_t *icall)
 {
 	const devmap_device_t *device = devmap_device_find_handle(IPC_GET_ARG1(*icall));
@@ -578,4 +597,97 @@
 	
 	/* TODO: send name in response */
+}
+
+static void devmap_get_count(ipc_callid_t iid, ipc_call_t *icall)
+{
+	futex_down(&devices_list_futex);
+	ipc_answer_1(iid, EOK, list_count(&devices_list));
+	futex_up(&devices_list_futex);
+}
+
+static void devmap_get_devices(ipc_callid_t iid, ipc_call_t *icall)
+{
+	futex_down(&devices_list_futex);
+	
+	ipc_callid_t callid;
+	size_t size;
+	if (!ipc_data_read_receive(&callid, &size)) {
+		ipc_answer_0(callid, EREFUSED);
+		ipc_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	if ((size % sizeof(dev_desc_t)) != 0) {
+		ipc_answer_0(callid, EINVAL);
+		ipc_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	count_t count = size / sizeof(dev_desc_t);
+	dev_desc_t *desc = (dev_desc_t *) malloc(size);
+	if (desc == NULL) {
+		ipc_answer_0(callid, ENOMEM);
+		ipc_answer_0(iid, EREFUSED);
+		return;
+	}
+	
+	count_t pos = 0;
+	link_t *item = devices_list.next;
+	
+	while ((item != &devices_list) && (pos < count)) {
+		devmap_device_t *device = list_get_instance(item, devmap_device_t, devices);
+		
+		desc[pos].handle = device->handle;
+		str_cpy(desc[pos].name, DEVMAP_NAME_MAXLEN, device->name);
+		pos++;
+		item = item->next;
+	}
+	
+	ipcarg_t retval = ipc_data_read_finalize(callid, desc, pos * sizeof(dev_desc_t));
+	if (retval != EOK) {
+		ipc_answer_0(iid, EREFUSED);
+		free(desc);
+		return;
+	}
+	
+	free(desc);
+	
+	futex_up(&devices_list_futex);
+	
+	ipc_answer_1(iid, EOK, pos);
+}
+
+/** Initialize device mapper.
+ *
+ *
+ */
+static bool devmap_init()
+{
+	/* Create NULL device entry */
+	devmap_device_t *device = (devmap_device_t *) malloc(sizeof(devmap_device_t));
+	if (device == NULL)
+		return false;
+	
+	device->name = str_dup("null");
+	if (device->name == NULL) {
+		free(device);
+		return false;
+	}
+	
+	list_initialize(&(device->devices));
+	list_initialize(&(device->driver_devices));
+	
+	futex_down(&devices_list_futex);
+	
+	/* Get unique device handle */
+	device->handle = devmap_create_handle();
+	device->driver = NULL;
+	
+	/* Insert device into list of all devices  */
+	list_append(&device->devices, &devices_list);
+	
+	futex_up(&devices_list_futex);
+	
+	return true;
 }
 
@@ -622,5 +734,5 @@
 			break;
 		case DEVMAP_DEVICE_GET_NAME:
-			devmap_get_handle(callid, &call);
+			devmap_get_name(callid, &call);
 			break;
 		default:
@@ -661,6 +773,11 @@
 			break;
 		case DEVMAP_DEVICE_GET_NAME:
-			/* TODO */
 			devmap_get_name(callid, &call);
+			break;
+		case DEVMAP_DEVICE_GET_COUNT:
+			devmap_get_count(callid, &call);
+			break;
+		case DEVMAP_DEVICE_GET_DEVICES:
+			devmap_get_devices(callid, &call);
 			break;
 		default:
@@ -701,5 +818,5 @@
 	printf(NAME ": HelenOS Device Mapper\n");
 	
-	if (devmap_init() != 0) {
+	if (!devmap_init()) {
 		printf(NAME ": Error while initializing service\n");
 		return -1;
Index: uspace/srv/rd/rd.c
===================================================================
--- uspace/srv/rd/rd.c	(revision 2246de644f7ce21502763784228e70ae8aa2aa3f)
+++ uspace/srv/rd/rd.c	(revision cb41a5e8d354c38c6d53f55fadf65c3d3dc83c6f)
@@ -113,5 +113,5 @@
 	}
 	
-	while (1) {
+	while (true) {
 		callid = async_get_call(&call);
 		switch (IPC_GET_METHOD(call)) {
@@ -205,25 +205,13 @@
 	printf(NAME ": Found RAM disk at %p, %d bytes\n", rd_ph_addr, rd_size);
 	
-	int driver_phone = devmap_driver_register(NAME, rd_connection);
-	if (driver_phone < 0) {
-		printf(NAME ": Unable to register driver\n");
+	int rc = devmap_driver_register(NAME, rd_connection);
+	if (rc < 0) {
+		printf(NAME ": Unable to register driver (%d)\n", rc);
 		return false;
 	}
 	
 	dev_handle_t dev_handle;
-	if (devmap_device_register(driver_phone, "initrd", &dev_handle) != EOK) {
-		ipc_hangup(driver_phone);
-		printf(NAME ": Unable to register device\n");
-		return false;
-	}
-
-	/*
-	 * Create the second device.
-	 * We need at least two devices for the sake of testing of non-root
-	 * mounts. Of course it would be better to allow the second device
-	 * be created dynamically...
-	 */
-	if (devmap_device_register(driver_phone, "spared", &dev_handle) != EOK) {
-		ipc_hangup(driver_phone);
+	if (devmap_device_register("initrd", &dev_handle) != EOK) {
+		devmap_hangup_phone(DEVMAP_DRIVER);
 		printf(NAME ": Unable to register device\n");
 		return false;
@@ -249,3 +237,3 @@
 /**
  * @}
- */ 
+ */
