Index: uspace/srv/bd/vbd/disk.c
===================================================================
--- uspace/srv/bd/vbd/disk.c	(revision d5c1051faf4391647834d99babdd4a44ee5d9700)
+++ uspace/srv/bd/vbd/disk.c	(revision c81d4f18721cc59f484518c5e3819a401e3e431f)
@@ -58,28 +58,28 @@
 static category_id_t part_cid;
 
-static int vbds_disk_parts_add(vbds_disk_t *, label_t *);
-static int vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t);
-
-static int vbds_bd_open(bd_srvs_t *, bd_srv_t *);
-static int vbds_bd_close(bd_srv_t *);
-static int vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static int vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-static int vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
+static errno_t vbds_disk_parts_add(vbds_disk_t *, label_t *);
+static errno_t vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t);
+
+static errno_t vbds_bd_open(bd_srvs_t *, bd_srv_t *);
+static errno_t vbds_bd_close(bd_srv_t *);
+static errno_t vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
+static errno_t vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
+static errno_t vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
     size_t);
-static int vbds_bd_get_block_size(bd_srv_t *, size_t *);
-static int vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-static int vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *);
-
-static int vbds_part_svc_register(vbds_part_t *);
-static int vbds_part_svc_unregister(vbds_part_t *);
-static int vbds_part_indices_update(vbds_disk_t *);
+static errno_t vbds_bd_get_block_size(bd_srv_t *, size_t *);
+static errno_t vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
+
+static errno_t vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *);
+
+static errno_t vbds_part_svc_register(vbds_part_t *);
+static errno_t vbds_part_svc_unregister(vbds_part_t *);
+static errno_t vbds_part_indices_update(vbds_disk_t *);
 
 static vbd_part_id_t vbds_part_id = 1;
 
-static int vbds_label_get_bsize(void *, size_t *);
-static int vbds_label_get_nblocks(void *, aoff64_t *);
-static int vbds_label_read(void *, aoff64_t, size_t, void *);
-static int vbds_label_write(void *, aoff64_t, size_t, const void *);
+static errno_t vbds_label_get_bsize(void *, size_t *);
+static errno_t vbds_label_get_nblocks(void *, aoff64_t *);
+static errno_t vbds_label_read(void *, aoff64_t, size_t, void *);
+static errno_t vbds_label_write(void *, aoff64_t, size_t, const void *);
 
 /** Block device operations provided by VBD */
@@ -132,7 +132,7 @@
 }
 
-int vbds_disks_init(void)
-{
-	int rc;
+errno_t vbds_disks_init(void)
+{
+	errno_t rc;
 
 	fibril_mutex_initialize(&vbds_disks_lock);
@@ -152,5 +152,5 @@
 
 /** Check for new/removed disk devices */
-static int vbds_disks_check_new(void)
+static errno_t vbds_disks_check_new(void)
 {
 	bool already_known;
@@ -159,5 +159,5 @@
 	size_t count, i;
 	vbds_disk_t *cur, *next;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disks_check_new()");
@@ -229,5 +229,5 @@
 
 
-static int vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)
+static errno_t vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)
 {
 	list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
@@ -256,5 +256,5 @@
 }
 
-static int vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart)
+static errno_t vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_pid(%zu)", partid);
@@ -278,5 +278,5 @@
 }
 
-static int vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart)
+static errno_t vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart)
 {
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_svcid(%zu)", svcid);
@@ -301,5 +301,5 @@
 
 /** Add partition to our inventory based on liblabel partition structure */
-static int vbds_part_add(vbds_disk_t *disk, label_part_t *lpart,
+static errno_t vbds_part_add(vbds_disk_t *disk, label_part_t *lpart,
     vbds_part_t **rpart)
 {
@@ -307,5 +307,5 @@
 	service_id_t psid = 0;
 	label_part_info_t lpinfo;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_add(%s, %p)",
@@ -362,9 +362,9 @@
  *
  */
-static int vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag,
+static errno_t vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag,
     label_part_t **rlpart)
 {
 	label_part_t *lpart;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_remove(%p)", part);
@@ -404,8 +404,8 @@
 /** Remove all disk partitions from our inventory leaving only the underlying
  * liblabel partition structures. */
-static int vbds_disk_parts_add(vbds_disk_t *disk, label_t *label)
+static errno_t vbds_disk_parts_add(vbds_disk_t *disk, label_t *label)
 {
 	label_part_t *part;
-	int rc;
+	errno_t rc;
 
 	part = label_part_first(label);
@@ -426,9 +426,9 @@
 /** Remove all disk partitions from our inventory leaving only the underlying
  * liblabel partition structures. */
-static int vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag)
+static errno_t vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag)
 {
 	link_t *link;
 	vbds_part_t *part;
-	int rc;
+	errno_t rc;
 
 	link = list_first(&disk->parts);
@@ -450,7 +450,7 @@
 }
 
-int vbds_disk_discovery_start(void)
-{
-	int rc;
+errno_t vbds_disk_discovery_start(void)
+{
+	errno_t rc;
 
 	rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb);
@@ -464,5 +464,5 @@
 }
 
-int vbds_disk_add(service_id_t sid)
+errno_t vbds_disk_add(service_id_t sid)
 {
 	label_t *label = NULL;
@@ -472,5 +472,5 @@
 	size_t block_size;
 	aoff64_t nblocks;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_add(%zu)", sid);
@@ -557,8 +557,8 @@
 }
 
-int vbds_disk_remove(service_id_t sid)
+errno_t vbds_disk_remove(service_id_t sid)
 {
 	vbds_disk_t *disk;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_remove(%zu)", sid);
@@ -583,5 +583,5 @@
 
 /** Get list of disks as array of service IDs. */
-int vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
+errno_t vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
 {
 	size_t act_cnt;
@@ -611,9 +611,9 @@
 }
 
-int vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)
+errno_t vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)
 {
 	vbds_disk_t *disk;
 	label_info_t linfo;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info(%zu)", sid);
@@ -638,5 +638,5 @@
 }
 
-int vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size,
+errno_t vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size,
     size_t *act_size)
 {
@@ -644,5 +644,5 @@
 	size_t act_cnt;
 	size_t buf_cnt;
-	int rc;
+	errno_t rc;
 
 	rc = vbds_disk_by_svcid(sid, &disk);
@@ -668,5 +668,5 @@
 }
 
-int vbds_label_create(service_id_t sid, label_type_t ltype)
+errno_t vbds_label_create(service_id_t sid, label_type_t ltype)
 {
 	label_t *label;
@@ -674,5 +674,5 @@
 	label_info_t linfo;
 	vbds_disk_t *disk;
-	int rc, rc2;
+	errno_t rc, rc2;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu)", sid);
@@ -739,10 +739,10 @@
 }
 
-int vbds_label_delete(service_id_t sid)
+errno_t vbds_label_delete(service_id_t sid)
 {
 	vbds_disk_t *disk;
 	label_t *label;
 	label_bd_t lbd;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_delete(%zu)", sid);
@@ -781,9 +781,9 @@
 }
 
-int vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo)
+errno_t vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo)
 {
 	vbds_part_t *part;
 	label_part_info_t lpinfo;
-	int rc;
+	errno_t rc;
 
 	rc = vbds_part_by_pid(partid, &part);
@@ -810,5 +810,5 @@
 }
 
-int vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec,
+errno_t vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec,
     vbds_part_id_t *rpart)
 {
@@ -817,5 +817,5 @@
 	label_part_spec_t lpspec;
 	label_part_t *lpart;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_create(%zu)", sid);
@@ -879,10 +879,10 @@
 }
 
-int vbds_part_delete(vbds_part_id_t partid)
+errno_t vbds_part_delete(vbds_part_id_t partid)
 {
 	vbds_part_t *part;
 	vbds_disk_t *disk;
 	label_part_t *lpart;
-	int rc;
+	errno_t rc;
 
 	rc = vbds_part_by_pid(partid, &part);
@@ -918,9 +918,9 @@
 }
 
-int vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt,
+errno_t vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt,
     label_ptype_t *ptype)
 {
 	vbds_disk_t *disk;
-	int rc;
+	errno_t rc;
 
 	rc = vbds_disk_by_svcid(sid, &disk);
@@ -942,5 +942,5 @@
 }
 
-static int vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
+static errno_t vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -953,5 +953,5 @@
 }
 
-static int vbds_bd_close(bd_srv_t *bd)
+static errno_t vbds_bd_close(bd_srv_t *bd)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -967,10 +967,10 @@
 }
 
-static int vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+static errno_t vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     void *buf, size_t size)
 {
 	vbds_part_t *part = bd_srv_part(bd);
 	aoff64_t gba;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_read_blocks()");
@@ -993,9 +993,9 @@
 }
 
-static int vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt)
+static errno_t vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt)
 {
 	vbds_part_t *part = bd_srv_part(bd);
 	aoff64_t gba;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_sync_cache()");
@@ -1017,10 +1017,10 @@
 }
 
-static int vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
+static errno_t vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     const void *buf, size_t size)
 {
 	vbds_part_t *part = bd_srv_part(bd);
 	aoff64_t gba;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_write_blocks()");
@@ -1042,5 +1042,5 @@
 }
 
-static int vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
+static errno_t vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -1055,5 +1055,5 @@
 }
 
-static int vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
+static errno_t vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
 {
 	vbds_part_t *part = bd_srv_part(bd);
@@ -1071,5 +1071,5 @@
 {
 	vbds_part_t *part;
-	int rc;
+	errno_t rc;
 	service_id_t svcid;
 
@@ -1094,5 +1094,5 @@
 
 /** Translate block segment address with range checking. */
-static int vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt,
+static errno_t vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt,
     aoff64_t *gba)
 {
@@ -1105,10 +1105,10 @@
 
 /** Register service for partition */
-static int vbds_part_svc_register(vbds_part_t *part)
+static errno_t vbds_part_svc_register(vbds_part_t *part)
 {
 	char *name;
 	service_id_t psid;
 	int idx;
-	int rc;
+	errno_t rc;
 
 	idx = part->lpart->index;
@@ -1152,7 +1152,7 @@
 
 /** Unregister service for partition */
-static int vbds_part_svc_unregister(vbds_part_t *part)
-{
-	int rc;
+static errno_t vbds_part_svc_unregister(vbds_part_t *part)
+{
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_svc_unregister("
@@ -1169,8 +1169,8 @@
 
 /** Update service names for any partition whose index has changed. */
-static int vbds_part_indices_update(vbds_disk_t *disk)
+static errno_t vbds_part_indices_update(vbds_disk_t *disk)
 {
 	label_part_info_t lpinfo;
-	int rc;
+	errno_t rc;
 
 	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_indices_update()");
@@ -1219,5 +1219,5 @@
 
 /** Get block size wrapper for liblabel */
-static int vbds_label_get_bsize(void *arg, size_t *bsize)
+static errno_t vbds_label_get_bsize(void *arg, size_t *bsize)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
@@ -1226,5 +1226,5 @@
 
 /** Get number of blocks wrapper for liblabel */
-static int vbds_label_get_nblocks(void *arg, aoff64_t *nblocks)
+static errno_t vbds_label_get_nblocks(void *arg, aoff64_t *nblocks)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
@@ -1233,5 +1233,5 @@
 
 /** Read blocks wrapper for liblabel */
-static int vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
+static errno_t vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
@@ -1240,5 +1240,5 @@
 
 /** Write blocks wrapper for liblabel */
-static int vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
+static errno_t vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
 {
 	vbds_disk_t *disk = (vbds_disk_t *)arg;
