Index: uspace/lib/block/block.c
===================================================================
--- uspace/lib/block/block.c	(revision 38d150e6238ab44c861f6486e46454e07caeb0f0)
+++ uspace/lib/block/block.c	(revision b7fd2a02e4161f4edd38548e7f8456b8021549be)
@@ -52,4 +52,5 @@
 #include <stdio.h>
 #include <stacktrace.h>
+#include <str_error.h>
 #include <offset.h>
 #include <inttypes.h>
@@ -87,6 +88,6 @@
 } devcon_t;
 
-static int read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
-static int write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
+static errno_t read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
+static errno_t write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
 static aoff64_t ba_ltop(devcon_t *, aoff64_t);
 
@@ -106,5 +107,5 @@
 }
 
-static int devcon_add(service_id_t service_id, async_sess_t *sess,
+static errno_t devcon_add(service_id_t service_id, async_sess_t *sess,
     size_t bsize, aoff64_t dev_size, bd_t *bd)
 {
@@ -145,5 +146,5 @@
 }
 
-int block_init(service_id_t service_id, size_t comm_size)
+errno_t block_init(service_id_t service_id, size_t comm_size)
 {
 	bd_t *bd;
@@ -155,5 +156,5 @@
 	}
 	
-	int rc = bd_open(sess, &bd);
+	errno_t rc = bd_open(sess, &bd);
 	if (rc != EOK) {
 		async_hangup(sess);
@@ -208,8 +209,8 @@
 }
 
-int block_bb_read(service_id_t service_id, aoff64_t ba)
+errno_t block_bb_read(service_id_t service_id, aoff64_t ba)
 {
 	void *bb_buf;
-	int rc;
+	errno_t rc;
 
 	devcon_t *devcon = devcon_search(service_id);
@@ -269,5 +270,5 @@
 };
 
-int block_cache_init(service_id_t service_id, size_t size, unsigned blocks,
+errno_t block_cache_init(service_id_t service_id, size_t size, unsigned blocks,
     enum cache_mode mode)
 {
@@ -306,9 +307,9 @@
 }
 
-int block_cache_fini(service_id_t service_id)
+errno_t block_cache_fini(service_id_t service_id)
 {
 	devcon_t *devcon = devcon_search(service_id);
 	cache_t *cache;
-	int rc;
+	errno_t rc;
 
 	if (!devcon)
@@ -380,7 +381,7 @@
  *				device.
  *
- * @return			EOK on success or a negative error code.
- */
-int block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags)
+ * @return			EOK on success or an error code.
+ */
+errno_t block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags)
 {
 	devcon_t *devcon;
@@ -389,5 +390,5 @@
 	link_t *link;
 	aoff64_t p_ba;
-	int rc;
+	errno_t rc;
 	
 	devcon = devcon_search(service_id);
@@ -577,7 +578,7 @@
  * @param block		Block of which a reference is to be released.
  *
- * @return		EOK on success or a negative error code.
- */
-int block_put(block_t *block)
+ * @return		EOK on success or an error code.
+ */
+errno_t block_put(block_t *block)
 {
 	devcon_t *devcon = devcon_search(block->service_id);
@@ -585,5 +586,5 @@
 	unsigned blocks_cached;
 	enum cache_mode mode;
-	int rc = EOK;
+	errno_t rc = EOK;
 
 	assert(devcon);
@@ -698,7 +699,7 @@
  * @param block_size	Block size to be used for the transfer.
  *
- * @return		EOK on success or a negative return code on failure.
- */
-int block_seqread(service_id_t service_id, void *buf, size_t *bufpos,
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_seqread(service_id_t service_id, void *buf, size_t *bufpos,
     size_t *buflen, aoff64_t *pos, void *dst, size_t size)
 {
@@ -734,5 +735,5 @@
 		if (*bufpos == *buflen) {
 			/* Refill the communication buffer with a new block. */
-			int rc;
+			errno_t rc;
 
 			rc = read_blocks(devcon, *pos / block_size, 1, buf,
@@ -757,7 +758,7 @@
  * @param src		Buffer for storing the data.
  *
- * @return		EOK on success or negative error code on failure.
- */
-int block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf)
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf)
 {
 	devcon_t *devcon;
@@ -776,7 +777,7 @@
  * @param src		The data to be written.
  *
- * @return		EOK on success or negative error code on failure.
- */
-int block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt,
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt,
     const void *data)
 {
@@ -795,7 +796,7 @@
  * @param cnt		Number of blocks.
  *
- * @return		EOK on success or negative error code on failure.
- */
-int block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt)
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt)
 {
 	devcon_t *devcon;
@@ -812,7 +813,7 @@
  * @param bsize		Output block size.
  *
- * @return		EOK on success or negative error code on failure.
- */
-int block_get_bsize(service_id_t service_id, size_t *bsize)
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_get_bsize(service_id_t service_id, size_t *bsize)
 {
 	devcon_t *devcon;
@@ -829,7 +830,7 @@
  * @param nblocks	Output number of blocks.
  *
- * @return		EOK on success or negative error code on failure.
- */
-int block_get_nblocks(service_id_t service_id, aoff64_t *nblocks)
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_get_nblocks(service_id_t service_id, aoff64_t *nblocks)
 {
 	devcon_t *devcon = devcon_search(service_id);
@@ -846,10 +847,10 @@
  * @param data			Buffer that receives the data
  * 
- * @return		EOK on success or negative error code on failure.
- */
-int block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset,
+ * @return		EOK on success or an error code on failure.
+ */
+errno_t block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset,
     size_t bytes, void *data)
 {
-	int rc;
+	errno_t rc;
 	size_t phys_block_size;
 	size_t buf_size;
@@ -897,8 +898,8 @@
  *
  * @return Allocated TOC structure.
- * @return EOK on success or negative error code.
- *
- */
-int block_read_toc(service_id_t service_id, uint8_t session, void *buf,
+ * @return EOK on success or an error code.
+ *
+ */
+errno_t block_read_toc(service_id_t service_id, uint8_t session, void *buf,
     size_t bufsize)
 {
@@ -916,15 +917,15 @@
  * @param src		Buffer for storing the data.
  *
- * @return		EOK on success or negative error code on failure.
- */
-static int read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf,
+ * @return		EOK on success or an error code on failure.
+ */
+static errno_t read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf,
     size_t size)
 {
 	assert(devcon);
 	
-	int rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);
+	errno_t rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);
 	if (rc != EOK) {
-		printf("Error %d reading %zu blocks starting at block %" PRIuOFF64
-		    " from device handle %" PRIun "\n", rc, cnt, ba,
+		printf("Error %s reading %zu blocks starting at block %" PRIuOFF64
+		    " from device handle %" PRIun "\n", str_error_name(rc), cnt, ba,
 		    devcon->service_id);
 #ifndef NDEBUG
@@ -943,15 +944,15 @@
  * @param src		Buffer containing the data to write.
  *
- * @return		EOK on success or negative error code on failure.
- */
-static int write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data,
+ * @return		EOK on success or an error code on failure.
+ */
+static errno_t write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data,
     size_t size)
 {
 	assert(devcon);
 	
-	int rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);
+	errno_t rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);
 	if (rc != EOK) {
-		printf("Error %d writing %zu blocks starting at block %" PRIuOFF64
-		    " to device handle %" PRIun "\n", rc, cnt, ba, devcon->service_id);
+		printf("Error %s writing %zu blocks starting at block %" PRIuOFF64
+		    " to device handle %" PRIun "\n", str_error_name(rc), cnt, ba, devcon->service_id);
 #ifndef NDEBUG
 		stacktrace_print();
