Index: uspace/lib/ext4/src/filesystem.c
===================================================================
--- uspace/lib/ext4/src/filesystem.c	(revision cde999aca79219e8751af76502001a86d411d176)
+++ uspace/lib/ext4/src/filesystem.c	(revision 5a6cc679876514e29ac7899053554db66db754d9)
@@ -54,5 +54,5 @@
 #include "ext4/superblock.h"
 
-static int ext4_filesystem_check_features(ext4_filesystem_t *, bool *);
+static errno_t ext4_filesystem_check_features(ext4_filesystem_t *, bool *);
 
 /** Initialize filesystem for opening.
@@ -67,8 +67,8 @@
  *
  */
-static int ext4_filesystem_init(ext4_filesystem_t *fs, service_id_t service_id,
+static errno_t ext4_filesystem_init(ext4_filesystem_t *fs, service_id_t service_id,
     enum cache_mode cmode)
 {
-	int rc;
+	errno_t rc;
 	ext4_superblock_t *temp_superblock = NULL;
 
@@ -164,8 +164,8 @@
  *
  */
-int ext4_filesystem_probe(service_id_t service_id)
+errno_t ext4_filesystem_probe(service_id_t service_id)
 {
 	ext4_filesystem_t *fs = NULL;
-	int rc;
+	errno_t rc;
 
 	fs = calloc(1, sizeof(ext4_filesystem_t));
@@ -195,10 +195,10 @@
  *
  */
-int ext4_filesystem_open(ext4_instance_t *inst, service_id_t service_id,
+errno_t ext4_filesystem_open(ext4_instance_t *inst, service_id_t service_id,
     enum cache_mode cmode, aoff64_t *size, ext4_filesystem_t **rfs)
 {
 	ext4_filesystem_t *fs = NULL;
 	fs_node_t *root_node = NULL;
-	int rc;
+	errno_t rc;
 
 	fs = calloc(1, sizeof(ext4_filesystem_t));
@@ -256,9 +256,9 @@
  *
  */
-int ext4_filesystem_close(ext4_filesystem_t *fs)
+errno_t ext4_filesystem_close(ext4_filesystem_t *fs)
 {
 	/* Write the superblock to the device */
 	ext4_superblock_set_state(fs->superblock, EXT4_SUPERBLOCK_STATE_VALID_FS);
-	int rc = ext4_superblock_write_direct(fs->device, fs->superblock);
+	errno_t rc = ext4_superblock_write_direct(fs->device, fs->superblock);
 	if (rc != EOK)
 		return rc;
@@ -281,5 +281,5 @@
  *
  */
-static int ext4_filesystem_check_features(ext4_filesystem_t *fs,
+static errno_t ext4_filesystem_check_features(ext4_filesystem_t *fs,
     bool *read_only)
 {
@@ -380,5 +380,5 @@
  *
  */
-static int ext4_filesystem_init_block_bitmap(ext4_block_group_ref_t *bg_ref)
+static errno_t ext4_filesystem_init_block_bitmap(ext4_block_group_ref_t *bg_ref)
 {
 	uint64_t itb;
@@ -394,5 +394,5 @@
 	
 	block_t *bitmap_block;
-	int rc = block_get(&bitmap_block, bg_ref->fs->device,
+	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
 	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
 	if (rc != EOK)
@@ -451,5 +451,5 @@
  *
  */
-static int ext4_filesystem_init_inode_bitmap(ext4_block_group_ref_t *bg_ref)
+static errno_t ext4_filesystem_init_inode_bitmap(ext4_block_group_ref_t *bg_ref)
 {
 	/* Load bitmap */
@@ -458,5 +458,5 @@
 	block_t *bitmap_block;
 	
-	int rc = block_get(&bitmap_block, bg_ref->fs->device,
+	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
 	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
 	if (rc != EOK)
@@ -494,5 +494,5 @@
  *
  */
-static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
+static errno_t ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
 {
 	ext4_superblock_t *sb = bg_ref->fs->superblock;
@@ -519,5 +519,5 @@
 	for (uint32_t fblock = first_block; fblock <= last_block; ++fblock) {
 		block_t *block;
-		int rc = block_get(&block, bg_ref->fs->device, fblock,
+		errno_t rc = block_get(&block, bg_ref->fs->device, fblock,
 		    BLOCK_FLAGS_NOREAD);
 		if (rc != EOK)
@@ -544,5 +544,5 @@
  *
  */
-int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
+errno_t ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
     ext4_block_group_ref_t **ref)
 {
@@ -568,5 +568,5 @@
 	
 	/* Load block with descriptors */
-	int rc = block_get(&newref->block, fs->device, block_id, 0);
+	errno_t rc = block_get(&newref->block, fs->device, block_id, 0);
 	if (rc != EOK) {
 		free(newref);
@@ -804,5 +804,5 @@
  *
  */
-int ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *ref)
+errno_t ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *ref)
 {
 	/* Check if reference modified */
@@ -819,5 +819,5 @@
 	
 	/* Put back block, that contains block group descriptor */
-	int rc = block_put(ref->block);
+	errno_t rc = block_put(ref->block);
 	free(ref);
 	
@@ -834,5 +834,5 @@
  *
  */
-int ext4_filesystem_get_inode_ref(ext4_filesystem_t *fs, uint32_t index,
+errno_t ext4_filesystem_get_inode_ref(ext4_filesystem_t *fs, uint32_t index,
     ext4_inode_ref_t **ref)
 {
@@ -857,5 +857,5 @@
 	/* Load block group, where i-node is located */
 	ext4_block_group_ref_t *bg_ref;
-	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK) {
 		free(newref);
@@ -909,5 +909,5 @@
  *
  */
-int ext4_filesystem_put_inode_ref(ext4_inode_ref_t *ref)
+errno_t ext4_filesystem_put_inode_ref(ext4_inode_ref_t *ref)
 {
 	/* Check if reference modified */
@@ -918,5 +918,5 @@
 	
 	/* Put back block, that contains i-node */
-	int rc = block_put(ref->block);
+	errno_t rc = block_put(ref->block);
 	free(ref);
 	
@@ -933,5 +933,5 @@
  *
  */
-int ext4_filesystem_alloc_inode(ext4_filesystem_t *fs,
+errno_t ext4_filesystem_alloc_inode(ext4_filesystem_t *fs,
     ext4_inode_ref_t **inode_ref, int flags)
 {
@@ -943,5 +943,5 @@
 	/* Allocate inode by allocation algorithm */
 	uint32_t index;
-	int rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
+	errno_t rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
 	if (rc != EOK)
 		return rc;
@@ -1025,5 +1025,5 @@
  *
  */
-int ext4_filesystem_free_inode(ext4_inode_ref_t *inode_ref)
+errno_t ext4_filesystem_free_inode(ext4_inode_ref_t *inode_ref)
 {
 	ext4_filesystem_t *fs = inode_ref->fs;
@@ -1042,5 +1042,5 @@
 	uint32_t fblock = ext4_inode_get_indirect_block(inode_ref->inode, 0);
 	if (fblock != 0) {
-		int rc = ext4_balloc_free_block(inode_ref, fblock);
+		errno_t rc = ext4_balloc_free_block(inode_ref, fblock);
 		if (rc != EOK)
 			return rc;
@@ -1056,5 +1056,5 @@
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 1);
 	if (fblock != 0) {
-		int rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
+		errno_t rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
 		if (rc != EOK)
 			return rc;
@@ -1088,5 +1088,5 @@
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 2);
 	if (fblock != 0) {
-		int rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
+		errno_t rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
 		if (rc != EOK)
 			return rc;
@@ -1153,5 +1153,5 @@
 	    inode_ref->inode, fs->superblock);
 	if (xattr_block) {
-		int rc = ext4_balloc_free_block(inode_ref, xattr_block);
+		errno_t rc = ext4_balloc_free_block(inode_ref, xattr_block);
 		if (rc != EOK)
 			return rc;
@@ -1161,5 +1161,5 @@
 	
 	/* Free inode by allocator */
-	int rc;
+	errno_t rc;
 	if (ext4_inode_is_type(fs->superblock, inode_ref->inode,
 	    EXT4_INODE_MODE_DIRECTORY))
@@ -1179,5 +1179,5 @@
  *
  */
-int ext4_filesystem_truncate_inode(ext4_inode_ref_t *inode_ref,
+errno_t ext4_filesystem_truncate_inode(ext4_inode_ref_t *inode_ref,
     aoff64_t new_size)
 {
@@ -1212,5 +1212,5 @@
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		/* Extents require special operation */
-		int rc = ext4_extent_release_blocks_from(inode_ref,
+		errno_t rc = ext4_extent_release_blocks_from(inode_ref,
 		    old_blocks_count - diff_blocks_count);
 		if (rc != EOK)
@@ -1221,5 +1221,5 @@
 		/* Starting from 1 because of logical blocks are numbered from 0 */
 		for (uint32_t i = 1; i <= diff_blocks_count; ++i) {
-			int rc = ext4_filesystem_release_inode_block(inode_ref,
+			errno_t rc = ext4_filesystem_release_inode_block(inode_ref,
 			    old_blocks_count - i);
 			if (rc != EOK)
@@ -1244,5 +1244,5 @@
  *
  */
-int ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *inode_ref,
+errno_t ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *inode_ref,
     aoff64_t iblock, uint32_t *fblock)
 {
@@ -1261,5 +1261,5 @@
 	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-		int rc = ext4_extent_find_block(inode_ref, iblock, &current_block);
+		errno_t rc = ext4_extent_find_block(inode_ref, iblock, &current_block);
 		if (rc != EOK)
 			return rc;
@@ -1311,5 +1311,5 @@
 	while (level > 0) {
 		/* Load indirect block */
-		int rc = block_get(&block, fs->device, current_block, 0);
+		errno_t rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
@@ -1357,5 +1357,5 @@
  *
  */
-int ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *inode_ref,
+errno_t ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *inode_ref,
     aoff64_t iblock, uint32_t fblock)
 {
@@ -1407,5 +1407,5 @@
 	if (current_block == 0) {
 		/* Allocate new indirect block */
-		int rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
+		errno_t rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
 		if (rc != EOK)
 			return rc;
@@ -1441,5 +1441,5 @@
 	 */
 	while (level > 0) {
-		int rc = block_get(&block, fs->device, current_block, 0);
+		errno_t rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
@@ -1518,5 +1518,5 @@
  *
  */
-int ext4_filesystem_release_inode_block(ext4_inode_ref_t *inode_ref,
+errno_t ext4_filesystem_release_inode_block(ext4_inode_ref_t *inode_ref,
     uint32_t iblock)
 {
@@ -1575,5 +1575,5 @@
 			return EOK;
 		
-		int rc = block_get(&block, fs->device, current_block, 0);
+		errno_t rc = block_get(&block, fs->device, current_block, 0);
 		if (rc != EOK)
 			return rc;
@@ -1625,5 +1625,5 @@
  *
  */
-int ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref,
+errno_t ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref,
     uint32_t *fblock, uint32_t *iblock)
 {
@@ -1649,5 +1649,5 @@
 	/* Allocate new physical block */
 	uint32_t phys_block;
-	int rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
+	errno_t rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
 	if (rc != EOK)
 		return rc;
