Index: uspace/srv/net/slip/slip.c
===================================================================
--- uspace/srv/net/slip/slip.c	(revision e141281aa239c549426ee31f8ac6de80704241b1)
+++ uspace/srv/net/slip/slip.c	(revision ac307b25a02622848f9ee9d1bff85d6cd4c35ca2)
@@ -40,5 +40,5 @@
 #include <inet/addr.h>
 #include <inet/iplink_srv.h>
-#include <char_dev_iface.h>
+#include <io/chardev.h>
 #include <io/log.h>
 #include <errno.h>
@@ -96,29 +96,29 @@
 }
 
-static void write_flush(async_sess_t *sess)
+static void write_flush(chardev_t *chardev)
 {
 	size_t written = 0;
 
 	while (slip_send_pending > 0) {
-		ssize_t size;
-
-		size = char_dev_write(sess, &slip_send_buf[written],
-		    slip_send_pending);
-		if (size < 0) {
+		int rc;
+		size_t nwr;
+
+		rc = chardev_write(chardev, &slip_send_buf[written],
+		    slip_send_pending, &nwr);
+		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "char_dev_write() returned %d",
-			    (int) size);
+			    "chardev_write() returned %d", rc);
 			slip_send_pending = 0;
 			break;
 		}
-		written += size;
-		slip_send_pending -= size;
-	}
-}
-
-static void write_buffered(async_sess_t *sess, uint8_t ch)
+		written += nwr;
+		slip_send_pending -= nwr;
+	}
+}
+
+static void write_buffered(chardev_t *chardev, uint8_t ch)
 {
 	if (slip_send_pending == sizeof(slip_send_buf))
-		write_flush(sess);
+		write_flush(chardev);
 	slip_send_buf[slip_send_pending++] = ch;
 }
@@ -128,5 +128,5 @@
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_send()");
 	
-	async_sess_t *sess = (async_sess_t *) srv->arg;
+	chardev_t *chardev = (chardev_t *) srv->arg;
 	uint8_t *data = sdu->data;
 	
@@ -136,24 +136,24 @@
 	 * measure for dealing with previous possible noise on the line.
 	 */
-	write_buffered(sess, SLIP_END);
+	write_buffered(chardev, SLIP_END);
 	
 	for (size_t i = 0; i < sdu->size; i++) {
 		switch (data[i]) {
 		case SLIP_END:
-			write_buffered(sess, SLIP_ESC);
-			write_buffered(sess, SLIP_ESC_END);
+			write_buffered(chardev, SLIP_ESC);
+			write_buffered(chardev, SLIP_ESC_END);
 			break;
 		case SLIP_ESC:
-			write_buffered(sess, SLIP_ESC);
-			write_buffered(sess, SLIP_ESC_ESC);
+			write_buffered(chardev, SLIP_ESC);
+			write_buffered(chardev, SLIP_ESC_ESC);
 			break;
 		default:
-			write_buffered(sess, data[i]);
+			write_buffered(chardev, data[i]);
 			break;
 		}
 	}
 	
-	write_buffered(sess, SLIP_END);
-	write_flush(sess);
+	write_buffered(chardev, SLIP_END);
+	write_flush(chardev);
 	
 	return EOK;
@@ -203,17 +203,21 @@
 }
 
-static uint8_t read_buffered(async_sess_t *sess)
+static uint8_t read_buffered(chardev_t *chardev)
 {
 	while (slip_recv_pending == 0) {
-		ssize_t size;
-
-		size = char_dev_read(sess, slip_recv_buf,
-		    sizeof(slip_recv_buf));
-		if (size < 0) {
+		int rc;
+		size_t nread;
+
+		rc = chardev_read(chardev, slip_recv_buf,
+		    sizeof(slip_recv_buf), &nread);
+		if (rc != EOK) {
 			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "char_dev_read() returned %d", (int) size);
+			    "char_dev_read() returned %d", rc);
+		}
+
+		if (nread == 0)
 			return SLIP_END;
-		}
-		slip_recv_pending = size;
+
+		slip_recv_pending = nread;
 		slip_recv_read = 0;
 	}
@@ -224,5 +228,5 @@
 static int slip_recv_fibril(void *arg)
 {
-	async_sess_t *sess = (async_sess_t *) arg;
+	chardev_t *chardev = (chardev_t *) arg;
 	static uint8_t recv_final[SLIP_MTU];
 	iplink_recv_sdu_t sdu;
@@ -234,5 +238,5 @@
 	while (true) {
 		for (sdu.size = 0; sdu.size < sizeof(recv_final); /**/) {
-			ch = read_buffered(sess);
+			ch = read_buffered(chardev);
 			switch (ch) {
 			case SLIP_END:
@@ -246,9 +250,9 @@
 
 			case SLIP_ESC:
-				ch = read_buffered(sess);
+				ch = read_buffered(chardev);
 				if (ch == SLIP_ESC_END) {
 					recv_final[sdu.size++] = SLIP_END;
 					break;
-				} else if (ch ==  SLIP_ESC_ESC) {
+				} else if (ch == SLIP_ESC_ESC) {
 					recv_final[sdu.size++] = SLIP_ESC;
 					break;
@@ -295,4 +299,6 @@
 	async_sess_t *sess_in = NULL;
 	async_sess_t *sess_out = NULL;
+	chardev_t *chardev_in = NULL;
+	chardev_t *chardev_out = NULL;
 	fid_t fid;
 	int rc;
@@ -336,5 +342,13 @@
 		return ENOENT;
 	}
-	slip_iplink.arg = sess_out;
+
+	rc = chardev_open(sess_out, &chardev_out);
+	if (rc != EOK) {
+		log_msg(LOG_DEFAULT, LVL_ERROR,
+		    "Failed opening character device.");
+		return ENOENT;
+	}
+
+	slip_iplink.arg = chardev_out;
 
 	sess_in = loc_service_connect(svcid, INTERFACE_DDF, 0);
@@ -347,4 +361,11 @@
 	}
 
+	rc = chardev_open(sess_in, &chardev_in);
+	if (rc != EOK) {
+		log_msg(LOG_DEFAULT, LVL_ERROR,
+		    "Failed opening character device.");
+		return ENOENT;
+	}
+
 	rc = loc_service_register(linkstr, &linksid);
 	if (rc != EOK) {
@@ -363,5 +384,5 @@
 	}
 
-	fid = fibril_create(slip_recv_fibril, sess_in);
+	fid = fibril_create(slip_recv_fibril, chardev_in);
 	if (!fid) {
 		log_msg(LOG_DEFAULT, LVL_ERROR,
@@ -375,6 +396,8 @@
 
 fail:
+	chardev_close(chardev_out);
 	if (sess_out)
 		async_hangup(sess_out);
+	chardev_close(chardev_in);
 	if (sess_in)
 		async_hangup(sess_in);
