Index: uspace/drv/block/ata_bd/ata_bd.c
===================================================================
--- uspace/drv/block/ata_bd/ata_bd.c	(revision d5c1051faf4391647834d99babdd4a44ee5d9700)
+++ uspace/drv/block/ata_bd/ata_bd.c	(revision b7fd2a02e4161f4edd38548e7f8456b8021549be)
@@ -82,41 +82,41 @@
 static const size_t identify_data_size = 512;
 
-static int ata_bd_init_io(ata_ctrl_t *ctrl);
+static errno_t ata_bd_init_io(ata_ctrl_t *ctrl);
 static void ata_bd_fini_io(ata_ctrl_t *ctrl);
 
-static int ata_bd_open(bd_srvs_t *, bd_srv_t *);
-static int ata_bd_close(bd_srv_t *);
-static int ata_bd_read_blocks(bd_srv_t *, uint64_t ba, size_t cnt, void *buf,
+static errno_t ata_bd_open(bd_srvs_t *, bd_srv_t *);
+static errno_t ata_bd_close(bd_srv_t *);
+static errno_t ata_bd_read_blocks(bd_srv_t *, uint64_t ba, size_t cnt, void *buf,
     size_t);
-static int ata_bd_read_toc(bd_srv_t *, uint8_t session, void *buf, size_t);
-static int ata_bd_write_blocks(bd_srv_t *, uint64_t ba, size_t cnt,
+static errno_t ata_bd_read_toc(bd_srv_t *, uint8_t session, void *buf, size_t);
+static errno_t ata_bd_write_blocks(bd_srv_t *, uint64_t ba, size_t cnt,
     const void *buf, size_t);
-static int ata_bd_get_block_size(bd_srv_t *, size_t *);
-static int ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-static int ata_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-
-static int ata_rcmd_read(disk_t *disk, uint64_t ba, size_t cnt,
+static errno_t ata_bd_get_block_size(bd_srv_t *, size_t *);
+static errno_t ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+static errno_t ata_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
+
+static errno_t ata_rcmd_read(disk_t *disk, uint64_t ba, size_t cnt,
     void *buf);
-static int ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
+static errno_t ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
     const void *buf);
-static int ata_rcmd_flush_cache(disk_t *disk);
-static int disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id);
-static int ata_identify_dev(disk_t *disk, void *buf);
-static int ata_identify_pkt_dev(disk_t *disk, void *buf);
-static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
+static errno_t ata_rcmd_flush_cache(disk_t *disk);
+static errno_t disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id);
+static errno_t ata_identify_dev(disk_t *disk, void *buf);
+static errno_t ata_identify_pkt_dev(disk_t *disk, void *buf);
+static errno_t ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
     void *obuf, size_t obuf_size, size_t *rcvd_size);
-static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
+static errno_t ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
     size_t *rcvd_size);
-static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
+static errno_t ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
     void *obuf, size_t obuf_size);
-static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
+static errno_t ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
     size_t *block_size);
-static int ata_pcmd_read_toc(disk_t *disk, uint8_t ses,
+static errno_t ata_pcmd_read_toc(disk_t *disk, uint8_t ses,
     void *obuf, size_t obuf_size);
 static void disk_print_summary(disk_t *d);
-static int coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc);
+static errno_t coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc);
 static void coord_sc_program(ata_ctrl_t *ctrl, const block_coord_t *bc,
     uint16_t scnt);
-static int wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
+static errno_t wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
     uint8_t *pstatus, unsigned timeout);
 
@@ -143,8 +143,8 @@
 
 /** Initialize ATA controller. */
-int ata_ctrl_init(ata_ctrl_t *ctrl, ata_base_t *res)
+errno_t ata_ctrl_init(ata_ctrl_t *ctrl, ata_base_t *res)
 {
 	int i;
-	int rc;
+	errno_t rc;
 	int n_disks;
 
@@ -209,8 +209,8 @@
 
 /** Remove ATA controller. */
-int ata_ctrl_remove(ata_ctrl_t *ctrl)
+errno_t ata_ctrl_remove(ata_ctrl_t *ctrl)
 {
 	int i;
-	int rc;
+	errno_t rc;
 
 	ddf_msg(LVL_DEBUG, ": ata_ctrl_remove()");
@@ -234,8 +234,8 @@
 
 /** Surprise removal of ATA controller. */
-int ata_ctrl_gone(ata_ctrl_t *ctrl)
+errno_t ata_ctrl_gone(ata_ctrl_t *ctrl)
 {
 	int i;
-	int rc;
+	errno_t rc;
 
 	ddf_msg(LVL_DEBUG, "ata_ctrl_gone()");
@@ -308,7 +308,7 @@
 
 /** Enable device I/O. */
-static int ata_bd_init_io(ata_ctrl_t *ctrl)
-{
-	int rc;
+static errno_t ata_bd_init_io(ata_ctrl_t *ctrl)
+{
+	errno_t rc;
 	void *vaddr;
 
@@ -344,5 +344,5 @@
  * the disk structure.
  */
-static int disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id)
+static errno_t disk_init(ata_ctrl_t *ctrl, disk_t *d, int disk_id)
 {
 	identify_data_t idata;
@@ -356,5 +356,5 @@
 	size_t block_size;
 	size_t pos, len;
-	int rc;
+	errno_t rc;
 	unsigned i;
 
@@ -498,10 +498,10 @@
 }
 
-static int ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-static int ata_bd_close(bd_srv_t *bd)
+static errno_t ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+{
+	return EOK;
+}
+
+static errno_t ata_bd_close(bd_srv_t *bd)
 {
 	return EOK;
@@ -509,9 +509,9 @@
 
 /** Read multiple blocks from the device. */
-static int ata_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
+static errno_t ata_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     void *buf, size_t size)
 {
 	disk_t *disk = bd_srv_disk(bd);
-	int rc;
+	errno_t rc;
 
 	if (size < cnt * disk->block_size)
@@ -538,5 +538,5 @@
 
 /** Read TOC from device. */
-static int ata_bd_read_toc(bd_srv_t *bd, uint8_t session, void *buf, size_t size)
+static errno_t ata_bd_read_toc(bd_srv_t *bd, uint8_t session, void *buf, size_t size)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -546,9 +546,9 @@
 
 /** Write multiple blocks to the device. */
-static int ata_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
+static errno_t ata_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
 	disk_t *disk = bd_srv_disk(bd);
-	int rc;
+	errno_t rc;
 
 	if (disk->dev_type != ata_reg_dev)
@@ -572,5 +572,5 @@
 
 /** Get device block size. */
-static int ata_bd_get_block_size(bd_srv_t *bd, size_t *rbsize)
+static errno_t ata_bd_get_block_size(bd_srv_t *bd, size_t *rbsize)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -581,5 +581,5 @@
 
 /** Get device number of blocks. */
-static int ata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static errno_t ata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -590,5 +590,5 @@
 
 /** Flush cache. */
-static int ata_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
+static errno_t ata_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
 {
 	disk_t *disk = bd_srv_disk(bd);
@@ -602,5 +602,5 @@
 
 /** PIO data-in command protocol. */
-static int ata_pio_data_in(disk_t *disk, void *obuf, size_t obuf_size,
+static errno_t ata_pio_data_in(disk_t *disk, void *obuf, size_t obuf_size,
     size_t blk_size, size_t nblocks)
 {
@@ -633,5 +633,5 @@
 
 /** PIO data-out command protocol. */
-static int ata_pio_data_out(disk_t *disk, const void *buf, size_t buf_size,
+static errno_t ata_pio_data_out(disk_t *disk, const void *buf, size_t buf_size,
     size_t blk_size, size_t nblocks)
 {
@@ -662,5 +662,5 @@
 
 /** PIO non-data command protocol. */
-static int ata_pio_nondata(disk_t *disk)
+static errno_t ata_pio_nondata(disk_t *disk)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
@@ -687,5 +687,5 @@
  *			not present). EIO if device responds with error.
  */
-static int ata_identify_dev(disk_t *disk, void *buf)
+static errno_t ata_identify_dev(disk_t *disk, void *buf)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
@@ -739,5 +739,5 @@
  * @param buf		Pointer to a 512-byte buffer.
  */
-static int ata_identify_pkt_dev(disk_t *disk, void *buf)
+static errno_t ata_identify_pkt_dev(disk_t *disk, void *buf)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
@@ -772,5 +772,5 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
+static errno_t ata_cmd_packet(disk_t *disk, const void *cpkt, size_t cpkt_size,
     void *obuf, size_t obuf_size, size_t *rcvd_size)
 {
@@ -860,10 +860,10 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
+static errno_t ata_pcmd_inquiry(disk_t *disk, void *obuf, size_t obuf_size,
     size_t *rcvd_size)
 {
 	uint8_t cpb[12];
 	scsi_cdb_inquiry_t *cp = (scsi_cdb_inquiry_t *)cpb;
-	int rc;
+	errno_t rc;
 
 	memset(cpb, 0, sizeof(cpb));
@@ -893,5 +893,5 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
+static errno_t ata_pcmd_read_capacity(disk_t *disk, uint64_t *nblocks,
     size_t *block_size)
 {
@@ -899,5 +899,5 @@
 	scsi_read_capacity_10_data_t data;
 	size_t rsize;
-	int rc;
+	errno_t rc;
 
 	memset(&cdb, 0, sizeof(cdb));
@@ -930,9 +930,9 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
+static errno_t ata_pcmd_read_12(disk_t *disk, uint64_t ba, size_t cnt,
     void *obuf, size_t obuf_size)
 {
 	scsi_cdb_read_12_t cp;
-	int rc;
+	errno_t rc;
 
 	if (ba > UINT32_MAX)
@@ -969,10 +969,10 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_pcmd_read_toc(disk_t *disk, uint8_t session, void *obuf,
+static errno_t ata_pcmd_read_toc(disk_t *disk, uint8_t session, void *obuf,
     size_t obuf_size)
 {
 	uint8_t cpb[12];
 	scsi_cdb_read_toc_t *cp = (scsi_cdb_read_toc_t *)cpb;
-	int rc;
+	errno_t rc;
 
 	memset(cpb, 0, sizeof(cpb));
@@ -1001,5 +1001,5 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_rcmd_read(disk_t *disk, uint64_t ba, size_t blk_cnt,
+static errno_t ata_rcmd_read(disk_t *disk, uint64_t ba, size_t blk_cnt,
     void *buf)
 {
@@ -1007,5 +1007,5 @@
 	uint8_t drv_head;
 	block_coord_t bc;
-	int rc;
+	errno_t rc;
 
 	/* Silence warning. */
@@ -1061,5 +1061,5 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
+static errno_t ata_rcmd_write(disk_t *disk, uint64_t ba, size_t cnt,
     const void *buf)
 {
@@ -1067,5 +1067,5 @@
 	uint8_t drv_head;
 	block_coord_t bc;
-	int rc;
+	errno_t rc;
 
 	/* Silence warning. */
@@ -1117,9 +1117,9 @@
  * @return EOK on success, EIO on error.
  */
-static int ata_rcmd_flush_cache(disk_t *disk)
+static errno_t ata_rcmd_flush_cache(disk_t *disk)
 {
 	ata_ctrl_t *ctrl = disk->ctrl;
 	uint8_t drv_head;
-	int rc;
+	errno_t rc;
 
 	/* New value for Drive/Head register */
@@ -1159,5 +1159,5 @@
  * @return EOK on success or EINVAL if block index is past end of device.
  */
-static int coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc)
+static errno_t coord_calc(disk_t *d, uint64_t ba, block_coord_t *bc)
 {
 	uint64_t c;
@@ -1246,5 +1246,5 @@
  * @return		EOK on success, EIO on timeout.
  */
-static int wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
+static errno_t wait_status(ata_ctrl_t *ctrl, unsigned set, unsigned n_reset,
     uint8_t *pstatus, unsigned timeout)
 {
