Index: uspace/lib/ext4/Makefile
===================================================================
--- uspace/lib/ext4/Makefile	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/Makefile	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,6 +29,6 @@
 USPACE_PREFIX = ../..
 LIBRARY = libext4
-EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBPOSIX_PREFIX)
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBPOSIX_PREFIX)/libposix.a 
+EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a
 
 SOURCES = \
@@ -45,5 +45,4 @@
 	libext4_inode.c \
 	libext4_superblock.c
-	
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/ext4/libext4.h
===================================================================
--- uspace/lib/ext4/libext4.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_H_
@@ -49,5 +49,7 @@
 
 #include <stdio.h>
-#define EXT4FS_DBG(format, ...) {printf("ext4fs: %s: " format "\n", __FUNCTION__, ##__VA_ARGS__);}
+#define EXT4FS_DBG(format, ...) \
+	printf("ext4fs: %s: " format "\n", \
+	    __FUNCTION__, ##__VA_ARGS__) \
 
 #endif
Index: uspace/lib/ext4/libext4_balloc.c
===================================================================
--- uspace/lib/ext4/libext4_balloc.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_balloc.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_balloc.c
- * @brief	Physical block allocator.
+ * @file  libext4_balloc.c
+ * @brief Physical block allocator.
  */
 
@@ -42,61 +41,61 @@
 /** Compute number of block group from block address.
  *
- * @param sb			superblock pointer
- * @param block_addr	absolute address of block
- * @return 				block group index
+ * @param sb         Superblock pointer.
+ * @param block_addr Absolute address of block.
+ *
+ * @return Block group index
+ *
  */
 static uint32_t ext4_balloc_get_bgid_of_block(ext4_superblock_t *sb,
-		uint32_t block_addr)
+    uint32_t block_addr)
 {
-	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-	uint32_t first_block = ext4_superblock_get_first_data_block(sb);
-
+	uint32_t blocks_per_group =
+	    ext4_superblock_get_blocks_per_group(sb);
+	uint32_t first_block =
+	    ext4_superblock_get_first_data_block(sb);
+	
 	/* First block == 0 or 1 */
-	if (first_block == 0) {
+	if (first_block == 0)
 		return block_addr / blocks_per_group;
-	} else {
+	else
 		return (block_addr - 1) / blocks_per_group;
-	}
 }
 
 /** Free block.
  *
- * @param inode_ref			inode, where the block is allocated
- * @param block_addr		absolute block address to free
- * @return 					error code
+ * @param inode_ref  Inode, where the block is allocated
+ * @param block_addr Absolute block address to free
+ *
+ * @return Error code
+ *
  */
 int ext4_balloc_free_block(ext4_inode_ref_t *inode_ref, uint32_t block_addr)
 {
-	int rc;
-
 	ext4_filesystem_t *fs = inode_ref->fs;
 	ext4_superblock_t *sb = fs->superblock;
-
+	
 	/* Compute indexes */
 	uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, block_addr);
 	uint32_t index_in_group =
-			ext4_filesystem_blockaddr2_index_in_group(sb, block_addr);
-
+	    ext4_filesystem_blockaddr2_index_in_group(sb, block_addr);
+	
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	if (rc != EOK)
+		return rc;
+	
 	/* Load block with bitmap */
-	uint32_t bitmap_block_addr = ext4_block_group_get_block_bitmap(
-			bg_ref->block_group, sb);
+	uint32_t bitmap_block_addr =
+	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
 	block_t *bitmap_block;
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Modify bitmap */
 	ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
 	bitmap_block->dirty = true;
-
-
+	
 	/* Release block with bitmap */
 	rc = block_put(bitmap_block);
@@ -106,83 +105,79 @@
 		return rc;
 	}
-
+	
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Update superblock free blocks count */
-	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
+	uint32_t sb_free_blocks =
+	    ext4_superblock_get_free_blocks_count(sb);
 	sb_free_blocks++;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
+	
 	/* Update inode blocks count */
-	uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
+	uint64_t ino_blocks =
+	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
 	ino_blocks -= block_size / EXT4_INODE_BLOCK_SIZE;
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-
+	
 	/* Update block group free blocks count */
-	uint32_t free_blocks = ext4_block_group_get_free_blocks_count(
-			bg_ref->block_group, sb);
+	uint32_t free_blocks =
+	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
 	free_blocks++;
 	ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-			sb, free_blocks);
+	    sb, free_blocks);
 	bg_ref->dirty = true;
-
+	
 	/* Release block group reference */
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	return EOK;
 }
 
-
 /** Free continuous set of blocks.
  *
- * @param inode_ref			inode, where the blocks are allocated
- * @param first				first block to release
- * @param count				number of blocks to release
+ * @param inode_ref Inode, where the blocks are allocated
+ * @param first     First block to release
+ * @param count     Number of blocks to release
+ *
  */
 int ext4_balloc_free_blocks(ext4_inode_ref_t *inode_ref,
-		uint32_t first, uint32_t count)
+    uint32_t first, uint32_t count)
 {
-	int rc;
-
 	ext4_filesystem_t *fs = inode_ref->fs;
 	ext4_superblock_t *sb = fs->superblock;
-
+	
 	/* Compute indexes */
 	uint32_t block_group_first =
-			ext4_balloc_get_bgid_of_block(sb, first);
+	    ext4_balloc_get_bgid_of_block(sb, first);
 	uint32_t block_group_last =
-			ext4_balloc_get_bgid_of_block(sb, first + count - 1);
-
+	    ext4_balloc_get_bgid_of_block(sb, first + count - 1);
+	
 	assert(block_group_first == block_group_last);
-
+	
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
+	if (rc != EOK)
+		return rc;
+	
 	uint32_t index_in_group_first =
-			ext4_filesystem_blockaddr2_index_in_group(sb, first);
-
-
+	    ext4_filesystem_blockaddr2_index_in_group(sb, first);
+	
 	/* Load block with bitmap */
-	uint32_t bitmap_block_addr = ext4_block_group_get_block_bitmap(
-			bg_ref->block_group, sb);
-
+	uint32_t bitmap_block_addr =
+	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
+	
 	block_t *bitmap_block;
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Modify bitmap */
 	ext4_bitmap_free_bits(bitmap_block->data, index_in_group_first, count);
 	bitmap_block->dirty = true;
-
+	
 	/* Release block with bitmap */
 	rc = block_put(bitmap_block);
@@ -192,32 +187,33 @@
 		return rc;
 	}
-
+	
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Update superblock free blocks count */
-	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
+	uint32_t sb_free_blocks =
+	    ext4_superblock_get_free_blocks_count(sb);
 	sb_free_blocks += count;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
+	
 	/* Update inode blocks count */
-	uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
+	uint64_t ino_blocks =
+	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
 	ino_blocks -= count * (block_size / EXT4_INODE_BLOCK_SIZE);
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-
+	
 	/* Update block group free blocks count */
-	uint32_t free_blocks = ext4_block_group_get_free_blocks_count(
-			bg_ref->block_group, sb);
+	uint32_t free_blocks =
+	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
 	free_blocks += count;
 	ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-			sb, free_blocks);
+	    sb, free_blocks);
 	bg_ref->dirty = true;
-
+	
 	/* Release block group reference */
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	return EOK;
 }
@@ -225,36 +221,37 @@
 /** Compute first block for data in block group.
  *
- * @param sb		pointer to superblock
- * @param bg		pointer to block group
- * @param bgid		index of block group
- * @return			absolute block index of first block
- */
-uint32_t ext4_balloc_get_first_data_block_in_group(
-		ext4_superblock_t *sb, ext4_block_group_ref_t *bg_ref)
+ * @param sb   Pointer to superblock
+ * @param bg   Pointer to block group
+ * @param bgid Index of block group
+ *
+ * @return Absolute block index of first block
+ *
+ */
+uint32_t ext4_balloc_get_first_data_block_in_group(ext4_superblock_t *sb,
+    ext4_block_group_ref_t *bg_ref)
 {
 	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	uint32_t inode_table_first_block = ext4_block_group_get_inode_table_first_block(
-			bg_ref->block_group, sb);
+	uint32_t inode_table_first_block =
+	    ext4_block_group_get_inode_table_first_block(bg_ref->block_group, sb);
 	uint16_t inode_table_item_size = ext4_superblock_get_inode_size(sb);
 	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	uint32_t inode_table_bytes;
-
+	
 	if (bg_ref->index < block_group_count - 1) {
 		inode_table_bytes = inodes_per_group * inode_table_item_size;
 	} else {
-		/* last block group could be smaller */
+		/* Last block group could be smaller */
 		uint32_t inodes_count_total = ext4_superblock_get_inodes_count(sb);
 		inode_table_bytes =
-				(inodes_count_total - ((block_group_count - 1) * inodes_per_group))
-				* inode_table_item_size;
-	}
-
+		    (inodes_count_total - ((block_group_count - 1) * inodes_per_group)) *
+		    inode_table_item_size;
+	}
+	
 	uint32_t inode_table_blocks = inode_table_bytes / block_size;
-
-	if (inode_table_bytes % block_size) {
+	
+	if (inode_table_bytes % block_size)
 		inode_table_blocks++;
-	}
-
+	
 	return inode_table_first_block + inode_table_blocks;
 }
@@ -262,78 +259,76 @@
 /** Compute 'goal' for allocation algorithm.
  *
- * @param inode_ref		reference to inode, to allocate block for
- * @return				goal block number
+ * @param inode_ref Reference to inode, to allocate block for
+ *
+ * @return Goal block number
+ *
  */
 static uint32_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref)
 {
-	int rc;
 	uint32_t goal = 0;
-
+	
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
+	
 	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	uint32_t inode_block_count = inode_size / block_size;
-
-	if (inode_size % block_size != 0) {
+	
+	if (inode_size % block_size != 0)
 		inode_block_count++;
-	}
-
+	
 	/* If inode has some blocks, get last block address + 1 */
 	if (inode_block_count > 0) {
-
-		rc = ext4_filesystem_get_inode_data_block_index(inode_ref, inode_block_count - 1, &goal);
-		if (rc != EOK) {
+		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		    inode_block_count - 1, &goal);
+		if (rc != EOK)
 			return 0;
-		}
-
+		
 		if (goal != 0) {
 			goal++;
 			return goal;
 		}
-
-		/* if goal == 0, sparse file -> continue */
-	}
-
+		
+		/* If goal == 0, sparse file -> continue */
+	}
+	
 	/* Identify block group of inode */
 	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
 	uint32_t block_group = (inode_ref->index - 1) / inodes_per_group;
 	block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, block_group, &bg_ref);
-	if (rc != EOK) {
+	int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
+	    block_group, &bg_ref);
+	if (rc != EOK)
 		return 0;
-	}
-
+	
 	/* Compute indexes */
 	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	uint32_t inode_table_first_block = ext4_block_group_get_inode_table_first_block(
-			bg_ref->block_group, sb);
+	uint32_t inode_table_first_block =
+	    ext4_block_group_get_inode_table_first_block(bg_ref->block_group, sb);
 	uint16_t inode_table_item_size = ext4_superblock_get_inode_size(sb);
 	uint32_t inode_table_bytes;
-
+	
 	/* Check for last block group */
 	if (block_group < block_group_count - 1) {
 		inode_table_bytes = inodes_per_group * inode_table_item_size;
 	} else {
-		/* last block group could be smaller */
+		/* Last block group could be smaller */
 		uint32_t inodes_count_total = ext4_superblock_get_inodes_count(sb);
 		inode_table_bytes =
-				(inodes_count_total - ((block_group_count - 1) * inodes_per_group))
-				* inode_table_item_size;
-	}
-
+		    (inodes_count_total - ((block_group_count - 1) * inodes_per_group)) *
+		    inode_table_item_size;
+	}
+	
 	uint32_t inode_table_blocks = inode_table_bytes / block_size;
-
-	if (inode_table_bytes % block_size) {
+	
+	if (inode_table_bytes % block_size)
 		inode_table_blocks++;
-	}
-
+	
 	goal = inode_table_first_block + inode_table_blocks;
-
+	
 	ext4_filesystem_put_block_group_ref(bg_ref);
-
+	
 	return goal;
 }
@@ -341,18 +336,18 @@
 /** Data block allocation algorithm.
  *
- * @param inode_ref		inode to allocate block for
- * @param fblock		allocated block address
- * @return				error code
- */
-int ext4_balloc_alloc_block(
-		ext4_inode_ref_t *inode_ref, uint32_t *fblock)
+ * @param inode_ref Inode to allocate block for
+ * @param fblock    Allocated block address
+ *
+ * @return Error code
+ *
+ */
+int ext4_balloc_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t *fblock)
 {
-	int rc;
 	uint32_t allocated_block = 0;
-
+	
 	uint32_t bitmap_block_addr;
 	block_t *bitmap_block;
 	uint32_t rel_block_idx = 0;
-
+	
 	/* Find GOAL */
 	uint32_t goal = ext4_balloc_find_goal(inode_ref);
@@ -361,42 +356,40 @@
 		return ENOSPC;
 	}
-
+	
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
+	
 	/* Load block group number for goal and relative index */
 	uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, goal);
 	uint32_t index_in_group =
-			ext4_filesystem_blockaddr2_index_in_group(sb, goal);
-
-
+	    ext4_filesystem_blockaddr2_index_in_group(sb, goal);
+	
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, block_group, &bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
+	    block_group, &bg_ref);
+	if (rc != EOK)
+		return rc;
+	
 	/* Compute indexes */
 	uint32_t first_in_group =
-			ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
-
-	uint32_t first_in_group_index = ext4_filesystem_blockaddr2_index_in_group(
-			sb, first_in_group);
-
-	if (index_in_group < first_in_group_index) {
+	    ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
+	
+	uint32_t first_in_group_index =
+	    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
+	
+	if (index_in_group < first_in_group_index)
 		index_in_group = first_in_group_index;
-	}
-
+	
 	/* Load block with bitmap */
-	bitmap_block_addr = ext4_block_group_get_block_bitmap(
-			bg_ref->block_group, sb);
-
+	bitmap_block_addr =
+	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
+	
 	rc = block_get(&bitmap_block, inode_ref->fs->device,
-			bitmap_block_addr, BLOCK_FLAGS_NONE);
+	    bitmap_block_addr, BLOCK_FLAGS_NONE);
 	if (rc != EOK) {
 		ext4_filesystem_put_block_group_ref(bg_ref);
 		return rc;
 	}
-
+	
 	/* Check if goal is free */
 	if (ext4_bitmap_is_free_bit(bitmap_block->data, index_in_group)) {
@@ -408,174 +401,179 @@
 			return rc;
 		}
-
-		allocated_block = ext4_filesystem_index_in_group2blockaddr(
-							sb, index_in_group, block_group);
-
+		
+		allocated_block =
+		    ext4_filesystem_index_in_group2blockaddr(sb, index_in_group,
+		    block_group);
+		
 		goto success;
-
-	}
-
-	uint32_t blocks_in_group = ext4_superblock_get_blocks_in_group(sb, block_group);
-
+	}
+	
+	uint32_t blocks_in_group =
+	    ext4_superblock_get_blocks_in_group(sb, block_group);
+	
 	uint32_t end_idx = (index_in_group + 63) & ~63;
-	if (end_idx > blocks_in_group) {
+	if (end_idx > blocks_in_group)
 		end_idx = blocks_in_group;
-	}
-
+	
 	/* Try to find free block near to goal */
-	for (uint32_t tmp_idx = index_in_group + 1; tmp_idx < end_idx; ++tmp_idx) {
+	for (uint32_t tmp_idx = index_in_group + 1; tmp_idx < end_idx;
+	    ++tmp_idx) {
 		if (ext4_bitmap_is_free_bit(bitmap_block->data, tmp_idx)) {
-
 			ext4_bitmap_set_bit(bitmap_block->data, tmp_idx);
 			bitmap_block->dirty = true;
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
-			allocated_block = ext4_filesystem_index_in_group2blockaddr(
-					sb, tmp_idx, block_group);
-
+			
+			allocated_block =
+			    ext4_filesystem_index_in_group2blockaddr(sb, tmp_idx,
+			    block_group);
+			
 			goto success;
 		}
-
-	}
-
+	}
+	
 	/* Find free BYTE in bitmap */
-	rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data, index_in_group, &rel_block_idx, blocks_in_group);
+	rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
+	    index_in_group, &rel_block_idx, blocks_in_group);
 	if (rc == EOK) {
 		bitmap_block->dirty = true;
 		rc = block_put(bitmap_block);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
-
-		allocated_block = ext4_filesystem_index_in_group2blockaddr(
-				sb, rel_block_idx, block_group);
-
+		
+		allocated_block =
+		    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
+		    block_group);
+		
 		goto success;
 	}
-
+	
 	/* Find free bit in bitmap */
-	rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data, index_in_group, &rel_block_idx, blocks_in_group);
+	rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
+	    index_in_group, &rel_block_idx, blocks_in_group);
 	if (rc == EOK) {
 		bitmap_block->dirty = true;
 		rc = block_put(bitmap_block);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
-
-		allocated_block = ext4_filesystem_index_in_group2blockaddr(
-				sb, rel_block_idx, block_group);
-
+		
+		allocated_block =
+		    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
+		    block_group);
+		
 		goto success;
 	}
-
+	
 	/* No free block found yet */
 	block_put(bitmap_block);
 	ext4_filesystem_put_block_group_ref(bg_ref);
-
+	
 	/* Try other block groups */
 	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-
+	
 	uint32_t bgid = (block_group + 1) % block_group_count;
 	uint32_t count = block_group_count;
-
+	
 	while (count > 0) {
-		rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, bgid, &bg_ref);
-		if (rc != EOK) {
+		rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, bgid,
+		    &bg_ref);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		/* Load block with bitmap */
-		bitmap_block_addr = ext4_block_group_get_block_bitmap(
-				bg_ref->block_group, sb);
-
-		rc = block_get(&bitmap_block, inode_ref->fs->device, bitmap_block_addr, 0);
+		bitmap_block_addr =
+		    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
+		
+		rc = block_get(&bitmap_block, inode_ref->fs->device,
+		    bitmap_block_addr, 0);
 		if (rc != EOK) {
 			ext4_filesystem_put_block_group_ref(bg_ref);
 			return rc;
 		}
-
+		
 		/* Compute indexes */
-		first_in_group = ext4_balloc_get_first_data_block_in_group(
-				sb, bg_ref);
-		index_in_group = ext4_filesystem_blockaddr2_index_in_group(sb,
-						first_in_group);
+		first_in_group =
+		    ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
+		index_in_group =
+		    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
 		blocks_in_group = ext4_superblock_get_blocks_in_group(sb, bgid);
-
-		first_in_group_index = ext4_filesystem_blockaddr2_index_in_group(
-			sb, first_in_group);
-
-		if (index_in_group < first_in_group_index) {
+		
+		first_in_group_index =
+		    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
+		
+		if (index_in_group < first_in_group_index)
 			index_in_group = first_in_group_index;
-		}
-
+		
 		/* Try to find free byte in bitmap */
 		rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
-				index_in_group, &rel_block_idx, blocks_in_group);
+		    index_in_group, &rel_block_idx, blocks_in_group);
 		if (rc == EOK) {
 			bitmap_block->dirty = true;
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
-			allocated_block = ext4_filesystem_index_in_group2blockaddr(
-					sb, rel_block_idx, bgid);
-
+			
+			allocated_block =
+			    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
+			    bgid);
+			
 			goto success;
 		}
-
+		
 		/* Try to find free bit in bitmap */
-		rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data, index_in_group, &rel_block_idx, blocks_in_group);
+		rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
+		    index_in_group, &rel_block_idx, blocks_in_group);
 		if (rc == EOK) {
 			bitmap_block->dirty = true;
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
-			allocated_block = ext4_filesystem_index_in_group2blockaddr(
-					sb, rel_block_idx, bgid);
-
+			
+			allocated_block =
+			    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
+			    bgid);
+			
 			goto success;
 		}
-
+		
 		block_put(bitmap_block);
 		ext4_filesystem_put_block_group_ref(bg_ref);
-
+		
 		/* Goto next group */
 		bgid = (bgid + 1) % block_group_count;
 		count--;
 	}
-
+	
 	return ENOSPC;
-
+	
 success:
-	; 	/* Empty command - because of syntax */
+	/* Empty command - because of syntax */
+	;
 	
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Update superblock free blocks count */
 	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
 	sb_free_blocks--;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
+	
 	/* Update inode blocks (different block size!) count */
-	uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
+	uint64_t ino_blocks =
+	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
 	ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE;
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-
+	
 	/* Update block group free blocks count */
-	uint32_t bg_free_blocks = ext4_block_group_get_free_blocks_count(
-			bg_ref->block_group, sb);
+	uint32_t bg_free_blocks =
+	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
 	bg_free_blocks--;
-	ext4_block_group_set_free_blocks_count(bg_ref->block_group, sb, bg_free_blocks);
+	ext4_block_group_set_free_blocks_count(bg_ref->block_group, sb,
+	    bg_free_blocks);
 	bg_ref->dirty = true;
-
+	
 	ext4_filesystem_put_block_group_ref(bg_ref);
-
+	
 	*fblock = allocated_block;
 	return EOK;
@@ -584,41 +582,41 @@
 /** Try to allocate concrete block.
  *
- * @param inode_ref		inode to allocate block for
- * @param fblock		block address to allocate
- * @param free			output value - if target block is free
- * @return				error code
- */
-int ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref,
-		uint32_t fblock, bool *free)
+ * @param inode_ref Inode to allocate block for
+ * @param fblock    Block address to allocate
+ * @param free      Output value - if target block is free
+ *
+ * @return Error code
+ *
+ */
+int ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t fblock,
+    bool *free)
 {
 	int rc = EOK;
-
+	
 	ext4_filesystem_t *fs = inode_ref->fs;
 	ext4_superblock_t *sb = fs->superblock;
-
+	
 	/* Compute indexes */
 	uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, fblock);
 	uint32_t index_in_group =
-			ext4_filesystem_blockaddr2_index_in_group(sb, fblock);
-
+	    ext4_filesystem_blockaddr2_index_in_group(sb, fblock);
+	
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
 	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Load block with bitmap */
-	uint32_t bitmap_block_addr = ext4_block_group_get_block_bitmap(
-			bg_ref->block_group, sb);
+	uint32_t bitmap_block_addr =
+	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
 	block_t *bitmap_block;
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Check if block is free */
 	*free = ext4_bitmap_is_free_bit(bitmap_block->data, index_in_group);
-
+	
 	/* Allocate block if possible */
 	if (*free) {
@@ -626,5 +624,5 @@
 		bitmap_block->dirty = true;
 	}
-
+	
 	/* Release block with bitmap */
 	rc = block_put(bitmap_block);
@@ -634,42 +632,36 @@
 		return rc;
 	}
-
+	
 	/* If block is not free, return */
-	if (!(*free)) {
+	if (!(*free))
 		goto terminate;
-	}
-
+	
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Update superblock free blocks count */
 	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
 	sb_free_blocks--;
 	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
+	
 	/* Update inode blocks count */
-	uint64_t ino_blocks = ext4_inode_get_blocks_count(sb, inode_ref->inode);
+	uint64_t ino_blocks =
+	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
 	ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE;
 	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
 	inode_ref->dirty = true;
-
+	
 	/* Update block group free blocks count */
-	uint32_t free_blocks = ext4_block_group_get_free_blocks_count(
-			bg_ref->block_group, sb);
+	uint32_t free_blocks =
+	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
 	free_blocks--;
 	ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-			sb, free_blocks);
+	    sb, free_blocks);
 	bg_ref->dirty = true;
-
+	
 terminate:
-
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return rc;
+	return ext4_filesystem_put_block_group_ref(bg_ref);
 }
 
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_balloc.h
===================================================================
--- uspace/lib/ext4/libext4_balloc.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_balloc.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_BALLOC_H_
@@ -38,8 +38,7 @@
 
 extern int ext4_balloc_free_block(ext4_inode_ref_t *, uint32_t);
-extern int ext4_balloc_free_blocks(ext4_inode_ref_t *,
-		uint32_t , uint32_t);
-extern uint32_t ext4_balloc_get_first_data_block_in_group(
-		ext4_superblock_t *, ext4_block_group_ref_t *);
+extern int ext4_balloc_free_blocks(ext4_inode_ref_t *, uint32_t, uint32_t);
+extern uint32_t ext4_balloc_get_first_data_block_in_group(ext4_superblock_t *,
+    ext4_block_group_ref_t *);
 extern int ext4_balloc_alloc_block(ext4_inode_ref_t *, uint32_t *);
 extern int ext4_balloc_try_alloc_block(ext4_inode_ref_t *, uint32_t, bool *);
Index: uspace/lib/ext4/libext4_bitmap.c
===================================================================
--- uspace/lib/ext4/libext4_bitmap.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_bitmap.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_bitmap.c
- * @brief	Ext4 bitmap operations.
+ * @file  libext4_bitmap.c
+ * @brief Ext4 bitmap operations.
  */
 
@@ -45,6 +44,7 @@
  * Index must be checked by caller, if it's not out of bounds.
  *
- * @param bitmap	pointer to bitmap
- * @param index		index of bit in bitmap
+ * @param bitmap Pointer to bitmap
+ * @param index  Index of bit in bitmap
+ *
  */
 void ext4_bitmap_free_bit(uint8_t *bitmap, uint32_t index)
@@ -52,7 +52,7 @@
 	uint32_t byte_index = index / 8;
 	uint32_t bit_index = index % 8;
-
+	
 	uint8_t *target = bitmap + byte_index;
-
+	
 	*target &= ~ (1 << bit_index);
 }
@@ -62,7 +62,8 @@
  * Index and count must be checked by caller, if they aren't out of bounds.
  *
- * @param bitmap	pointer to bitmap
- * @param index		index of first bit to zeroed
- * @param count		number of bits to be zeroed
+ * @param bitmap Pointer to bitmap
+ * @param index  Index of first bit to zeroed
+ * @param count  Number of bits to be zeroed
+ *
  */
 void ext4_bitmap_free_bits(uint8_t *bitmap, uint32_t index, uint32_t count)
@@ -72,50 +73,45 @@
 	uint32_t remaining = count;
 	uint32_t byte_index;
-
+	
 	/* Align index to multiple of 8 */
 	while (((idx % 8) != 0) && (remaining > 0)) {
-
 		byte_index = idx / 8;
 		uint32_t bit_index = idx % 8;
-
+		
 		target = bitmap + byte_index;
-
 		*target &= ~ (1 << bit_index);
-
+		
 		idx++;
 		remaining--;
 	}
-
+	
 	/* For < 8 bits this check necessary */
-	if (remaining == 0) {
+	if (remaining == 0)
 		return;
-	}
-
+	
 	assert((idx % 8) == 0);
-
+	
 	byte_index = idx / 8;
 	target = bitmap + byte_index;
-
+	
 	/* Zero the whole bytes */
 	while (remaining >= 8) {
 		*target = 0;
-
+		
 		idx += 8;
 		remaining -= 8;
 		target++;
 	}
-
+	
 	assert(remaining < 8);
-
+	
 	/* Zero remaining bytes */
 	while (remaining != 0) {
-
 		byte_index = idx / 8;
 		uint32_t bit_index = idx % 8;
-
+		
 		target = bitmap + byte_index;
-
 		*target &= ~ (1 << bit_index);
-
+		
 		idx++;
 		remaining--;
@@ -125,6 +121,7 @@
 /** Set bit in bitmap to 1 (used).
  *
- * @param bitmap	pointer to bitmap
- * @param index		index of bit to set
+ * @param bitmap Pointer to bitmap
+ * @param index  Index of bit to set
+ *
  */
 void ext4_bitmap_set_bit(uint8_t *bitmap, uint32_t index)
@@ -132,7 +129,7 @@
 	uint32_t byte_index = index / 8;
 	uint32_t bit_index = index % 8;
-
+	
 	uint8_t *target = bitmap + byte_index;
-
+	
 	*target |= 1 << bit_index;
 }
@@ -140,7 +137,9 @@
 /** Check if requested bit is free.
  *
- * @param bitmap	pointer to bitmap
- * @param index		index of bit to be checked
- * @return			true if bit is free, else false
+ * @param bitmap Pointer to bitmap
+ * @param index  Index of bit to be checked
+ *
+ * @return True if bit is free, else false
+ *
  */
 bool ext4_bitmap_is_free_bit(uint8_t *bitmap, uint32_t index)
@@ -148,53 +147,52 @@
 	uint32_t byte_index = index / 8;
 	uint32_t bit_index = index % 8;
-
+	
 	uint8_t *target = bitmap + byte_index;
-
-	if (*target & (1 << bit_index)) {
+	
+	if (*target & (1 << bit_index))
 		return false;
-	} else {
+	else
 		return true;
-	}
-
-}
-
-/**	Try to find free byte and set the first bit as used.
- *
- * Walk through bitmap and try to find free byte ( == 0).
+}
+
+/** Try to find free byte and set the first bit as used.
+ *
+ * Walk through bitmap and try to find free byte (equal to 0).
  * If byte found, set the first bit as used.
  *
- * @param bitmap	pointer to bitmap
- * @param start		index of bit, where the algorithm will begin
- * @param index		output value - index of bit (if found free byte)
- * @param max		maximum index of bit in bitmap
- * @return			error code
- */
-int ext4_bitmap_find_free_byte_and_set_bit(uint8_t *bitmap, uint32_t start, uint32_t *index, uint32_t max)
+ * @param bitmap Pointer to bitmap
+ * @param start  Index of bit, where the algorithm will begin
+ * @param index  Output value - index of bit (if found free byte)
+ * @param max    Maximum index of bit in bitmap
+ *
+ * @return Error code
+ *
+ */
+int ext4_bitmap_find_free_byte_and_set_bit(uint8_t *bitmap, uint32_t start,
+    uint32_t *index, uint32_t max)
 {
 	uint32_t idx;
-
+	
 	/* Align idx */
-	if (start % 8) {
+	if (start % 8)
 		idx = start + (8 - (start % 8));
-	} else {
+	else
 		idx = start;
-	}
-
+	
 	uint8_t *pos = bitmap + (idx / 8);
-
+	
 	/* Try to find free byte */
 	while (idx < max) {
-
 		if (*pos == 0) {
 			*pos |= 1;
-
+			
 			*index = idx;
 			return EOK;
 		}
-
+		
 		idx += 8;
 		++pos;
 	}
-
+	
 	/* Free byte not found */
 	return ENOSPC;
@@ -205,21 +203,23 @@
  * Walk through bitmap and try to find any free bit.
  *
- * @param bitmap	pointer to bitmap
- * @param start_idx	index of bit, where algorithm will begin
- * @param index		output value - index of set bit (if found)
- * @param max		maximum index of bit in bitmap
- * @return			error code
+ * @param bitmap    Pointer to bitmap
+ * @param start_idx Index of bit, where algorithm will begin
+ * @param index     Output value - index of set bit (if found)
+ * @param max       Maximum index of bit in bitmap
+ *
+ * @return Error code
+ *
  */
 int ext4_bitmap_find_free_bit_and_set(uint8_t *bitmap, uint32_t start_idx,
-		uint32_t *index, uint32_t max)
+    uint32_t *index, uint32_t max)
 {
 	uint8_t *pos = bitmap + (start_idx / 8);
 	uint32_t idx = start_idx;
 	bool byte_part = false;
-
+	
 	/* Check the rest of first byte */
 	while ((idx % 8) != 0) {
 		byte_part = true;
-
+		
 		if ((*pos & (1 << (idx % 8))) == 0) {
 			*pos |= (1 << (idx % 8));
@@ -227,39 +227,38 @@
 			return EOK;
 		}
-
+		
 		++idx;
 	}
-
-	if (byte_part) {
+	
+	if (byte_part)
 		++pos;
-	}
-
+	
 	/* Check the whole bytes (255 = 11111111 binary) */
 	while (idx < max) {
-
 		if ((*pos & 255) != 255) {
-			/* free bit found */
+			/* Free bit found */
 			break;
 		}
-
+		
 		idx += 8;
 		++pos;
 	}
-
+	
 	/* If idx < max, some free bit found */
 	if (idx < max) {
-
 		/* Check which bit from byte is free */
 		for (uint8_t i = 0; i < 8; ++i) {
 			if ((*pos & (1 << i)) == 0) {
-				/* free bit found */
-				*pos |=  (1 << i);
+				/* Free bit found */
+				*pos |= (1 << i);
+				
 				*index = idx;
 				return EOK;
 			}
+			
 			idx++;
 		}
 	}
-
+	
 	/* Free bit not found */
 	return ENOSPC;
@@ -268,3 +267,3 @@
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_bitmap.h
===================================================================
--- uspace/lib/ext4/libext4_bitmap.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_bitmap.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_BITMAP_H_
@@ -41,7 +41,7 @@
 extern bool ext4_bitmap_is_free_bit(uint8_t *, uint32_t);
 extern int ext4_bitmap_find_free_byte_and_set_bit(uint8_t *, uint32_t,
-		uint32_t *, uint32_t);
-extern int ext4_bitmap_find_free_bit_and_set(uint8_t *, uint32_t,
-		uint32_t *, uint32_t);
+    uint32_t *, uint32_t);
+extern int ext4_bitmap_find_free_bit_and_set(uint8_t *, uint32_t, uint32_t *,
+    uint32_t);
 
 #endif
Index: uspace/lib/ext4/libext4_block_group.c
===================================================================
--- uspace/lib/ext4/libext4_block_group.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_block_group.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_block_group.c
- * @brief	Ext4 block group structure operations.
+ * @file  libext4_block_group.c
+ * @brief Ext4 block group structure operations.
  */
 
@@ -41,208 +40,227 @@
 /** Get address of block with data block bitmap.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		address of block with block bitmap
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Address of block with block bitmap
+ *
  */
 uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		return ((uint64_t)uint32_t_le2host(bg->block_bitmap_hi) << 32) |
-			uint32_t_le2host(bg->block_bitmap_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint64_t) uint32_t_le2host(bg->block_bitmap_hi) << 32) |
+		    uint32_t_le2host(bg->block_bitmap_lo);
+	else
 		return uint32_t_le2host(bg->block_bitmap_lo);
-	}
 }
 
 /** Set address of block with data block bitmap.
  *
- * @param bg			pointer to block group
- * @param sb			pointer to superblock
- * @param block_bitmap 	address of block with block bitmap
+ * @param bg           Pointer to block group
+ * @param sb           Pointer to superblock
+ * @param block_bitmap Address of block with block bitmap
+ *
  */
 void ext4_block_group_set_block_bitmap(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint64_t block_bitmap)
+    ext4_superblock_t *sb, uint64_t block_bitmap)
 {
 	bg->block_bitmap_lo = host2uint32_t_le((block_bitmap << 32) >> 32);
-
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->block_bitmap_hi = host2uint32_t_le(block_bitmap >> 32);
-	}
 }
 
 /** Get address of block with i-node bitmap.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		address of block with i-node bitmap
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Address of block with i-node bitmap
+ *
  */
 uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		return ((uint64_t)uint32_t_le2host(bg->inode_bitmap_hi) << 32) |
-			uint32_t_le2host(bg->inode_bitmap_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint64_t) uint32_t_le2host(bg->inode_bitmap_hi) << 32) |
+		    uint32_t_le2host(bg->inode_bitmap_lo);
+	else
 		return uint32_t_le2host(bg->inode_bitmap_lo);
-	}
-
 }
 
 /** Set address of block with i-node bitmap.
  *
- * @param bg			pointer to block group
- * @param sb			pointer to superblock
- * @param inode_bitmap	address of block with i-node bitmap
+ * @param bg           Pointer to block group
+ * @param sb           Pointer to superblock
+ * @param inode_bitmap Address of block with i-node bitmap
+ *
  */
 void ext4_block_group_set_inode_bitmap(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint64_t inode_bitmap)
+    ext4_superblock_t *sb, uint64_t inode_bitmap)
 {
 	bg->inode_bitmap_lo = host2uint32_t_le((inode_bitmap << 32) >> 32);
-
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->inode_bitmap_hi = host2uint32_t_le(inode_bitmap >> 32);
-	}
 }
 
 /** Get address of the first block of the i-node table.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		address of first block of i-node table
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Address of first block of i-node table
+ *
  */
 uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		return ((uint64_t)uint32_t_le2host(bg->inode_table_first_block_hi) << 32) |
-			uint32_t_le2host(bg->inode_table_first_block_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint64_t)
+		    uint32_t_le2host(bg->inode_table_first_block_hi) << 32) |
+		    uint32_t_le2host(bg->inode_table_first_block_lo);
+	else
 		return uint32_t_le2host(bg->inode_table_first_block_lo);
-	}
 }
 
 /** Set address of the first block of the i-node table.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @param inode_table_first address of first block of i-node table
+ * @param bg                Pointer to block group
+ * @param sb                Pointer to superblock
+ * @param inode_table_first Address of first block of i-node table
+ *
  */
 void ext4_block_group_set_inode_table_first_block(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint64_t inode_table_first)
+    ext4_superblock_t *sb, uint64_t inode_table_first)
 {
 	bg->inode_table_first_block_lo =
-			host2uint32_t_le((inode_table_first << 32) >> 32);
-
-	if (ext4_superblock_get_desc_size(sb) >
-			EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-
+	    host2uint32_t_le((inode_table_first << 32) >> 32);
+	
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->inode_table_first_block_hi =
-				host2uint32_t_le(inode_table_first >> 32);
-	}
+		    host2uint32_t_le(inode_table_first >> 32);
 }
 
 /** Get number of free blocks in block group.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		number of free blocks in block group
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Number of free blocks in block group
+ *
  */
 uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-			EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-
-		return ((uint32_t)uint16_t_le2host(bg->free_blocks_count_hi) << 16) |
-			uint16_t_le2host(bg->free_blocks_count_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint32_t)
+		    uint16_t_le2host(bg->free_blocks_count_hi) << 16) |
+		    uint16_t_le2host(bg->free_blocks_count_lo);
+	else
 		return uint16_t_le2host(bg->free_blocks_count_lo);
-	}
 }
 
 /** Set number of free blocks in block group.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @param value	number of free blocks in block group
+ * @param bg    Pointer to block group
+ * @param sb    Pointer to superblock
+ * @param value Number of free blocks in block group
+ *
  */
 void ext4_block_group_set_free_blocks_count(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint32_t value)
+    ext4_superblock_t *sb, uint32_t value)
 {
 	bg->free_blocks_count_lo = host2uint16_t_le((value << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->free_blocks_count_hi = host2uint16_t_le(value >> 16);
-	}
 }
 
 /** Get number of free i-nodes in block group.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		number of free i-nodes in block group
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Number of free i-nodes in block group
+ *
  */
 uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		return ((uint32_t)uint16_t_le2host(bg->free_inodes_count_hi) << 16) |
-			uint16_t_le2host(bg->free_inodes_count_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint32_t)
+		    uint16_t_le2host(bg->free_inodes_count_hi) << 16) |
+		    uint16_t_le2host(bg->free_inodes_count_lo);
+	else
 		return uint16_t_le2host(bg->free_inodes_count_lo);
-	}
 }
 
 /** Set number of free i-nodes in block group.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @param value	number of free i-nodes in block group
+ * @param bg    Pointer to block group
+ * @param sb    Pointer to superblock
+ * @param value Number of free i-nodes in block group
+ *
  */
 void ext4_block_group_set_free_inodes_count(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint32_t value)
+    ext4_superblock_t *sb, uint32_t value)
 {
 	bg->free_inodes_count_lo = host2uint16_t_le((value << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->free_inodes_count_hi = host2uint16_t_le(value >> 16);
-	}
 }
 
 /** Get number of used directories in block group.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		number of used directories in block group
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Number of used directories in block group
+ *
  */
 uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		return ((uint32_t)uint16_t_le2host(bg->used_dirs_count_hi) << 16) |
-			uint16_t_le2host(bg->used_dirs_count_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint32_t)
+		    uint16_t_le2host(bg->used_dirs_count_hi) << 16) |
+		    uint16_t_le2host(bg->used_dirs_count_lo);
+	else
 		return uint16_t_le2host(bg->used_dirs_count_lo);
-	}
 }
 
 /** Set number of used directories in block group.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @param value	number of used directories in block group
+ * @param bg    Pointer to block group
+ * @param sb    Pointer to superblock
+ * @param value Number of used directories in block group
+ *
  */
 void ext4_block_group_set_used_dirs_count(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint32_t count)
+    ext4_superblock_t *sb, uint32_t count)
 {
 	bg->used_dirs_count_lo = host2uint16_t_le((count << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->used_dirs_count_hi = host2uint16_t_le(count >> 16);
-	}
 }
 
 /** Get flags of block group.
  *
- * @param bg	pointer to block group
- * @return		flags of block group
+ * @param bg Pointer to block group
+ *
+ * @return Flags of block group
+ *
  */
 uint16_t ext4_block_group_get_flags(ext4_block_group_t *bg)
@@ -253,6 +271,7 @@
 /** Set flags for block group.
  *
- * @param bg	pointer to block group
- * @param flags	flags for block group
+ * @param bg    Pointer to block group
+ * @param flags Flags for block group
+ *
  */
 void ext4_block_group_set_flags(ext4_block_group_t *bg, uint16_t flags)
@@ -263,39 +282,44 @@
 /** Get number of unused i-nodes.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @return		number of unused i-nodes
+ * @param bg Pointer to block group
+ * @param sb Pointer to superblock
+ *
+ * @return Number of unused i-nodes
+ *
  */
 uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *bg,
-		ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		return ((uint32_t)uint16_t_le2host(bg->itable_unused_hi) << 16) |
-			uint16_t_le2host(bg->itable_unused_lo);
-	} else {
+    ext4_superblock_t *sb)
+{
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		return ((uint32_t)
+		    uint16_t_le2host(bg->itable_unused_hi) << 16) |
+		    uint16_t_le2host(bg->itable_unused_lo);
+	else
 		return uint16_t_le2host(bg->itable_unused_lo);
-	}
 }
 
 /** Set number of unused i-nodes.
  *
- * @param bg	pointer to block group
- * @param sb	pointer to superblock
- * @param value number of unused i-nodes
+ * @param bg    Pointer to block group
+ * @param sb    Pointer to superblock
+ * @param value Number of unused i-nodes
+ *
  */
 void ext4_block_group_set_itable_unused(ext4_block_group_t *bg,
-		ext4_superblock_t *sb, uint32_t value)
+    ext4_superblock_t *sb, uint32_t value)
 {
 	bg->itable_unused_lo = host2uint16_t_le((value << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		bg->itable_unused_hi = host2uint16_t_le(value >> 16);
-	}
-
 }
 
 /** Get checksum of block group.
  *
- * @param bg	pointer to block group
- * @return		checksum of block group
+ * @param bg Pointer to block group
+ *
+ * @return checksum of block group
+ *
  */
 uint16_t ext4_block_group_get_checksum(ext4_block_group_t *bg)
@@ -306,6 +330,7 @@
 /** Set checksum of block group.
  *
- * @param bg		pointer to block group
- * @param checksum	cheksum of block group
+ * @param bg       Pointer to block group
+ * @param checksum Cheksum of block group
+ *
  */
 void ext4_block_group_set_checksum(ext4_block_group_t *bg, uint16_t checksum)
@@ -316,13 +341,15 @@
 /** Check if block group has a flag.
  *
- * @param bg	pointer to block group
- * @param flag	flag to be checked
- * @return		true if flag is set to 1
+ * @param bg   Pointer to block group
+ * @param flag Flag to be checked
+ *
+ * @return True if flag is set to 1
+ *
  */
 bool ext4_block_group_has_flag(ext4_block_group_t *bg, uint32_t flag)
 {
-	if (ext4_block_group_get_flags(bg) & flag) {
+	if (ext4_block_group_get_flags(bg) & flag)
 		return true;
-	}
+	
 	return false;
 }
@@ -330,6 +357,7 @@
 /** Set (add) flag of block group.
  *
- * @param bg	pointer to block group
- * @param flag	flag to be set
+ * @param bg   Pointer to block group
+ * @param flag Flag to be set
+ *
  */
 void ext4_block_group_set_flag(ext4_block_group_t *bg, uint32_t set_flag)
@@ -342,6 +370,7 @@
 /** Clear (remove) flag of block group.
  *
- * @param bg	pointer to block group
- * @param flag	flag to be cleared
+ * @param bg   Pointer to block group
+ * @param flag Flag to be cleared
+ *
  */
 void ext4_block_group_clear_flag(ext4_block_group_t *bg, uint32_t clear_flag)
@@ -352,6 +381,5 @@
 }
 
-
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_block_group.h
===================================================================
--- uspace/lib/ext4/libext4_block_group.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_block_group.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_BLOCK_GROUP_H_
@@ -39,35 +39,35 @@
 
 extern uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *,
-		ext4_superblock_t *);
+    ext4_superblock_t *);
 extern void ext4_block_group_set_block_bitmap(ext4_block_group_t *,
-		ext4_superblock_t *, uint64_t);
+    ext4_superblock_t *, uint64_t);
 extern uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *,
-		ext4_superblock_t *);
+    ext4_superblock_t *);
 extern void ext4_block_group_set_inode_bitmap(ext4_block_group_t *,
-		ext4_superblock_t *, uint64_t);
+    ext4_superblock_t *, uint64_t);
 extern uint64_t ext4_block_group_get_inode_table_first_block(
-		ext4_block_group_t *, ext4_superblock_t *);
-extern void ext4_block_group_set_inode_table_first_block(
-		ext4_block_group_t *, ext4_superblock_t *, uint64_t);
+    ext4_block_group_t *, ext4_superblock_t *);
+extern void ext4_block_group_set_inode_table_first_block(ext4_block_group_t *,
+    ext4_superblock_t *, uint64_t);
 extern uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *,
-		ext4_superblock_t *);
+    ext4_superblock_t *);
 extern void ext4_block_group_set_free_blocks_count(ext4_block_group_t *,
-		ext4_superblock_t *, uint32_t);
+    ext4_superblock_t *, uint32_t);
 extern uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *,
-		ext4_superblock_t *);
+    ext4_superblock_t *);
 extern void ext4_block_group_set_free_inodes_count(ext4_block_group_t *,
-		ext4_superblock_t *, uint32_t);
+    ext4_superblock_t *, uint32_t);
 extern void ext4_block_group_set_free_inodes_count(ext4_block_group_t *,
-		ext4_superblock_t *, uint32_t);
+    ext4_superblock_t *, uint32_t);
 extern uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *,
-		ext4_superblock_t *);
+    ext4_superblock_t *);
 extern void ext4_block_group_set_used_dirs_count(ext4_block_group_t *,
-		ext4_superblock_t *, uint32_t);
+    ext4_superblock_t *, uint32_t);
 extern uint16_t ext4_block_group_get_flags(ext4_block_group_t *);
 extern void ext4_block_group_set_flags(ext4_block_group_t *, uint16_t);
 extern uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *,
-		ext4_superblock_t *);
+    ext4_superblock_t *);
 extern void ext4_block_group_set_itable_unused(ext4_block_group_t *,
-		ext4_superblock_t *, uint32_t);
+    ext4_superblock_t *, uint32_t);
 extern uint16_t ext4_block_group_get_checksum(ext4_block_group_t *);
 extern void ext4_block_group_set_checksum(ext4_block_group_t *, uint16_t);
Index: uspace/lib/ext4/libext4_crc.c
===================================================================
--- uspace/lib/ext4/libext4_crc.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_crc.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,9 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 /**
- * @file	libext4_crc.c
- * @brief	CRC checksumming implementation from Linux.
+ * @file  libext4_crc.c
+ * @brief CRC checksumming implementation from Linux.
  */
 
@@ -45,43 +45,45 @@
  */
 uint16_t const crc16_table[256] = {
-		0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
-		0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
-		0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
-		0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
-		0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
-		0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
-		0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
-		0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
-		0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
-		0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
-		0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
-		0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
-		0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
-		0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
-		0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
-		0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
-		0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
-		0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
-		0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
-		0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
-		0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
-		0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
-		0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
-		0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
-		0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
-		0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
-		0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
-		0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
-		0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
-		0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
-		0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
-		0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
+	0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
+	0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
+	0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
+	0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
+	0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
+	0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
+	0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
+	0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
+	0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
+	0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
+	0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
+	0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
+	0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
+	0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
+	0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
+	0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
+	0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
+	0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
+	0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
+	0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
+	0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
+	0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
+	0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
+	0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
+	0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
+	0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
+	0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
+	0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
+	0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
+	0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
+	0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
+	0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
 };
 
 /** Modify CRC value.
  *
- * @param crc	current CRC value
- * @param data	new byte of data to be "added" to CRC
- * @return		updated CRC value
+ * @param crc   Current CRC value
+ * @param data  New byte of data to be "added" to CRC
+ *
+ * @return Updated CRC value
+ *
  */
 static inline uint16_t crc16_byte(uint16_t crc, const uint8_t data)
@@ -92,19 +94,20 @@
 /** Compute the CRC-16 for the data buffer.
  *
- * @param crc		previous CRC value
- * @param buffer 	data pointer
- * @param len		number of bytes in the buffer
- * @return 			updated CRC value
+ * @param crc    Previous CRC value
+ * @param buffer Data pointer
+ * @param len    Number of bytes in the buffer
+ *
+ * @return Updated CRC value
+ *
  */
 uint16_t crc16(uint16_t crc, const uint8_t *buffer, size_t len)
 {
-		while (len--) {
-			crc = crc16_byte(crc, *buffer++);
-		}
-		return crc;
+	while (len--)
+		crc = crc16_byte(crc, *buffer++);
+	
+	return crc;
 }
-
 
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_crc.h
===================================================================
--- uspace/lib/ext4/libext4_crc.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_crc.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_CRC_H_
@@ -35,4 +35,5 @@
 
 extern uint16_t crc16(uint16_t, const uint8_t *, size_t);
+
 #endif
 
Index: uspace/lib/ext4/libext4_directory.c
===================================================================
--- uspace/lib/ext4/libext4_directory.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_directory.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_directory.c
- * @brief	Ext4 directory structure operations.
+ * @file  libext4_directory.c
+ * @brief Ext4 directory structure operations.
  */
 
@@ -39,12 +38,12 @@
 #include <errno.h>
 #include <malloc.h>
-#include <string.h>
 #include "libext4.h"
 
-
 /** Get i-node number from directory entry.
  *
- * @param de 	directory entry
- * @return		i-node number
+ * @param de Directory entry
+ *
+ * @return I-node number
+ *
  */
 uint32_t ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *de)
@@ -55,9 +54,10 @@
 /** Set i-node number to directory entry.
  *
- * @param de 	directory entry
- * @param inode	i-node number
+ * @param de    Directory entry
+ * @param inode I-node number
+ *
  */
 void ext4_directory_entry_ll_set_inode(ext4_directory_entry_ll_t *de,
-		uint32_t inode)
+    uint32_t inode)
 {
 	de->inode = host2uint32_t_le(inode);
@@ -66,9 +66,10 @@
 /** Get directory entry length.
  *
- * @param de 	directory entry
- * @return		entry length
- */
-uint16_t ext4_directory_entry_ll_get_entry_length(
-		ext4_directory_entry_ll_t *de)
+ * @param de Directory entry
+ *
+ * @return Entry length
+ *
+ */
+uint16_t ext4_directory_entry_ll_get_entry_length(ext4_directory_entry_ll_t *de)
 {
 	return uint16_t_le2host(de->entry_length);
@@ -77,10 +78,10 @@
 /** Set directory entry length.
  *
- * @param de 		directory entry
- * @param length	entry length
- */
-
+ * @param de     Directory entry
+ * @param length Entry length
+ *
+ */
 void ext4_directory_entry_ll_set_entry_length(ext4_directory_entry_ll_t *de,
-		uint16_t length)
+    uint16_t length)
 {
 	de->entry_length = host2uint16_t_le(length);
@@ -89,18 +90,18 @@
 /** Get directory entry name length.
  *
- * @param sb	superblock
- * @param de 	directory entry
- * @return		entry name length
- */
-uint16_t ext4_directory_entry_ll_get_name_length(
-    ext4_superblock_t *sb, ext4_directory_entry_ll_t *de)
-{
-	if (ext4_superblock_get_rev_level(sb) == 0 &&
-	    ext4_superblock_get_minor_rev_level(sb) < 5) {
-
+ * @param sb Superblock
+ * @param de Directory entry
+ *
+ * @return Entry name length
+ *
+ */
+uint16_t ext4_directory_entry_ll_get_name_length(ext4_superblock_t *sb,
+    ext4_directory_entry_ll_t *de)
+{
+	if ((ext4_superblock_get_rev_level(sb) == 0) &&
+	    (ext4_superblock_get_minor_rev_level(sb) < 5))
 		return ((uint16_t)de->name_length_high) << 8 |
-			    ((uint16_t)de->name_length);
-
-	}
+		    ((uint16_t)de->name_length);
+	
 	return de->name_length;
 
@@ -109,63 +110,58 @@
 /** Set directory entry name length.
  *
- * @param sb		superblock
- * @param de 		directory entry
- * @param length	entry name length
+ * @param sb     Superblock
+ * @param de     Directory entry
+ * @param length Entry name length
+ *
  */
 void ext4_directory_entry_ll_set_name_length(ext4_superblock_t *sb,
-		ext4_directory_entry_ll_t *de, uint16_t length)
+    ext4_directory_entry_ll_t *de, uint16_t length)
 {
 	de->name_length = (length << 8) >> 8;
-
-	if (ext4_superblock_get_rev_level(sb) == 0 &&
-		    ext4_superblock_get_minor_rev_level(sb) < 5) {
-
+	
+	if ((ext4_superblock_get_rev_level(sb) == 0) &&
+	    (ext4_superblock_get_minor_rev_level(sb) < 5))
 		de->name_length_high = length >> 8;
-	}
+	
+	/* Else do nothing */
 }
 
 /** Get i-node type of directory entry.
  *
- * @param sb	superblock
- * @param de 	directory entry
- * @return 		i-node type (file, dir, etc.)
- */
-uint8_t ext4_directory_entry_ll_get_inode_type(
-		ext4_superblock_t *sb, ext4_directory_entry_ll_t *de)
-{
-	if (ext4_superblock_get_rev_level(sb) > 0 ||
-		    ext4_superblock_get_minor_rev_level(sb) >= 5) {
-
-			return de->inode_type;
-	}
-
+ * @param sb Superblock
+ * @param de Directory entry
+ *
+ * @return I-node type (file, dir, etc.)
+ *
+ */
+uint8_t ext4_directory_entry_ll_get_inode_type(ext4_superblock_t *sb,
+    ext4_directory_entry_ll_t *de)
+{
+	if ((ext4_superblock_get_rev_level(sb) > 0) ||
+	    (ext4_superblock_get_minor_rev_level(sb) >= 5))
+		return de->inode_type;
+	
 	return EXT4_DIRECTORY_FILETYPE_UNKNOWN;
-
 }
 
 /** Set i-node type of directory entry.
  *
- * @param sb	superblock
- * @param de 	directory entry
- * @param type 	i-node type (file, dir, etc.)
- */
-void ext4_directory_entry_ll_set_inode_type(
-		ext4_superblock_t *sb, ext4_directory_entry_ll_t *de, uint8_t type)
-{
-	if (ext4_superblock_get_rev_level(sb) > 0 ||
-			ext4_superblock_get_minor_rev_level(sb) >= 5) {
-
+ * @param sb   Superblock
+ * @param de   Directory entry
+ * @param type I-node type (file, dir, etc.)
+ *
+ */
+void ext4_directory_entry_ll_set_inode_type(ext4_superblock_t *sb,
+    ext4_directory_entry_ll_t *de, uint8_t type)
+{
+	if ((ext4_superblock_get_rev_level(sb) > 0) ||
+	    (ext4_superblock_get_minor_rev_level(sb) >= 5))
 		de->inode_type = type;
-	}
-
-	/* else do nothing */
-
-}
-
-static int ext4_directory_iterator_seek(
-		ext4_directory_iterator_t *, aoff64_t);
-static int ext4_directory_iterator_set(
-		ext4_directory_iterator_t *, uint32_t);
-
+	
+	/* Else do nothing */
+}
+
+static int ext4_directory_iterator_seek(ext4_directory_iterator_t *, aoff64_t);
+static int ext4_directory_iterator_set(ext4_directory_iterator_t *, uint32_t);
 
 /** Initialize directory iterator.
@@ -173,11 +169,13 @@
  * Set position to the first valid entry from the required position.
  *
- * @param it			pointer to iterator to be initialized
- * @param inode_ref		directory i-node
- * @param pos			position to start reading entries from
- * @return				error code
+ * @param it        Pointer to iterator to be initialized
+ * @param inode_ref Directory i-node
+ * @param pos       Position to start reading entries from
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_iterator_init(ext4_directory_iterator_t *it,
-		ext4_inode_ref_t *inode_ref, aoff64_t pos)
+    ext4_inode_ref_t *inode_ref, aoff64_t pos)
 {
 	it->inode_ref = inode_ref;
@@ -185,5 +183,5 @@
 	it->current_offset = 0;
 	it->current_block = NULL;
-
+	
 	return ext4_directory_iterator_seek(it, pos);
 }
@@ -191,15 +189,15 @@
 /** Jump to the next valid entry
  *
- * @param it	initialized iterator
- * @return 		error code
+ * @param it Initialized iterator
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_iterator_next(ext4_directory_iterator_t *it)
 {
-	uint16_t skip;
-
 	assert(it->current != NULL);
-
-	skip = ext4_directory_entry_ll_get_entry_length(it->current);
-
+	
+	uint16_t skip = ext4_directory_entry_ll_get_entry_length(it->current);
+	
 	return ext4_directory_iterator_seek(it, it->current_offset + skip);
 }
@@ -209,59 +207,60 @@
  * Here can be jumped to the next data block.
  *
- * @param it	initialized iterator
- * @param pos	position of the next entry
- * @return		error code
+ * @param it  Initialized iterator
+ * @param pos Position of the next entry
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_iterator_seek(ext4_directory_iterator_t *it, aoff64_t pos)
 {
-	int rc;
-
-	uint64_t size = ext4_inode_get_size(
-			it->inode_ref->fs->superblock, it->inode_ref->inode);
-
+	uint64_t size = ext4_inode_get_size(it->inode_ref->fs->superblock,
+	    it->inode_ref->inode);
+	
 	/* The iterator is not valid until we seek to the desired position */
 	it->current = NULL;
-
+	
 	/* Are we at the end? */
 	if (pos >= size) {
 		if (it->current_block) {
-			rc = block_put(it->current_block);
+			int rc = block_put(it->current_block);
 			it->current_block = NULL;
-			if (rc != EOK) {
+			
+			if (rc != EOK)
 				return rc;
-			}
-		}
-
+		}
+		
 		it->current_offset = pos;
 		return EOK;
 	}
-
+	
 	/* Compute next block address */
-	uint32_t block_size = ext4_superblock_get_block_size(
-			it->inode_ref->fs->superblock);
+	uint32_t block_size =
+	    ext4_superblock_get_block_size(it->inode_ref->fs->superblock);
 	aoff64_t current_block_idx = it->current_offset / block_size;
 	aoff64_t next_block_idx = pos / block_size;
-
-	/* If we don't have a block or are moving accross block boundary,
+	
+	/*
+	 * If we don't have a block or are moving accross block boundary,
 	 * we need to get another block
 	 */
-	if (it->current_block == NULL || current_block_idx != next_block_idx) {
+	if ((it->current_block == NULL) ||
+	    (current_block_idx != next_block_idx)) {
 		if (it->current_block) {
-			rc = block_put(it->current_block);
+			int rc = block_put(it->current_block);
 			it->current_block = NULL;
-			if (rc != EOK) {
+			
+			if (rc != EOK)
 				return rc;
-			}
-		}
-
+		}
+		
 		uint32_t next_block_phys_idx;
-		rc = ext4_filesystem_get_inode_data_block_index(it->inode_ref,
-				next_block_idx, &next_block_phys_idx);
-		if (rc != EOK) {
+		int rc = ext4_filesystem_get_inode_data_block_index(it->inode_ref,
+		    next_block_idx, &next_block_phys_idx);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		rc = block_get(&it->current_block, it->inode_ref->fs->device,
-				next_block_phys_idx, BLOCK_FLAGS_NONE);
+		    next_block_phys_idx, BLOCK_FLAGS_NONE);
 		if (rc != EOK) {
 			it->current_block = NULL;
@@ -269,7 +268,7 @@
 		}
 	}
-
+	
 	it->current_offset = pos;
-
+	
 	return ext4_directory_iterator_set(it, block_size);
 }
@@ -277,40 +276,38 @@
 /** Do some checks before returning iterator.
  *
- * @param it			iterator to be checked
- * @param block_size 	size of data block
- * @return				error code
+ * @param it         Iterator to be checked
+ * @param block_size Size of data block
+ *
+ * @return Error code
+ *
  */
 static int ext4_directory_iterator_set(ext4_directory_iterator_t *it,
     uint32_t block_size)
 {
-
 	it->current = NULL;
-
+	
 	uint32_t offset_in_block = it->current_offset % block_size;
-
+	
 	/* Ensure proper alignment */
-	if ((offset_in_block % 4) != 0) {
+	if ((offset_in_block % 4) != 0)
 		return EIO;
-	}
-
+	
 	/* Ensure that the core of the entry does not overflow the block */
-	if (offset_in_block > block_size - 8) {
+	if (offset_in_block > block_size - 8)
 		return EIO;
-	}
-
-	ext4_directory_entry_ll_t *entry = it->current_block->data + offset_in_block;
-
+	
+	ext4_directory_entry_ll_t *entry =
+	    it->current_block->data + offset_in_block;
+	
 	/* Ensure that the whole entry does not overflow the block */
 	uint16_t length = ext4_directory_entry_ll_get_entry_length(entry);
-	if (offset_in_block + length > block_size) {
+	if (offset_in_block + length > block_size)
 		return EIO;
-	}
-
+	
 	/* Ensure the name length is not too large */
-	if (ext4_directory_entry_ll_get_name_length(it->inode_ref->fs->superblock,
-	    entry) > length-8) {
+	if (ext4_directory_entry_ll_get_name_length(
+	    it->inode_ref->fs->superblock, entry) > length-8)
 		return EIO;
-	}
-
+	
 	/* Everything OK - "publish" the entry */
 	it->current = entry;
@@ -318,234 +315,218 @@
 }
 
-
 /** Uninitialize directory iterator.
  *
  * Release all allocated structures.
  *
- * @param it	iterator to be finished
- * @return		error code
+ * @param it Iterator to be finished
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_iterator_fini(ext4_directory_iterator_t *it)
 {
-	int rc;
-
 	it->inode_ref = NULL;
 	it->current = NULL;
-
-	if (it->current_block) {
-		rc = block_put(it->current_block);
-		if (rc != EOK) {
-			return rc;
-		}
-	}
-
+	
+	if (it->current_block)
+		return block_put(it->current_block);
+	
 	return EOK;
 }
 
-/**	Write directory entry to concrete data block.
- *
- * @param sb		superblock
- * @param entry		pointer to entry to be written
- * @param entry_len	lenght of new entry
- * @param child		child i-node to be written to new entry
- * @param name		name of the new entry
- * @param name_len	length of entry name
+/** Write directory entry to concrete data block.
+ *
+ * @param sb        Superblock
+ * @param entry     Pointer to entry to be written
+ * @param entry_len Length of new entry
+ * @param child     Child i-node to be written to new entry
+ * @param name      Name of the new entry
+ * @param name_len  Length of entry name
+ *
  */
 void ext4_directory_write_entry(ext4_superblock_t *sb,
-		ext4_directory_entry_ll_t *entry, uint16_t entry_len,
-		ext4_inode_ref_t *child, const char *name, size_t name_len)
-{
-
+    ext4_directory_entry_ll_t *entry, uint16_t entry_len,
+    ext4_inode_ref_t *child, const char *name, size_t name_len)
+{
 	/* Check maximum entry length */
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	assert(entry_len <= block_size);
-
+	
 	/* Set basic attributes */
 	ext4_directory_entry_ll_set_inode(entry, child->index);
 	ext4_directory_entry_ll_set_entry_length(entry, entry_len);
 	ext4_directory_entry_ll_set_name_length(sb, entry, name_len);
-
+	
 	/* Write name */
 	memcpy(entry->name, name, name_len);
-
+	
 	/* Set type of entry */
-	if (ext4_inode_is_type(sb, child->inode, EXT4_INODE_MODE_DIRECTORY)) {
-		ext4_directory_entry_ll_set_inode_type(
-				sb, entry, EXT4_DIRECTORY_FILETYPE_DIR);
-	} else {
-		ext4_directory_entry_ll_set_inode_type(
-				sb, entry, EXT4_DIRECTORY_FILETYPE_REG_FILE);
-	}
-
+	if (ext4_inode_is_type(sb, child->inode, EXT4_INODE_MODE_DIRECTORY))
+		ext4_directory_entry_ll_set_inode_type(sb, entry,
+		    EXT4_DIRECTORY_FILETYPE_DIR);
+	else
+		ext4_directory_entry_ll_set_inode_type(sb, entry,
+		    EXT4_DIRECTORY_FILETYPE_REG_FILE);
 }
 
 /** Add new entry to the directory.
  *
- * @param parent	directory i-node
- * @param name		name of new entry
- * @param child		i-node to be referenced from new entry
- * @return			error code
- */
-int ext4_directory_add_entry(ext4_inode_ref_t * parent,
-		const char *name, ext4_inode_ref_t *child)
-{
-	int rc;
-
+ * @param parent Directory i-node
+ * @param name   Name of new entry
+ * @param child  I-node to be referenced from new entry
+ *
+ * @return Error code
+ *
+ */
+int ext4_directory_add_entry(ext4_inode_ref_t *parent, const char *name,
+    ext4_inode_ref_t *child)
+{
 	ext4_filesystem_t *fs = parent->fs;
-
+	
 	/* Index adding (if allowed) */
-	if (ext4_superblock_has_feature_compatible(fs->superblock, EXT4_FEATURE_COMPAT_DIR_INDEX) &&
-			ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX)) {
-
-		rc = ext4_directory_dx_add_entry(parent, child, name);
-
+	if ((ext4_superblock_has_feature_compatible(fs->superblock,
+	    EXT4_FEATURE_COMPAT_DIR_INDEX)) &&
+	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
+		int rc = ext4_directory_dx_add_entry(parent, child, name);
+		
 		/* Check if index is not corrupted */
 		if (rc != EXT4_ERR_BAD_DX_DIR) {
-
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
+			
 			return EOK;
 		}
-
+		
 		/* Needed to clear dir index flag if corrupted */
 		ext4_inode_clear_flag(parent->inode, EXT4_INODE_FLAG_INDEX);
 		parent->dirty = true;
 	}
-
+	
 	/* Linear algorithm */
-
-	uint32_t iblock = 0, fblock = 0;
+	
+	uint32_t iblock = 0;
+	uint32_t fblock = 0;
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
 	uint32_t inode_size = ext4_inode_get_size(fs->superblock, parent->inode);
 	uint32_t total_blocks = inode_size / block_size;
-
-	uint32_t name_len = strlen(name);
-
+	
+	uint32_t name_len = str_size(name);
+	
 	/* Find block, where is space for new entry and try to add */
 	bool success = false;
 	for (iblock = 0; iblock < total_blocks; ++iblock) {
-
-		rc = ext4_filesystem_get_inode_data_block_index(parent, iblock, &fblock);
-		if (rc != EOK) {
+		int rc = ext4_filesystem_get_inode_data_block_index(parent,
+		    iblock, &fblock);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		block_t *block;
 		rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		/* If adding is successful, function can finish */
-		rc = ext4_directory_try_insert_entry(fs->superblock, block, child, name, name_len);
-		if (rc == EOK) {
+		rc = ext4_directory_try_insert_entry(fs->superblock, block,
+		    child, name, name_len);
+		if (rc == EOK)
 			success = true;
-		}
-
+		
 		rc = block_put(block);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
-
-		if (success) {
+		
+		if (success)
 			return EOK;
-		}
-	}
-
+	}
+	
 	/* No free block found - needed to allocate next data block */
-
+	
 	iblock = 0;
 	fblock = 0;
-	rc = ext4_filesystem_append_inode_block(parent, &fblock, &iblock);
-	if (rc != EOK) {
+	int rc = ext4_filesystem_append_inode_block(parent, &fblock, &iblock);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Load new block */
 	block_t *new_block;
 	rc = block_get(&new_block, fs->device, fblock, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK) {
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Fill block with zeroes */
 	memset(new_block->data, 0, block_size);
 	ext4_directory_entry_ll_t *block_entry = new_block->data;
-	ext4_directory_write_entry(fs->superblock, block_entry, block_size, child, name, name_len);
-
+	ext4_directory_write_entry(fs->superblock, block_entry, block_size,
+	    child, name, name_len);
+	
 	/* Save new block */
 	new_block->dirty = true;
 	rc = block_put(new_block);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	
+	return rc;
 }
 
 /** Find directory entry with passed name.
  *
- * @param result	result structure to be returned if entry found
- * @param parent	directory i-node
- * @param name		name of entry to be found
- * @return 			error code
+ * @param result Result structure to be returned if entry found
+ * @param parent Directory i-node
+ * @param name   Name of entry to be found
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_find_entry(ext4_directory_search_result_t *result,
-		ext4_inode_ref_t *parent, const char *name)
-{
-	int rc;
-	uint32_t name_len = strlen(name);
-
+    ext4_inode_ref_t *parent, const char *name)
+{
+	uint32_t name_len = str_size(name);
+	
 	ext4_superblock_t *sb = parent->fs->superblock;
-
+	
 	/* Index search */
-	if (ext4_superblock_has_feature_compatible(sb, EXT4_FEATURE_COMPAT_DIR_INDEX) &&
-			ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX)) {
-
-		rc = ext4_directory_dx_find_entry(result, parent, name_len, name);
-
+	if ((ext4_superblock_has_feature_compatible(sb,
+	    EXT4_FEATURE_COMPAT_DIR_INDEX)) &&
+	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
+		int rc = ext4_directory_dx_find_entry(result, parent, name_len,
+		    name);
+		
 		/* Check if index is not corrupted */
 		if (rc != EXT4_ERR_BAD_DX_DIR) {
-
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
+			
 			return EOK;
 		}
-
+		
 		/* Needed to clear dir index flag if corrupted */
 		ext4_inode_clear_flag(parent->inode, EXT4_INODE_FLAG_INDEX);
 		parent->dirty = true;
-
-	}
-
+	}
+	
 	/* Linear algorithm */
-
-	uint32_t iblock, fblock;
+	
+	uint32_t iblock;
+	uint32_t fblock;
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	uint32_t inode_size = ext4_inode_get_size(sb, parent->inode);
 	uint32_t total_blocks = inode_size / block_size;
-
+	
 	/* Walk through all data blocks */
 	for (iblock = 0; iblock < total_blocks; ++iblock) {
-
 		/* Load block address */
-		rc = ext4_filesystem_get_inode_data_block_index(parent, iblock, &fblock);
-		if (rc != EOK) {
+		int rc = ext4_filesystem_get_inode_data_block_index(parent, iblock,
+		    &fblock);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		/* Load data block */
 		block_t *block;
 		rc = block_get(&block, parent->fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		/* Try to find entry in block */
 		ext4_directory_entry_ll_t *res_entry;
-		rc = ext4_directory_find_in_block(block, sb, name_len, name, &res_entry);
+		rc = ext4_directory_find_in_block(block, sb, name_len, name,
+		    &res_entry);
 		if (rc == EOK) {
 			result->block = block;
@@ -553,83 +534,79 @@
 			return EOK;
 		}
-
+		
 		/* Entry not found - put block and continue to the next block */
-
+		
 		rc = block_put(block);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
-	}
-
+	}
+	
 	/* Entry was not found */
-
+	
 	result->block = NULL;
 	result->dentry =  NULL;
-
+	
 	return ENOENT;
 }
 
-
 /** Remove directory entry.
  *
- * @param parent	directory i-node
- * @param name		name of the entry to be removed
- * @return			error code
+ * @param parent Directory i-node
+ * @param name   Name of the entry to be removed
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_remove_entry(ext4_inode_ref_t *parent, const char *name)
 {
-	int rc;
-
 	/* Check if removing from directory */
 	if (!ext4_inode_is_type(parent->fs->superblock, parent->inode,
-	    EXT4_INODE_MODE_DIRECTORY)) {
+	    EXT4_INODE_MODE_DIRECTORY))
 		return ENOTDIR;
-	}
-
+	
 	/* Try to find entry */
 	ext4_directory_search_result_t result;
-	rc  = ext4_directory_find_entry(&result, parent, name);
-	if (rc != EOK) {
+	int rc = ext4_directory_find_entry(&result, parent, name);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Invalidate entry */
 	ext4_directory_entry_ll_set_inode(result.dentry, 0);
-
+	
 	/* Store entry position in block */
-	uint32_t pos = (void *)result.dentry - result.block->data;
-
-	/* If entry is not the first in block, it must be merged
+	uint32_t pos = (void *) result.dentry - result.block->data;
+	
+	/*
+	 * If entry is not the first in block, it must be merged
 	 * with previous entry
 	 */
 	if (pos != 0) {
-
 		uint32_t offset = 0;
-
+		
 		/* Start from the first entry in block */
 		ext4_directory_entry_ll_t *tmp_dentry = result.block->data;
 		uint16_t tmp_dentry_length =
-				ext4_directory_entry_ll_get_entry_length(tmp_dentry);
-
+		    ext4_directory_entry_ll_get_entry_length(tmp_dentry);
+		
 		/* Find direct predecessor of removed entry */
 		while ((offset + tmp_dentry_length) < pos) {
-			offset += ext4_directory_entry_ll_get_entry_length(tmp_dentry);
+			offset +=
+			    ext4_directory_entry_ll_get_entry_length(tmp_dentry);
 			tmp_dentry = result.block->data + offset;
 			tmp_dentry_length =
-					ext4_directory_entry_ll_get_entry_length(tmp_dentry);
-		}
-
+			    ext4_directory_entry_ll_get_entry_length(tmp_dentry);
+		}
+		
 		assert(tmp_dentry_length + offset == pos);
-
+		
 		/* Add to removed entry length to predecessor's length */
 		uint16_t del_entry_length =
-				ext4_directory_entry_ll_get_entry_length(result.dentry);
+		    ext4_directory_entry_ll_get_entry_length(result.dentry);
 		ext4_directory_entry_ll_set_entry_length(tmp_dentry,
-				tmp_dentry_length + del_entry_length);
-
-	}
-
+		    tmp_dentry_length + del_entry_length);
+	}
+	
 	result.block->dirty = true;
-
+	
 	return ext4_directory_destroy_result(&result);
 }
@@ -637,110 +614,115 @@
 /** Try to insert entry to concrete data block.
  *
- * @param sb			superblock
- * @param target_block	block to try to insert entry to
- * @param child			child i-node to be inserted by new entry
- * @param name			name of the new entry
- * @param name_len		length of the new entry name
- * @return				error code
+ * @param sb           Superblock
+ * @param target_block Block to try to insert entry to
+ * @param child        Child i-node to be inserted by new entry
+ * @param name         Name of the new entry
+ * @param name_len     Length of the new entry name
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_try_insert_entry(ext4_superblock_t *sb,
-		block_t *target_block, ext4_inode_ref_t *child,
-		const char *name, uint32_t name_len)
+    block_t *target_block, ext4_inode_ref_t *child, const char *name,
+    uint32_t name_len)
 {
 	/* Compute required length entry and align it to 4 bytes */
-   	uint32_t block_size = ext4_superblock_get_block_size(sb);
-   	uint16_t required_len = sizeof(ext4_fake_directory_entry_t) + name_len;
-   	if ((required_len % 4) != 0) {
-   		required_len += 4 - (required_len % 4);
-   	}
-
-   	/* Initialize pointers, stop means to upper bound */
-   	ext4_directory_entry_ll_t *dentry = target_block->data;
-   	ext4_directory_entry_ll_t *stop = target_block->data + block_size;
-
-   	/* Walk through the block and check for invalid entries
-   	 * or entries with free space for new entry
-   	 */
-   	while (dentry < stop) {
-
-   		uint32_t inode = ext4_directory_entry_ll_get_inode(dentry);
-   		uint16_t rec_len = ext4_directory_entry_ll_get_entry_length(dentry);
-
-   		/* If invalid and large enough entry, use it */
-   		if ((inode == 0) && (rec_len >= required_len)) {
-   			ext4_directory_write_entry(sb, dentry, rec_len, child, name, name_len);
-   			target_block->dirty = true;
-   			return EOK;
-   		}
-
-   		/* Valid entry, try to split it */
-   		if (inode != 0) {
-   			uint16_t used_name_len =
-   					ext4_directory_entry_ll_get_name_length(sb, dentry);
-
-   			uint16_t used_space =
-   					sizeof(ext4_fake_directory_entry_t) + used_name_len;
-   			if ((used_name_len % 4) != 0) {
-   				used_space += 4 - (used_name_len % 4);
-   			}
-   			uint16_t free_space = rec_len - used_space;
-
-   			/* There is free space for new entry */
-   			if (free_space >= required_len) {
-
-   				/* Cut tail of current entry */
-   				ext4_directory_entry_ll_set_entry_length(dentry, used_space);
-   				ext4_directory_entry_ll_t *new_entry =
-   						(void *)dentry + used_space;
-   				ext4_directory_write_entry(sb, new_entry,
-   						free_space, child, name, name_len);
-
-   				target_block->dirty = true;
+	uint32_t block_size = ext4_superblock_get_block_size(sb);
+	uint16_t required_len = sizeof(ext4_fake_directory_entry_t) + name_len;
+	
+	if ((required_len % 4) != 0)
+		required_len += 4 - (required_len % 4);
+	
+	/* Initialize pointers, stop means to upper bound */
+	ext4_directory_entry_ll_t *dentry = target_block->data;
+	ext4_directory_entry_ll_t *stop = target_block->data + block_size;
+	
+	/*
+	 * Walk through the block and check for invalid entries
+	 * or entries with free space for new entry
+	 */
+	while (dentry < stop) {
+		uint32_t inode = ext4_directory_entry_ll_get_inode(dentry);
+		uint16_t rec_len = ext4_directory_entry_ll_get_entry_length(dentry);
+		
+		/* If invalid and large enough entry, use it */
+		if ((inode == 0) && (rec_len >= required_len)) {
+			ext4_directory_write_entry(sb, dentry, rec_len, child,
+			    name, name_len);
+			target_block->dirty = true;
+			
+			return EOK;
+		}
+		
+		/* Valid entry, try to split it */
+		if (inode != 0) {
+			uint16_t used_name_len =
+			    ext4_directory_entry_ll_get_name_length(sb, dentry);
+			
+			uint16_t used_space =
+			    sizeof(ext4_fake_directory_entry_t) + used_name_len;
+			
+			if ((used_name_len % 4) != 0)
+				used_space += 4 - (used_name_len % 4);
+			
+			uint16_t free_space = rec_len - used_space;
+			
+			/* There is free space for new entry */
+			if (free_space >= required_len) {
+				/* Cut tail of current entry */
+				ext4_directory_entry_ll_set_entry_length(dentry, used_space);
+				ext4_directory_entry_ll_t *new_entry =
+				    (void *) dentry + used_space;
+				ext4_directory_write_entry(sb, new_entry,
+				    free_space, child, name, name_len);
+				
+				target_block->dirty = true;
+				
 				return EOK;
-   			}
-   		}
-
-   		/* Jump to the next entry */
-   		dentry = (void *)dentry + rec_len;
-   	}
-
-   	/* No free space found for new entry */
-
-   	return ENOSPC;
+			}
+		}
+		
+		/* Jump to the next entry */
+		dentry = (void *) dentry + rec_len;
+	}
+	
+	/* No free space found for new entry */
+	return ENOSPC;
 }
 
 /** Try to find entry in block by name.
  *
- * @param block		block containing entries
- * @param sb		superblock
- * @param name_len	length of entry name
- * @param name		name of entry to be found
- * @param res_entry	output pointer to found entry, NULL if not found
- * @return			error code
- */
-int ext4_directory_find_in_block(block_t *block,
-		ext4_superblock_t *sb, size_t name_len, const char *name,
-		ext4_directory_entry_ll_t **res_entry)
+ * @param block     Block containing entries
+ * @param sb        Superblock
+ * @param name_len  Length of entry name
+ * @param name      Name of entry to be found
+ * @param res_entry Output pointer to found entry, NULL if not found
+ *
+ * @return Error code
+ *
+ */
+int ext4_directory_find_in_block(block_t *block, ext4_superblock_t *sb,
+    size_t name_len, const char *name, ext4_directory_entry_ll_t **res_entry)
 {
 	/* Start from the first entry in block */
-	ext4_directory_entry_ll_t *dentry = (ext4_directory_entry_ll_t *)block->data;
-	/*Set upper bound for cycling */
+	ext4_directory_entry_ll_t *dentry =
+	    (ext4_directory_entry_ll_t *) block->data;
+	
+	/* Set upper bound for cycling */
 	uint8_t *addr_limit = block->data + ext4_superblock_get_block_size(sb);
-
+	
 	/* Walk through the block and check entries */
-	while ((uint8_t *)dentry < addr_limit) {
-
+	while ((uint8_t *) dentry < addr_limit) {
 		/* Termination condition */
-		if ((uint8_t*) dentry + name_len > addr_limit) {
+		if ((uint8_t *) dentry + name_len > addr_limit)
 			break;
-		}
-
+		
 		/* Valid entry - check it */
 		if (dentry->inode != 0) {
-
 			/* For more effectivity compare firstly only lengths */
-			if (name_len == ext4_directory_entry_ll_get_name_length(sb, dentry)) {
+			if (ext4_directory_entry_ll_get_name_length(sb, dentry) ==
+			    name_len) {
 				/* Compare names */
-				if (bcmp((uint8_t *)name, dentry->name, name_len) == 0) {
+				if (bcmp((uint8_t *) name, dentry->name, name_len) == 0) {
 					*res_entry = dentry;
 					return EOK;
@@ -748,16 +730,16 @@
 			}
 		}
-
-		uint16_t dentry_len = ext4_directory_entry_ll_get_entry_length(dentry);
-
+		
+		uint16_t dentry_len =
+		    ext4_directory_entry_ll_get_entry_length(dentry);
+		
 		/* Corrupted entry */
-		if (dentry_len == 0) {
+		if (dentry_len == 0)
 			return EINVAL;
-		}
-
+		
 		/* Jump to next entry */
-		dentry = (ext4_directory_entry_ll_t *)((uint8_t *)dentry + dentry_len);
-	}
-
+		dentry = (ext4_directory_entry_ll_t *) ((uint8_t *) dentry + dentry_len);
+	}
+	
 	/* Entry not found */
 	return ENOENT;
@@ -766,13 +748,14 @@
 /** Simple function to release allocated data from result.
  *
- * @param result	search result to destroy
- * @return			error code
+ * @param result Search result to destroy
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_destroy_result(ext4_directory_search_result_t *result)
 {
-	if (result->block) {
+	if (result->block)
 		return block_put(result->block);
-	}
-
+	
 	return EOK;
 }
Index: uspace/lib/ext4/libext4_directory.h
===================================================================
--- uspace/lib/ext4/libext4_directory.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_directory.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_DIRECTORY_H_
@@ -36,42 +36,42 @@
 #include "libext4_types.h"
 
-extern uint32_t	ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *);
+extern uint32_t ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *);
 extern void ext4_directory_entry_ll_set_inode(ext4_directory_entry_ll_t *,
-		uint32_t);
-extern uint16_t	ext4_directory_entry_ll_get_entry_length(
+    uint32_t);
+extern uint16_t ext4_directory_entry_ll_get_entry_length(
     ext4_directory_entry_ll_t *);
-extern void ext4_directory_entry_ll_set_entry_length(
-		ext4_directory_entry_ll_t *, uint16_t);
-extern uint16_t	ext4_directory_entry_ll_get_name_length(
-    ext4_superblock_t *, ext4_directory_entry_ll_t *);
+extern void ext4_directory_entry_ll_set_entry_length(ext4_directory_entry_ll_t *,
+    uint16_t);
+extern uint16_t ext4_directory_entry_ll_get_name_length(ext4_superblock_t *,
+    ext4_directory_entry_ll_t *);
 extern void ext4_directory_entry_ll_set_name_length(ext4_superblock_t *,
-		ext4_directory_entry_ll_t *, uint16_t);
+    ext4_directory_entry_ll_t *, uint16_t);
 extern uint8_t ext4_directory_entry_ll_get_inode_type(ext4_superblock_t *,
-		ext4_directory_entry_ll_t *);
+    ext4_directory_entry_ll_t *);
 extern void ext4_directory_entry_ll_set_inode_type(ext4_superblock_t *,
-		ext4_directory_entry_ll_t *, uint8_t);
+    ext4_directory_entry_ll_t *, uint8_t);
 
 extern int ext4_directory_iterator_init(ext4_directory_iterator_t *,
-		ext4_inode_ref_t *, aoff64_t);
+    ext4_inode_ref_t *, aoff64_t);
 extern int ext4_directory_iterator_next(ext4_directory_iterator_t *);
 extern int ext4_directory_iterator_fini(ext4_directory_iterator_t *);
 
 extern void ext4_directory_write_entry(ext4_superblock_t *,
-		ext4_directory_entry_ll_t *, uint16_t, ext4_inode_ref_t *,
-		const char *, size_t);
-extern int ext4_directory_add_entry(ext4_inode_ref_t *,
-		const char *, ext4_inode_ref_t *);
+    ext4_directory_entry_ll_t *, uint16_t, ext4_inode_ref_t *,
+    const char *, size_t);
+extern int ext4_directory_add_entry(ext4_inode_ref_t *, const char *,
+    ext4_inode_ref_t *);
 extern int ext4_directory_find_entry(ext4_directory_search_result_t *,
-		ext4_inode_ref_t *, const char *);
+    ext4_inode_ref_t *, const char *);
 extern int ext4_directory_remove_entry(ext4_inode_ref_t *, const char *);
 
-extern int ext4_directory_try_insert_entry(ext4_superblock_t *,
-		block_t *, ext4_inode_ref_t *, const char *, uint32_t);
+extern int ext4_directory_try_insert_entry(ext4_superblock_t *, block_t *,
+    ext4_inode_ref_t *, const char *, uint32_t);
 
-extern int ext4_directory_find_in_block(block_t *,
-		ext4_superblock_t *, size_t, const char *,
-		ext4_directory_entry_ll_t **);
+extern int ext4_directory_find_in_block(block_t *, ext4_superblock_t *, size_t,
+    const char *, ext4_directory_entry_ll_t **);
 
 extern int ext4_directory_destroy_result(ext4_directory_search_result_t *);
+
 #endif
 
Index: uspace/lib/ext4/libext4_directory_index.c
===================================================================
--- uspace/lib/ext4/libext4_directory_index.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_directory_index.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_directory_index.c
- * @brief	Ext4 directory index operations.
+ * @file  libext4_directory_index.c
+ * @brief Ext4 directory index operations.
  */
 
@@ -40,5 +39,4 @@
 #include <malloc.h>
 #include <sort.h>
-#include <string.h>
 #include "libext4.h"
 
@@ -52,12 +50,13 @@
 } ext4_dx_sort_entry_t;
 
-
 /** Get hash version used in directory index.
  *
- * @param root_info	pointer to root info structure of index
- * @return 			hash algorithm version
+ * @param root_info Pointer to root info structure of index
+ *
+ * @return Hash algorithm version
+ *
  */
 uint8_t ext4_directory_dx_root_info_get_hash_version(
-		ext4_directory_dx_root_info_t *root_info)
+    ext4_directory_dx_root_info_t *root_info)
 {
 	return root_info->hash_version;
@@ -66,9 +65,10 @@
 /** Set hash version, that will be used in directory index.
  *
- * @param root_info		pointer to root info structure of index
- * @param version 	 	hash algorithm version
+ * @param root_info Pointer to root info structure of index
+ * @param version   Hash algorithm version
+ *
  */
 void ext4_directory_dx_root_info_set_hash_version(
-		ext4_directory_dx_root_info_t *root_info, uint8_t version)
+    ext4_directory_dx_root_info_t *root_info, uint8_t version)
 {
 	root_info->hash_version = version;
@@ -77,9 +77,11 @@
 /** Get length of root_info structure in bytes.
  *
- * @param root_info	pointer to root info structure of index
- * @return 			length of the structure
+ * @param root_info Pointer to root info structure of index
+ *
+ * @return Length of the structure
+ *
  */
 uint8_t ext4_directory_dx_root_info_get_info_length(
-		ext4_directory_dx_root_info_t *root_info)
+    ext4_directory_dx_root_info_t *root_info)
 {
 	return root_info->info_length;
@@ -88,9 +90,10 @@
 /** Set length of root_info structure in bytes.
  *
- * @param root_info		pointer to root info structure of index
- * @param info_length	length of the structure
+ * @param root_info   Pointer to root info structure of index
+ * @param info_length Length of the structure
+ *
  */
 void ext4_directory_dx_root_info_set_info_length(
-		ext4_directory_dx_root_info_t *root_info, uint8_t info_length)
+    ext4_directory_dx_root_info_t *root_info, uint8_t info_length)
 {
 	root_info->info_length = info_length;
@@ -99,9 +102,11 @@
 /** Get number of indirect levels of HTree.
  *
- * @param root_info	pointer to root info structure of index
- * @return 			height of HTree (actually only 0 or 1)
+ * @param root_info Pointer to root info structure of index
+ *
+ * @return Height of HTree (actually only 0 or 1)
+ *
  */
 uint8_t ext4_directory_dx_root_info_get_indirect_levels(
-		ext4_directory_dx_root_info_t *root_info)
+    ext4_directory_dx_root_info_t *root_info)
 {
 	return root_info->indirect_levels;
@@ -110,9 +115,10 @@
 /** Set number of indirect levels of HTree.
  *
- * @param root_info	pointer to root info structure of index
- * @param levels	height of HTree (actually only 0 or 1)
+ * @param root_info Pointer to root info structure of index
+ * @param levels    Height of HTree (actually only 0 or 1)
+ *
  */
 void ext4_directory_dx_root_info_set_indirect_levels(
-		ext4_directory_dx_root_info_t *root_info, uint8_t levels)
+    ext4_directory_dx_root_info_t *root_info, uint8_t levels)
 {
 	root_info->indirect_levels = levels;
@@ -121,9 +127,11 @@
 /** Get maximum number of index node entries.
  *
- * @param countlimit	pointer to counlimit structure
- * @return			 	maximum of entries in node
+ * @param countlimit Pointer to counlimit structure
+ *
+ * @return Maximum of entries in node
+ *
  */
 uint16_t ext4_directory_dx_countlimit_get_limit(
-		ext4_directory_dx_countlimit_t *countlimit)
+    ext4_directory_dx_countlimit_t *countlimit)
 {
 	return uint16_t_le2host(countlimit->limit);
@@ -132,9 +140,10 @@
 /** Set maximum number of index node entries.
  *
- * @param countlimit	pointer to counlimit structure
- * @param limit			maximum of entries in node
+ * @param countlimit Pointer to counlimit structure
+ * @param limit      Maximum of entries in node
+ *
  */
 void ext4_directory_dx_countlimit_set_limit(
-		ext4_directory_dx_countlimit_t *countlimit, uint16_t limit)
+    ext4_directory_dx_countlimit_t *countlimit, uint16_t limit)
 {
 	countlimit->limit = host2uint16_t_le(limit);
@@ -143,9 +152,11 @@
 /** Get current number of index node entries.
  *
- * @param countlimit	pointer to counlimit structure
- * @return			 	number of entries in node
+ * @param countlimit Pointer to counlimit structure
+ *
+ * @return Number of entries in node
+ *
  */
 uint16_t ext4_directory_dx_countlimit_get_count(
-		ext4_directory_dx_countlimit_t *countlimit)
+    ext4_directory_dx_countlimit_t *countlimit)
 {
 	return uint16_t_le2host(countlimit->count);
@@ -154,9 +165,10 @@
 /** Set current number of index node entries.
  *
- * @param countlimit	pointer to counlimit structure
- * @param count		 	number of entries in node
+ * @param countlimit Pointer to counlimit structure
+ * @param count      Number of entries in node
+ *
  */
 void ext4_directory_dx_countlimit_set_count(
-		ext4_directory_dx_countlimit_t *countlimit, uint16_t count)
+    ext4_directory_dx_countlimit_t *countlimit, uint16_t count)
 {
 	countlimit->count = host2uint16_t_le(count);
@@ -165,6 +177,8 @@
 /** Get hash value of index entry.
  *
- * @param entry		pointer to index entry
- * @return          hash value
+ * @param entry Pointer to index entry
+ *
+ * @return Hash value
+ *
  */
 uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *entry)
@@ -173,12 +187,12 @@
 }
 
-
 /** Set hash value of index entry.
  *
- * @param entry		pointer to index entry
- * @param hash		hash value
+ * @param entry Pointer to index entry
+ * @param hash  Hash value
+ *
  */
 void ext4_directory_dx_entry_set_hash(ext4_directory_dx_entry_t *entry,
-		uint32_t hash)
+    uint32_t hash)
 {
 	entry->hash = host2uint32_t_le(hash);
@@ -187,6 +201,8 @@
 /** Get block address where child node is located.
  *
- * @param entry		pointer to index entry
- * @return          block address of child node
+ * @param entry Pointer to index entry
+ *
+ * @return Block address of child node
+ *
  */
 uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *entry)
@@ -197,61 +213,60 @@
 /** Set block address where child node is located.
  *
- * @param entry		pointer to index entry
- * @param block		block address of child node
+ * @param entry Pointer to index entry
+ * @param block Block address of child node
+ *
  */
 void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *entry,
-		uint32_t block)
+    uint32_t block)
 {
 	entry->block = host2uint32_t_le(block);
 }
 
-
-/**************************************************************************/
-
 /** Initialize index structure of new directory.
  *
- * @param dir	pointer to directory i-node
- * @return 		error code
+ * @param dir Pointer to directory i-node
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_dx_init(ext4_inode_ref_t *dir)
 {
-	int rc;
-
 	/* Load block 0, where will be index root located */
 	uint32_t fblock;
-	rc = ext4_filesystem_get_inode_data_block_index(dir, 0, &fblock);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_inode_data_block_index(dir, 0,
+	    &fblock);
+	if (rc != EOK)
+		return rc;
+	
 	block_t *block;
 	rc = block_get(&block, dir->fs->device, fblock, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Initialize pointers to data structures */
 	ext4_directory_dx_root_t *root = block->data;
 	ext4_directory_dx_root_info_t *info = &(root->info);
-
+	
 	/* Initialize root info structure */
 	uint8_t hash_version =
-			ext4_superblock_get_default_hash_version(dir->fs->superblock);
-
+	    ext4_superblock_get_default_hash_version(dir->fs->superblock);
+	
 	ext4_directory_dx_root_info_set_hash_version(info, hash_version);
 	ext4_directory_dx_root_info_set_indirect_levels(info, 0);
 	ext4_directory_dx_root_info_set_info_length(info, 8);
-
+	
 	/* Set limit and current number of entries */
 	ext4_directory_dx_countlimit_t *countlimit =
-			(ext4_directory_dx_countlimit_t *)&root->entries;
+	    (ext4_directory_dx_countlimit_t *) &root->entries;
 	ext4_directory_dx_countlimit_set_count(countlimit, 1);
-
-	uint32_t block_size = ext4_superblock_get_block_size(dir->fs->superblock);
-	uint32_t entry_space = block_size - 2 * sizeof(ext4_directory_dx_dot_entry_t)
-		- sizeof(ext4_directory_dx_root_info_t);
+	
+	uint32_t block_size =
+	    ext4_superblock_get_block_size(dir->fs->superblock);
+	uint32_t entry_space =
+	    block_size - 2 * sizeof(ext4_directory_dx_dot_entry_t) -
+	    sizeof(ext4_directory_dx_root_info_t);
 	uint16_t root_limit = entry_space / sizeof(ext4_directory_dx_entry_t);
 	ext4_directory_dx_countlimit_set_limit(countlimit, root_limit);
-
+	
 	/* Append new block, where will be new entries inserted in the future */
 	uint32_t iblock;
@@ -261,5 +276,5 @@
 		return rc;
 	}
-
+	
 	block_t *new_block;
 	rc = block_get(&new_block, dir->fs->device, fblock, BLOCK_FLAGS_NOREAD);
@@ -268,10 +283,10 @@
 		return rc;
 	}
-
+	
 	/* Fill the whole block with empty entry */
 	ext4_directory_entry_ll_t *block_entry = new_block->data;
 	ext4_directory_entry_ll_set_entry_length(block_entry, block_size);
 	ext4_directory_entry_ll_set_inode(block_entry, 0);
-
+	
 	new_block->dirty = true;
 	rc = block_put(new_block);
@@ -280,50 +295,45 @@
 		return rc;
 	}
-
+	
 	/* Connect new block to the only entry in index */
 	ext4_directory_dx_entry_t *entry = root->entries;
 	ext4_directory_dx_entry_set_block(entry, iblock);
-
+	
 	block->dirty = true;
-
-	rc = block_put(block);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	
+	return block_put(block);
 }
 
 /** Initialize hash info structure necessary for index operations.
  *
- * @param hinfo			pointer to hinfo to be initialized
- * @param root_block	root block (number 0) of index
- * @param sb			pointer to superblock
- * @param name_len		length of name to be computed hash value from
- * @param name			name to be computed hash value from
- * @return				error code
- */
-static int ext4_directory_hinfo_init(ext4_hash_info_t *hinfo, block_t *root_block,
-		ext4_superblock_t *sb, size_t name_len, const char *name)
-{
-
-	ext4_directory_dx_root_t *root = (ext4_directory_dx_root_t *)root_block->data;
-
-	if (root->info.hash_version != EXT4_HASH_VERSION_TEA &&
-			root->info.hash_version != EXT4_HASH_VERSION_HALF_MD4 &&
-			root->info.hash_version != EXT4_HASH_VERSION_LEGACY) {
+ * @param hinfo      Pointer to hinfo to be initialized
+ * @param root_block Root block (number 0) of index
+ * @param sb         Pointer to superblock
+ * @param name_len   Length of name to be computed hash value from
+ * @param name       Name to be computed hash value from
+ *
+ * @return Error code
+ *
+ */
+static int ext4_directory_hinfo_init(ext4_hash_info_t *hinfo,
+    block_t *root_block, ext4_superblock_t *sb, size_t name_len,
+    const char *name)
+{
+	ext4_directory_dx_root_t *root =
+	    (ext4_directory_dx_root_t *) root_block->data;
+	
+	if ((root->info.hash_version != EXT4_HASH_VERSION_TEA) &&
+	    (root->info.hash_version != EXT4_HASH_VERSION_HALF_MD4) &&
+	    (root->info.hash_version != EXT4_HASH_VERSION_LEGACY))
 		return EXT4_ERR_BAD_DX_DIR;
-	}
-
+	
 	/* Check unused flags */
-	if (root->info.unused_flags != 0) {
+	if (root->info.unused_flags != 0)
 		return EXT4_ERR_BAD_DX_DIR;
-	}
-
+	
 	/* Check indirect levels */
-	if (root->info.indirect_levels > 1) {
+	if (root->info.indirect_levels > 1)
 		return EXT4_ERR_BAD_DX_DIR;
-	}
-
+	
 	/* Check if node limit is correct */
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
@@ -331,27 +341,27 @@
 	entry_space -= 2 * sizeof(ext4_directory_dx_dot_entry_t);
 	entry_space -= sizeof(ext4_directory_dx_root_info_t);
-    entry_space = entry_space / sizeof(ext4_directory_dx_entry_t);
-
-    uint16_t limit = ext4_directory_dx_countlimit_get_limit((ext4_directory_dx_countlimit_t *)&root->entries);
-    if (limit != entry_space) {
-    	return EXT4_ERR_BAD_DX_DIR;
-	}
-
-    /* Check hash version and modify if necessary */
-	hinfo->hash_version = ext4_directory_dx_root_info_get_hash_version(&root->info);
-	if ((hinfo->hash_version <= EXT4_HASH_VERSION_TEA)
-			&& (ext4_superblock_has_flag(sb, EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH))) {
+	entry_space = entry_space / sizeof(ext4_directory_dx_entry_t);
+	
+	uint16_t limit = ext4_directory_dx_countlimit_get_limit(
+	    (ext4_directory_dx_countlimit_t *) &root->entries);
+	if (limit != entry_space)
+		return EXT4_ERR_BAD_DX_DIR;
+	
+	/* Check hash version and modify if necessary */
+	hinfo->hash_version =
+	    ext4_directory_dx_root_info_get_hash_version(&root->info);
+	if ((hinfo->hash_version <= EXT4_HASH_VERSION_TEA) &&
+	    (ext4_superblock_has_flag(sb, EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH))) {
 		/* 3 is magic from ext4 linux implementation */
 		hinfo->hash_version += 3;
 	}
-
+	
 	/* Load hash seed from superblock */
 	hinfo->seed = ext4_superblock_get_hash_seed(sb);
-
+	
 	/* Compute hash value of name */
-	if (name) {
+	if (name)
 		ext4_hash_string(hinfo, name_len, name);
-	}
-
+	
 	return EOK;
 }
@@ -359,240 +369,247 @@
 /** Walk through index tree and load leaf with corresponding hash value.
  *
- * @param hinfo			initialized hash info structure
- * @param inode_ref 	current i-node
- * @param root_block	root block (iblock 0), where is root node located
- * @param dx_block		pointer to leaf node in dx_blocks array
- * @param dx_blocks		array with the whole path from root to leaf
- * @return				error code
+ * @param hinfo      Initialized hash info structure
+ * @param inode_ref  Current i-node
+ * @param root_block Root block (iblock 0), where is root node located
+ * @param dx_block   Pointer to leaf node in dx_blocks array
+ * @param dx_blocks  Array with the whole path from root to leaf
+ *
+ * @return Error code
+ *
  */
 static int ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo,
-		ext4_inode_ref_t *inode_ref, block_t *root_block,
-		ext4_directory_dx_block_t **dx_block, ext4_directory_dx_block_t *dx_blocks)
-{
-	int rc;
-
+    ext4_inode_ref_t *inode_ref, block_t *root_block,
+    ext4_directory_dx_block_t **dx_block, ext4_directory_dx_block_t *dx_blocks)
+{
 	ext4_directory_dx_block_t *tmp_dx_block = dx_blocks;
-
-	ext4_directory_dx_root_t *root = (ext4_directory_dx_root_t *)root_block->data;
-	ext4_directory_dx_entry_t *entries = (ext4_directory_dx_entry_t *)&root->entries;
-
-	uint16_t limit = ext4_directory_dx_countlimit_get_limit((ext4_directory_dx_countlimit_t *)entries);
-	uint8_t indirect_level = ext4_directory_dx_root_info_get_indirect_levels(&root->info);
-
+	ext4_directory_dx_root_t *root =
+	    (ext4_directory_dx_root_t *) root_block->data;
+	ext4_directory_dx_entry_t *entries =
+	    (ext4_directory_dx_entry_t *) &root->entries;
+	
+	uint16_t limit = ext4_directory_dx_countlimit_get_limit(
+	    (ext4_directory_dx_countlimit_t *) entries);
+	uint8_t indirect_level =
+	    ext4_directory_dx_root_info_get_indirect_levels(&root->info);
+	
 	block_t *tmp_block = root_block;
-	ext4_directory_dx_entry_t *p, *q, *m, *at;
-
+	ext4_directory_dx_entry_t *p;
+	ext4_directory_dx_entry_t *q;
+	ext4_directory_dx_entry_t *m;
+	ext4_directory_dx_entry_t *at;
+	
 	/* Walk through the index tree */
 	while (true) {
-
-		uint16_t count = ext4_directory_dx_countlimit_get_count((ext4_directory_dx_countlimit_t *)entries);
-		if ((count == 0) || (count > limit)) {
+		uint16_t count = ext4_directory_dx_countlimit_get_count(
+		    (ext4_directory_dx_countlimit_t *) entries);
+		if ((count == 0) || (count > limit))
 			return EXT4_ERR_BAD_DX_DIR;
-		}
-
-
+		
 		/* Do binary search in every node */
 		p = entries + 1;
 		q = entries + count - 1;
-
+		
 		while (p <= q) {
 			m = p + (q - p) / 2;
-			if (ext4_directory_dx_entry_get_hash(m) > hinfo->hash) {
+			if (ext4_directory_dx_entry_get_hash(m) > hinfo->hash)
 				q = m - 1;
-			} else {
+			else
 				p = m + 1;
-			}
 		}
-
+		
 		at = p - 1;
-
+		
 		/* Write results */
 		tmp_dx_block->block = tmp_block;
 		tmp_dx_block->entries = entries;
 		tmp_dx_block->position = at;
-
+		
 		/* Is algorithm in the leaf? */
-        if (indirect_level == 0) {
-        	*dx_block = tmp_dx_block;
-        	return EOK;
-        }
-
-        /* Goto child node */
+		if (indirect_level == 0) {
+			*dx_block = tmp_dx_block;
+			return EOK;
+		}
+		
+		/* Goto child node */
 		uint32_t next_block = ext4_directory_dx_entry_get_block(at);
-
-        indirect_level--;
-
-        uint32_t fblock;
-        rc = ext4_filesystem_get_inode_data_block_index(
-        		inode_ref, next_block, &fblock);
-        if (rc != EOK) {
-        	return rc;
-        }
-
-        rc = block_get(&tmp_block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
-        if (rc != EOK) {
-        	return rc;
-        }
-
+		
+		indirect_level--;
+		
+		uint32_t fblock;
+		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		    next_block, &fblock);
+		if (rc != EOK)
+			return rc;
+		
+		rc = block_get(&tmp_block, inode_ref->fs->device, fblock,
+		    BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			return rc;
+		
 		entries = ((ext4_directory_dx_node_t *) tmp_block->data)->entries;
 		limit = ext4_directory_dx_countlimit_get_limit(
-				(ext4_directory_dx_countlimit_t *)entries);
-
-        uint16_t entry_space = ext4_superblock_get_block_size(inode_ref->fs->superblock)
-        		- sizeof(ext4_directory_dx_dot_entry_t);
-        entry_space = entry_space / sizeof(ext4_directory_dx_entry_t);
-
-
+		    (ext4_directory_dx_countlimit_t *) entries);
+		
+		uint16_t entry_space =
+		    ext4_superblock_get_block_size(inode_ref->fs->superblock) -
+		    sizeof(ext4_directory_dx_dot_entry_t);
+		entry_space = entry_space / sizeof(ext4_directory_dx_entry_t);
+		
 		if (limit != entry_space) {
 			block_put(tmp_block);
-        	return EXT4_ERR_BAD_DX_DIR;
+			return EXT4_ERR_BAD_DX_DIR;
 		}
-
+		
 		++tmp_dx_block;
 	}
-
+	
 	/* Unreachable */
 	return EOK;
 }
 
-
 /** Check if the the next block would be checked during entry search.
  *
- * @param inode_ref			directory i-node
- * @param hash				hash value to check
- * @param dx_block			current block
- * @param dx_blocks			aray with path from root to leaf node
- * @return 					error code
- */
-static int ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref, uint32_t hash,
-		ext4_directory_dx_block_t *dx_block, ext4_directory_dx_block_t *dx_blocks)
-{
-	int rc;
-
-    uint32_t num_handles = 0;
-    ext4_directory_dx_block_t *p = dx_block;
-
-    /* Try to find data block with next bunch of entries */
-    while (1) {
-
-    	p->position++;
-    	uint16_t count = ext4_directory_dx_countlimit_get_count(
-    			(ext4_directory_dx_countlimit_t *)p->entries);
-
-    	if (p->position < p->entries + count) {
-    		break;
-    	}
-
-    	if (p == dx_blocks) {
-    		return 0;
-    	}
-
-    	num_handles++;
-    	p--;
-    }
-
-    /* Check hash collision (if not occured - no next block cannot be used) */
-    uint32_t current_hash = ext4_directory_dx_entry_get_hash(p->position);
-    if ((hash & 1) == 0) {
-    	if ((current_hash & ~1) != hash) {
-    		return 0;
-    	}
-    }
-
-    /* Fill new path */
-    while (num_handles--) {
-
-    	uint32_t block_idx = ext4_directory_dx_entry_get_block(p->position);
-    	uint32_t block_addr;
-    	rc = ext4_filesystem_get_inode_data_block_index(inode_ref, block_idx, &block_addr);
-    	if (rc != EOK) {
-    		return rc;
-    	}
-
-    	block_t *block;
-    	rc = block_get(&block, inode_ref->fs->device, block_addr, BLOCK_FLAGS_NONE);
-    	if (rc != EOK) {
-    		return rc;
-    	}
-
-    	p++;
-
-    	/* Don't forget to put old block (prevent memory leak) */
-    	block_put(p->block);
-
-        p->block = block;
-        p->entries = ((ext4_directory_dx_node_t *) block->data)->entries;
-        p->position = p->entries;
-    }
-
-    return 1;
-
+ * @param inode_ref Directory i-node
+ * @param hash      Hash value to check
+ * @param dx_block  Current block
+ * @param dx_blocks Array with path from root to leaf node
+ *
+ * @return Error code
+ *
+ */
+static int ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref,
+    uint32_t hash, ext4_directory_dx_block_t *dx_block,
+    ext4_directory_dx_block_t *dx_blocks)
+{
+	uint32_t num_handles = 0;
+	ext4_directory_dx_block_t *p = dx_block;
+	
+	/* Try to find data block with next bunch of entries */
+	while (true) {
+		p->position++;
+		uint16_t count = ext4_directory_dx_countlimit_get_count(
+		    (ext4_directory_dx_countlimit_t *) p->entries);
+		
+		if (p->position < p->entries + count)
+			break;
+		
+		if (p == dx_blocks)
+			return EOK;
+		
+		num_handles++;
+		p--;
+	}
+	
+	/* Check hash collision (if not occured - no next block cannot be used) */
+	uint32_t current_hash = ext4_directory_dx_entry_get_hash(p->position);
+	if ((hash & 1) == 0) {
+		if ((current_hash & ~1) != hash)
+			return 0;
+	}
+	
+	/* Fill new path */
+	while (num_handles--) {
+		uint32_t block_idx =
+		    ext4_directory_dx_entry_get_block(p->position);
+		uint32_t block_addr;
+		
+		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		    block_idx, &block_addr);
+		if (rc != EOK)
+			return rc;
+		
+		block_t *block;
+		rc = block_get(&block, inode_ref->fs->device, block_addr, BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			return rc;
+		
+		p++;
+		
+		/* Don't forget to put old block (prevent memory leak) */
+		block_put(p->block);
+		
+		p->block = block;
+		p->entries = ((ext4_directory_dx_node_t *) block->data)->entries;
+		p->position = p->entries;
+	}
+	
+	return ENOENT;
 }
 
 /** Try to find directory entry using directory index.
  *
- * @param result		output value - if entry will be found,
- *                      than will be passed through this parameter
- * @param inode_ref		directory i-node
- * @param name_len		length of name to be found
- * @param name			name to be found
- * @return				error code
+ * @param result    Output value - if entry will be found,
+ *                  than will be passed through this parameter
+ * @param inode_ref Directory i-node
+ * @param name_len  Length of name to be found
+ * @param name      Name to be found
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_dx_find_entry(ext4_directory_search_result_t *result,
-		ext4_inode_ref_t *inode_ref, size_t name_len, const char *name)
-{
-	int rc;
-
+    ext4_inode_ref_t *inode_ref, size_t name_len, const char *name)
+{
 	/* Load direct block 0 (index root) */
 	uint32_t root_block_addr;
-	rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0, &root_block_addr);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
+	    &root_block_addr);
+	if (rc != EOK)
+		return rc;
+	
 	ext4_filesystem_t *fs = inode_ref->fs;
-
+	
 	block_t *root_block;
-	rc = block_get(&root_block, fs->device, root_block_addr, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	rc = block_get(&root_block, fs->device, root_block_addr,
+	    BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+	
 	/* Initialize hash info (compute hash value) */
 	ext4_hash_info_t hinfo;
-	rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock, name_len, name);
+	rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock,
+	    name_len, name);
 	if (rc != EOK) {
 		block_put(root_block);
 		return EXT4_ERR_BAD_DX_DIR;
 	}
-
-	/* Hardcoded number 2 means maximum height of index tree, specified in linux driver */
+	
+	/*
+	 * Hardcoded number 2 means maximum height of index tree,
+	 * specified in the Linux driver.
+	 */
 	ext4_directory_dx_block_t dx_blocks[2];
-	ext4_directory_dx_block_t *dx_block, *tmp;
-	rc = ext4_directory_dx_get_leaf(&hinfo, inode_ref, root_block, &dx_block, dx_blocks);
+	ext4_directory_dx_block_t *dx_block;
+	ext4_directory_dx_block_t *tmp;
+	
+	rc = ext4_directory_dx_get_leaf(&hinfo, inode_ref, root_block,
+	    &dx_block, dx_blocks);
 	if (rc != EOK) {
 		block_put(root_block);
 		return EXT4_ERR_BAD_DX_DIR;
 	}
-
+	
 	do {
 		/* Load leaf block */
-		uint32_t leaf_block_idx = ext4_directory_dx_entry_get_block(dx_block->position);
+		uint32_t leaf_block_idx =
+		    ext4_directory_dx_entry_get_block(dx_block->position);
 		uint32_t leaf_block_addr;
-    	rc = ext4_filesystem_get_inode_data_block_index(inode_ref, leaf_block_idx, &leaf_block_addr);
-    	if (rc != EOK) {
-    		goto cleanup;
-    	}
-
-    	block_t *leaf_block;
-		rc = block_get(&leaf_block, fs->device, leaf_block_addr, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
+		
+		rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
+		    leaf_block_idx, &leaf_block_addr);
+		if (rc != EOK)
 			goto cleanup;
-		}
-
+		
+		block_t *leaf_block;
+		rc = block_get(&leaf_block, fs->device, leaf_block_addr,
+		    BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			goto cleanup;
+		
 		/* Linear search inside block */
 		ext4_directory_entry_ll_t *res_dentry;
-		rc = ext4_directory_find_in_block(leaf_block, fs->superblock, name_len, name, &res_dentry);
-
+		rc = ext4_directory_find_in_block(leaf_block, fs->superblock,
+		    name_len, name, &res_dentry);
+		
 		/* Found => return it */
 		if (rc == EOK) {
@@ -601,31 +618,30 @@
 			goto cleanup;
 		}
-
+		
 		/* Not found, leave untouched */
 		block_put(leaf_block);
-
-		if (rc != ENOENT) {
+		
+		if (rc != ENOENT)
 			goto cleanup;
-		}
-
+		
 		/* check if the next block could be checked */
-		rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash, dx_block, &dx_blocks[0]);
-		if (rc < 0) {
+		rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash,
+		    dx_block, &dx_blocks[0]);
+		if (rc < 0)
 			goto cleanup;
-		}
-
-	} while (rc == 1);
-
+	} while (rc == ENOENT);
+	
 	/* Entry not found */
 	rc = ENOENT;
-
+	
 cleanup:
-
 	/* The whole path must be released (preventing memory leak) */
 	tmp = dx_blocks;
+	
 	while (tmp <= dx_block) {
 		block_put(tmp->block);
 		++tmp;
 	}
+	
 	return rc;
 }
@@ -635,8 +651,11 @@
  * It can compare two entries by hash value.
  *
- * @param arg1		first entry
- * @param arg2		second entry
- * @param dummy		unused parameter, can be NULL
- * @return			classic compare result (0: equal, -1: arg1 < arg2, 1: arg1 > arg2)
+ * @param arg1  First entry
+ * @param arg2  Second entry
+ * @param dummy Unused parameter, can be NULL
+ *
+ * @return Classic compare result
+ *         (0: equal, -1: arg1 < arg2, 1: arg1 > arg2)
+ *
  */
 static int ext4_directory_dx_entry_comparator(void *arg1, void *arg2, void *dummy)
@@ -644,15 +663,12 @@
 	ext4_dx_sort_entry_t *entry1 = arg1;
 	ext4_dx_sort_entry_t *entry2 = arg2;
-
-	if (entry1->hash == entry2->hash) {
+	
+	if (entry1->hash == entry2->hash)
 		return 0;
-	}
-
-	if (entry1->hash < entry2->hash) {
+	
+	if (entry1->hash < entry2->hash)
 		return -1;
-	} else {
+	else
 		return 1;
-	}
-
 }
 
@@ -661,29 +677,29 @@
  * Note that space for new entry must be checked by caller.
  *
- * @param index_block		block where to insert new entry
- * @param hash				hash value covered by child node
- * @param iblock			logical number of child block
+ * @param index_block Block where to insert new entry
+ * @param hash        Hash value covered by child node
+ * @param iblock      Logical number of child block
  *
  */
 static void ext4_directory_dx_insert_entry(
-		ext4_directory_dx_block_t *index_block, uint32_t hash, uint32_t iblock)
+    ext4_directory_dx_block_t *index_block, uint32_t hash, uint32_t iblock)
 {
 	ext4_directory_dx_entry_t *old_index_entry = index_block->position;
 	ext4_directory_dx_entry_t *new_index_entry = old_index_entry + 1;
-
+	
 	ext4_directory_dx_countlimit_t *countlimit =
-			(ext4_directory_dx_countlimit_t *)index_block->entries;
+	    (ext4_directory_dx_countlimit_t *) index_block->entries;
 	uint32_t count = ext4_directory_dx_countlimit_get_count(countlimit);
-
+	
 	ext4_directory_dx_entry_t *start_index = index_block->entries;
-	size_t bytes = (void *)(start_index + count) - (void *)(new_index_entry);
-
+	size_t bytes = (void *) (start_index + count) - (void *) (new_index_entry);
+	
 	memmove(new_index_entry + 1, new_index_entry, bytes);
-
+	
 	ext4_directory_dx_entry_set_block(new_index_entry, iblock);
 	ext4_directory_dx_entry_set_hash(new_index_entry, hash);
-
+	
 	ext4_directory_dx_countlimit_set_count(countlimit, count + 1);
-
+	
 	index_block->block->dirty = true;
 }
@@ -691,81 +707,82 @@
 /** Split directory entries to two parts preventing node overflow.
  *
- * @param inode_ref			directory i-node
- * @param hinfo				hash info
- * @param old_data_block	block with data to be split
- * @param index_block		block where index entries are located
- * @param new_data_block	output value for newly allocated data block
+ * @param inode_ref      Directory i-node
+ * @param hinfo          Hash info
+ * @param old_data_block Block with data to be split
+ * @param index_block    Block where index entries are located
+ * @param new_data_block Output value for newly allocated data block
+ *
  */
 static int ext4_directory_dx_split_data(ext4_inode_ref_t *inode_ref,
-		ext4_hash_info_t *hinfo, block_t *old_data_block,
-		ext4_directory_dx_block_t *index_block, block_t **new_data_block)
+    ext4_hash_info_t *hinfo, block_t *old_data_block,
+    ext4_directory_dx_block_t *index_block, block_t **new_data_block)
 {
 	int rc = EOK;
-
+	
 	/* Allocate buffer for directory entries */
 	uint32_t block_size =
-			ext4_superblock_get_block_size(inode_ref->fs->superblock);
+	    ext4_superblock_get_block_size(inode_ref->fs->superblock);
 	void *entry_buffer = malloc(block_size);
-	if (entry_buffer == NULL) {
+	if (entry_buffer == NULL)
 		return ENOMEM;
-	}
-
+	
 	/* dot entry has the smallest size available */
-	uint32_t max_entry_count =  block_size / sizeof(ext4_directory_dx_dot_entry_t);
-
+	uint32_t max_entry_count =
+	    block_size / sizeof(ext4_directory_dx_dot_entry_t);
+	
 	/* Allocate sort entry */
-	ext4_dx_sort_entry_t *sort_array = malloc(max_entry_count * sizeof(ext4_dx_sort_entry_t));
+	ext4_dx_sort_entry_t *sort_array =
+	    malloc(max_entry_count * sizeof(ext4_dx_sort_entry_t));
 	if (sort_array == NULL) {
 		free(entry_buffer);
 		return ENOMEM;
 	}
-
+	
 	uint32_t idx = 0;
 	uint32_t real_size = 0;
-
+	
 	/* Initialize hinfo */
 	ext4_hash_info_t tmp_hinfo;
 	memcpy(&tmp_hinfo, hinfo, sizeof(ext4_hash_info_t));
-
+	
 	/* Load all valid entries to the buffer */
 	ext4_directory_entry_ll_t *dentry = old_data_block->data;
 	void *entry_buffer_ptr = entry_buffer;
 	while ((void *)dentry < old_data_block->data + block_size) {
-
 		/* Read only valid entries */
 		if (ext4_directory_entry_ll_get_inode(dentry) != 0) {
-
 			uint8_t len = ext4_directory_entry_ll_get_name_length(
-					inode_ref->fs->superblock, dentry);
-			ext4_hash_string(&tmp_hinfo, len, (char *)dentry->name);
-
+			    inode_ref->fs->superblock, dentry);
+			ext4_hash_string(&tmp_hinfo, len, (char *) dentry->name);
+			
 			uint32_t rec_len = 8 + len;
-
-			if ((rec_len % 4) != 0) {
+			
+			if ((rec_len % 4) != 0)
 				rec_len += 4 - (rec_len % 4);
-			}
-
+			
 			memcpy(entry_buffer_ptr, dentry, rec_len);
-
+			
 			sort_array[idx].dentry = entry_buffer_ptr;
 			sort_array[idx].rec_len = rec_len;
 			sort_array[idx].hash = tmp_hinfo.hash;
-
+			
 			entry_buffer_ptr += rec_len;
 			real_size += rec_len;
 			idx++;
 		}
-
-		dentry = (void *)dentry + ext4_directory_entry_ll_get_entry_length(dentry);
-	}
-
+		
+		dentry = (void *) dentry +
+		    ext4_directory_entry_ll_get_entry_length(dentry);
+	}
+	
 	/* Sort all entries */
 	qsort(sort_array, idx, sizeof(ext4_dx_sort_entry_t),
-			ext4_directory_dx_entry_comparator, NULL);
-
+	    ext4_directory_dx_entry_comparator, NULL);
+	
 	/* Allocate new block for store the second part of entries */
 	uint32_t new_fblock;
 	uint32_t new_iblock;
-	rc = ext4_filesystem_append_inode_block(inode_ref, &new_fblock, &new_iblock);
+	rc = ext4_filesystem_append_inode_block(inode_ref, &new_fblock,
+	    &new_iblock);
 	if (rc != EOK) {
 		free(sort_array);
@@ -773,9 +790,9 @@
 		return rc;
 	}
-
+	
 	/* Load new block */
 	block_t *new_data_block_tmp;
 	rc = block_get(&new_data_block_tmp, inode_ref->fs->device,
-			new_fblock, BLOCK_FLAGS_NOREAD);
+	    new_fblock, BLOCK_FLAGS_NOREAD);
 	if (rc != EOK) {
 		free(sort_array);
@@ -783,6 +800,7 @@
 		return rc;
 	}
-
-	/* Distribute entries to two blocks (by size)
+	
+	/*
+	 * Distribute entries to two blocks (by size)
 	 * - compute the half
 	 */
@@ -796,32 +814,32 @@
 			break;
 		}
-
+		
 		current_size += sort_array[i].rec_len;
 	}
-
+	
 	/* Check hash collision */
 	uint32_t continued = 0;
-	if (new_hash == sort_array[mid-1].hash) {
+	if (new_hash == sort_array[mid-1].hash)
 		continued = 1;
-	}
-
+	
 	uint32_t offset = 0;
 	void *ptr;
-
+	
 	/* First part - to the old block */
 	for (uint32_t i = 0; i < mid; ++i) {
 		ptr = old_data_block->data + offset;
 		memcpy(ptr, sort_array[i].dentry, sort_array[i].rec_len);
-
+		
 		ext4_directory_entry_ll_t *tmp = ptr;
-		if (i < (mid - 1)) {
-			ext4_directory_entry_ll_set_entry_length(tmp, sort_array[i].rec_len);
-		} else {
-			ext4_directory_entry_ll_set_entry_length(tmp, block_size - offset);
-		}
-
+		if (i < (mid - 1))
+			ext4_directory_entry_ll_set_entry_length(tmp,
+			    sort_array[i].rec_len);
+		else
+			ext4_directory_entry_ll_set_entry_length(tmp,
+			    block_size - offset);
+		
 		offset += sort_array[i].rec_len;
 	}
-
+	
 	/* Second part - to the new block */
 	offset = 0;
@@ -829,26 +847,28 @@
 		ptr = new_data_block_tmp->data + offset;
 		memcpy(ptr, sort_array[i].dentry, sort_array[i].rec_len);
-
+		
 		ext4_directory_entry_ll_t *tmp = ptr;
-		if (i < (idx - 1)) {
-			ext4_directory_entry_ll_set_entry_length(tmp, sort_array[i].rec_len);
-		} else {
-			ext4_directory_entry_ll_set_entry_length(tmp, block_size - offset);
-		}
-
+		if (i < (idx - 1))
+			ext4_directory_entry_ll_set_entry_length(tmp,
+			    sort_array[i].rec_len);
+		else
+			ext4_directory_entry_ll_set_entry_length(tmp,
+			    block_size - offset);
+		
 		offset += sort_array[i].rec_len;
 	}
-
+	
 	/* Do some steps to finish operation */
 	old_data_block->dirty = true;
 	new_data_block_tmp->dirty = true;
-
+	
 	free(sort_array);
 	free(entry_buffer);
-
-	ext4_directory_dx_insert_entry(index_block, new_hash + continued, new_iblock);
-
+	
+	ext4_directory_dx_insert_entry(index_block, new_hash + continued,
+	    new_iblock);
+	
 	*new_data_block = new_data_block_tmp;
-
+	
 	return EOK;
 }
@@ -856,138 +876,139 @@
 /** Split index node and maybe some parent nodes in the tree hierarchy.
  *
- * @param inode_ref		directory i-node
- * @param dx_blocks		array with path from root to leaf node
- * @param dx_block		leaf block to be split if needed
- * @return				error code
+ * @param inode_ref Directory i-node
+ * @param dx_blocks Array with path from root to leaf node
+ * @param dx_block  Leaf block to be split if needed
+ *
+ * @return Error code
+ *
  */
 static int ext4_directory_dx_split_index(ext4_inode_ref_t *inode_ref,
 		ext4_directory_dx_block_t *dx_blocks, ext4_directory_dx_block_t *dx_block)
 {
-	int rc;
-
 	ext4_directory_dx_entry_t *entries;
-	if (dx_block == dx_blocks) {
-		entries = ((ext4_directory_dx_root_t *) dx_block->block->data)->entries;
-	} else {
-		entries = ((ext4_directory_dx_node_t *) dx_block->block->data)->entries;
-	}
-
+	if (dx_block == dx_blocks)
+		entries =
+		    ((ext4_directory_dx_root_t *) dx_block->block->data)->entries;
+	else
+		entries =
+		    ((ext4_directory_dx_node_t *) dx_block->block->data)->entries;
+	
 	ext4_directory_dx_countlimit_t *countlimit =
-			(ext4_directory_dx_countlimit_t *)entries;
-	uint16_t leaf_limit = ext4_directory_dx_countlimit_get_limit(countlimit);
-	uint16_t leaf_count = ext4_directory_dx_countlimit_get_count(countlimit);
-
+	    (ext4_directory_dx_countlimit_t *) entries;
+	
+	uint16_t leaf_limit =
+	    ext4_directory_dx_countlimit_get_limit(countlimit);
+	uint16_t leaf_count =
+	    ext4_directory_dx_countlimit_get_count(countlimit);
+	
 	/* Check if is necessary to split index block */
 	if (leaf_limit == leaf_count) {
-
-		unsigned int levels = dx_block - dx_blocks;
-
+		size_t levels = dx_block - dx_blocks;
+		
 		ext4_directory_dx_entry_t *root_entries =
-					((ext4_directory_dx_root_t *)dx_blocks[0].block->data)->entries;
-
+		    ((ext4_directory_dx_root_t *) dx_blocks[0].block->data)->entries;
+		
 		ext4_directory_dx_countlimit_t *root_countlimit =
-				(ext4_directory_dx_countlimit_t *)root_entries;
+		    (ext4_directory_dx_countlimit_t *) root_entries;
 		uint16_t root_limit =
-				ext4_directory_dx_countlimit_get_limit(root_countlimit);
+		    ext4_directory_dx_countlimit_get_limit(root_countlimit);
 		uint16_t root_count =
-				ext4_directory_dx_countlimit_get_count(root_countlimit);
-
+		    ext4_directory_dx_countlimit_get_count(root_countlimit);
+		
 		/* Linux limitation */
-		if ((levels > 0) && (root_limit == root_count)) {
+		if ((levels > 0) && (root_limit == root_count))
 			return ENOSPC;
-		}
-
+		
 		/* Add new block to directory */
 		uint32_t new_fblock;
 		uint32_t new_iblock;
-		rc =  ext4_filesystem_append_inode_block(
-				inode_ref, &new_fblock, &new_iblock);
-		if (rc != EOK) {
+		int rc = ext4_filesystem_append_inode_block(inode_ref,
+		    &new_fblock, &new_iblock);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		/* load new block */
-		block_t * new_block;
+		block_t *new_block;
 		rc = block_get(&new_block, inode_ref->fs->device,
-				new_fblock, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK) {
+		    new_fblock, BLOCK_FLAGS_NOREAD);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		ext4_directory_dx_node_t *new_node = new_block->data;
 		ext4_directory_dx_entry_t *new_entries = new_node->entries;
-
-		uint32_t block_size = ext4_superblock_get_block_size(
-				inode_ref->fs->superblock);
-
+		
+		uint32_t block_size =
+		    ext4_superblock_get_block_size(inode_ref->fs->superblock);
+		
 		/* Split leaf node */
 		if (levels > 0) {
-
 			uint32_t count_left = leaf_count / 2;
 			uint32_t count_right = leaf_count - count_left;
 			uint32_t hash_right =
-					ext4_directory_dx_entry_get_hash(entries + count_left);
-
+			    ext4_directory_dx_entry_get_hash(entries + count_left);
+			
 			/* Copy data to new node */
 			memcpy((void *) new_entries, (void *) (entries + count_left),
-					count_right * sizeof(ext4_directory_dx_entry_t));
-
+			    count_right * sizeof(ext4_directory_dx_entry_t));
+			
 			/* Initialize new node */
 			ext4_directory_dx_countlimit_t *left_countlimit =
-					(ext4_directory_dx_countlimit_t *)entries;
+			    (ext4_directory_dx_countlimit_t *) entries;
 			ext4_directory_dx_countlimit_t *right_countlimit =
-					(ext4_directory_dx_countlimit_t *)new_entries;
-
+			    (ext4_directory_dx_countlimit_t *) new_entries;
+			
 			ext4_directory_dx_countlimit_set_count(left_countlimit, count_left);
 			ext4_directory_dx_countlimit_set_count(right_countlimit, count_right);
-
-			uint32_t entry_space = block_size - sizeof(ext4_fake_directory_entry_t);
-			uint32_t node_limit = entry_space / sizeof(ext4_directory_dx_entry_t);
+			
+			uint32_t entry_space =
+			    block_size - sizeof(ext4_fake_directory_entry_t);
+			uint32_t node_limit =
+			    entry_space / sizeof(ext4_directory_dx_entry_t);
 			ext4_directory_dx_countlimit_set_limit(right_countlimit, node_limit);
-
+			
 			/* Which index block is target for new entry */
 			uint32_t position_index = (dx_block->position - dx_block->entries);
 			if (position_index >= count_left) {
-
 				dx_block->block->dirty = true;
-
+				
 				block_t *block_tmp = dx_block->block;
 				dx_block->block = new_block;
-				dx_block->position = new_entries + position_index - count_left;
+				dx_block->position =
+				    new_entries + position_index - count_left;
 				dx_block->entries = new_entries;
-
+				
 				new_block = block_tmp;
-
 			}
-
+			
 			/* Finally insert new entry */
 			ext4_directory_dx_insert_entry(dx_blocks, hash_right, new_iblock);
-
+			
 			return block_put(new_block);
-
 		} else {
-
 			/* Create second level index */
-
+			
 			/* Copy data from root to child block */
 			memcpy((void *) new_entries, (void *) entries,
-					leaf_count * sizeof(ext4_directory_dx_entry_t));
-
+			    leaf_count * sizeof(ext4_directory_dx_entry_t));
+			
 			ext4_directory_dx_countlimit_t *new_countlimit =
-					(ext4_directory_dx_countlimit_t *)new_entries;
-
-			uint32_t entry_space = block_size - sizeof(ext4_fake_directory_entry_t);
-			uint32_t node_limit = entry_space / sizeof(ext4_directory_dx_entry_t);
+			    (ext4_directory_dx_countlimit_t *) new_entries;
+			
+			uint32_t entry_space =
+			    block_size - sizeof(ext4_fake_directory_entry_t);
+			uint32_t node_limit =
+			    entry_space / sizeof(ext4_directory_dx_entry_t);
 			ext4_directory_dx_countlimit_set_limit(new_countlimit, node_limit);
-
+			
 			/* Set values in root node */
 			ext4_directory_dx_countlimit_t *new_root_countlimit =
-					(ext4_directory_dx_countlimit_t *)entries;
-
+			    (ext4_directory_dx_countlimit_t *) entries;
+			
 			ext4_directory_dx_countlimit_set_count(new_root_countlimit, 1);
 			ext4_directory_dx_entry_set_block(entries, new_iblock);
-
-			((ext4_directory_dx_root_t *)dx_blocks[0].block->data)->info.indirect_levels = 1;
-
+			
+			((ext4_directory_dx_root_t *)
+			    dx_blocks[0].block->data)->info.indirect_levels = 1;
+			
 			/* Add new entry to the path */
 			dx_block = dx_blocks + 1;
@@ -996,7 +1017,6 @@
 			dx_block->block = new_block;
 		}
-
-	}
-
+	}
+	
 	return EOK;
 }
@@ -1004,132 +1024,136 @@
 /** Add new entry to indexed directory
  *
- * @param parent	directory i-node
- * @param child		i-node to be referenced from directory entry
- * @param name		name of new directory entry
- * @return			error code
+ * @param parent Directory i-node
+ * @param child  I-node to be referenced from directory entry
+ * @param name   Name of new directory entry
+ *
+ * @return Error code
+ *
  */
 int ext4_directory_dx_add_entry(ext4_inode_ref_t *parent,
-		ext4_inode_ref_t *child, const char *name)
-{
-	int rc = EOK;
+    ext4_inode_ref_t *child, const char *name)
+{
 	int rc2 = EOK;
-
-	/* get direct block 0 (index root) */
+	
+	/* Get direct block 0 (index root) */
 	uint32_t root_block_addr;
-	rc = ext4_filesystem_get_inode_data_block_index(parent, 0, &root_block_addr);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_inode_data_block_index(parent, 0,
+	    &root_block_addr);
+	if (rc != EOK)
+		return rc;
+	
 	ext4_filesystem_t *fs = parent->fs;
-
+	
 	block_t *root_block;
-	rc = block_get(&root_block, fs->device, root_block_addr, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	rc = block_get(&root_block, fs->device, root_block_addr,
+	    BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+	
 	/* Initialize hinfo structure (mainly compute hash) */
-	uint32_t name_len = strlen(name);
+	uint32_t name_len = str_size(name);
 	ext4_hash_info_t hinfo;
-	rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock, name_len, name);
+	rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock,
+	    name_len, name);
 	if (rc != EOK) {
 		block_put(root_block);
 		return EXT4_ERR_BAD_DX_DIR;
 	}
-
-	/* Hardcoded number 2 means maximum height of index tree defined in linux */
+	
+	/*
+	 * Hardcoded number 2 means maximum height of index
+	 * tree defined in Linux.
+	 */
 	ext4_directory_dx_block_t dx_blocks[2];
-	ext4_directory_dx_block_t *dx_block, *dx_it;
-	rc = ext4_directory_dx_get_leaf(&hinfo, parent, root_block, &dx_block, dx_blocks);
+	ext4_directory_dx_block_t *dx_block;
+	ext4_directory_dx_block_t *dx_it;
+	
+	rc = ext4_directory_dx_get_leaf(&hinfo, parent, root_block,
+	    &dx_block, dx_blocks);
 	if (rc != EOK) {
 		rc = EXT4_ERR_BAD_DX_DIR;
 		goto release_index;
 	}
-
-
+	
 	/* Try to insert to existing data block */
-	uint32_t leaf_block_idx = ext4_directory_dx_entry_get_block(dx_block->position);
+	uint32_t leaf_block_idx =
+	    ext4_directory_dx_entry_get_block(dx_block->position);
 	uint32_t leaf_block_addr;
-   	rc = ext4_filesystem_get_inode_data_block_index(parent, leaf_block_idx, &leaf_block_addr);
-   	if (rc != EOK) {
-   		goto release_index;
-   	}
-
-
-   	block_t *target_block;
-   	rc = block_get(&target_block, fs->device, leaf_block_addr, BLOCK_FLAGS_NONE);
-   	if (rc != EOK) {
-   		goto release_index;
-   	}
-
-   	/* Check if insert operation passed */
-   	rc = ext4_directory_try_insert_entry(fs->superblock, target_block, child, name, name_len);
-   	if (rc == EOK) {
-   		goto release_target_index;
-   	}
-
-   	/* Check if there is needed to split index node
-   	 * (and recursively also parent nodes)
-   	 */
+	rc = ext4_filesystem_get_inode_data_block_index(parent, leaf_block_idx,
+	    &leaf_block_addr);
+	if (rc != EOK)
+		goto release_index;
+	
+	block_t *target_block;
+	rc = block_get(&target_block, fs->device, leaf_block_addr,
+	    BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		goto release_index;
+	
+	/* Check if insert operation passed */
+	rc = ext4_directory_try_insert_entry(fs->superblock, target_block, child,
+	    name, name_len);
+	if (rc == EOK)
+		goto release_target_index;
+	
+	/*
+	 * Check if there is needed to split index node
+	 * (and recursively also parent nodes)
+	 */
 	rc = ext4_directory_dx_split_index(parent, dx_blocks, dx_block);
-	if (rc != EOK) {
+	if (rc != EOK)
 		goto release_target_index;
-	}
-
+	
 	/* Split entries to two blocks (includes sorting by hash value) */
 	block_t *new_block = NULL;
-	rc = ext4_directory_dx_split_data(parent, &hinfo, target_block, dx_block, &new_block);
+	rc = ext4_directory_dx_split_data(parent, &hinfo, target_block,
+	    dx_block, &new_block);
 	if (rc != EOK) {
 		rc2 = rc;
 		goto release_target_index;
 	}
-
+	
 	/* Where to save new entry */
-	uint32_t new_block_hash = ext4_directory_dx_entry_get_hash(dx_block->position + 1);
-	if (hinfo.hash >= new_block_hash) {
-		rc = ext4_directory_try_insert_entry(fs->superblock, new_block, child, name, name_len);
-	} else {
-		rc = ext4_directory_try_insert_entry(fs->superblock, target_block, child, name, name_len);
-	}
-
+	uint32_t new_block_hash =
+	    ext4_directory_dx_entry_get_hash(dx_block->position + 1);
+	if (hinfo.hash >= new_block_hash)
+		rc = ext4_directory_try_insert_entry(fs->superblock, new_block,
+		    child, name, name_len);
+	else
+		rc = ext4_directory_try_insert_entry(fs->superblock, target_block,
+		    child, name, name_len);
+	
 	/* Cleanup */
 	rc = block_put(new_block);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Cleanup operations */
-
+	
 release_target_index:
-
 	rc2 = rc;
-
+	
 	rc = block_put(target_block);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 release_index:
-
-	if (rc != EOK) {
+	if (rc != EOK)
 		rc2 = rc;
-	}
-
+	
 	dx_it = dx_blocks;
-
+	
 	while (dx_it <= dx_block) {
 		rc = block_put(dx_it->block);
-		if (rc != EOK) {
+		if (rc != EOK)
 			return rc;
-		}
+		
 		dx_it++;
 	}
-
+	
 	return rc2;
 }
-
 
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_directory_index.h
===================================================================
--- uspace/lib/ext4/libext4_directory_index.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_directory_index.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_DIRECTORY_INDEX_H_
@@ -37,38 +37,37 @@
 
 extern uint8_t ext4_directory_dx_root_info_get_hash_version(
-		ext4_directory_dx_root_info_t *);
+    ext4_directory_dx_root_info_t *);
 extern void ext4_directory_dx_root_info_set_hash_version(
-		ext4_directory_dx_root_info_t *, uint8_t);
+    ext4_directory_dx_root_info_t *, uint8_t);
 extern uint8_t ext4_directory_dx_root_info_get_info_length(
-		ext4_directory_dx_root_info_t *);
+    ext4_directory_dx_root_info_t *);
 extern void ext4_directory_dx_root_info_set_info_length(
-		ext4_directory_dx_root_info_t *, uint8_t);
+    ext4_directory_dx_root_info_t *, uint8_t);
 extern uint8_t ext4_directory_dx_root_info_get_indirect_levels(
-		ext4_directory_dx_root_info_t *);
+    ext4_directory_dx_root_info_t *);
 extern void ext4_directory_dx_root_info_set_indirect_levels(
-		ext4_directory_dx_root_info_t *, uint8_t);
+    ext4_directory_dx_root_info_t *, uint8_t);
 
 extern uint16_t ext4_directory_dx_countlimit_get_limit(
-		ext4_directory_dx_countlimit_t *);
+    ext4_directory_dx_countlimit_t *);
 extern void ext4_directory_dx_countlimit_set_limit(
-		ext4_directory_dx_countlimit_t *, uint16_t);
+    ext4_directory_dx_countlimit_t *, uint16_t);
 extern uint16_t ext4_directory_dx_countlimit_get_count(
-		ext4_directory_dx_countlimit_t *);
+    ext4_directory_dx_countlimit_t *);
 extern void ext4_directory_dx_countlimit_set_count(
-		ext4_directory_dx_countlimit_t *, uint16_t);
+    ext4_directory_dx_countlimit_t *, uint16_t);
 
 extern uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *);
 extern void ext4_directory_dx_entry_set_hash(ext4_directory_dx_entry_t *,
-		uint32_t);
+    uint32_t);
 extern uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *);
-void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *, uint32_t);
-
-/*********************************************************************************/
+extern void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *,
+    uint32_t);
 
 extern int ext4_directory_dx_init(ext4_inode_ref_t *);
 extern int ext4_directory_dx_find_entry(ext4_directory_search_result_t *,
-		ext4_inode_ref_t *, size_t, const char *);
-extern int ext4_directory_dx_add_entry(
-		ext4_inode_ref_t *, ext4_inode_ref_t *, const char *);
+    ext4_inode_ref_t *, size_t, const char *);
+extern int ext4_directory_dx_add_entry(ext4_inode_ref_t *, ext4_inode_ref_t *,
+    const char *);
 
 #endif
Index: uspace/lib/ext4/libext4_extent.c
===================================================================
--- uspace/lib/ext4/libext4_extent.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_extent.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_extent.c
- * @brief	Ext4 extent structures operations.
+ * @file  libext4_extent.c
+ * @brief Ext4 extent structures operations.
  */
 
@@ -43,6 +42,8 @@
 /** Get logical number of the block covered by extent.
  *
- * @param extent	extent to load number from
- * @return			logical number of the first block covered by extent
+ * @param extent Extent to load number from
+ *
+ * @return Logical number of the first block covered by extent
+ *
  */
 uint32_t ext4_extent_get_first_block(ext4_extent_t *extent)
@@ -53,6 +54,7 @@
 /** Set logical number of the first block covered by extent.
  *
- * @param extent	extent to set number to
- * @param iblock	logical number of the first block covered by extent
+ * @param extent Extent to set number to
+ * @param iblock Logical number of the first block covered by extent
+ *
  */
 void ext4_extent_set_first_block(ext4_extent_t *extent, uint32_t iblock)
@@ -63,6 +65,8 @@
 /** Get number of blocks covered by extent.
  *
- * @param extent	extent to load count from
- * @return			number of blocks covered by extent
+ * @param extent Extent to load count from
+ *
+ * @return Number of blocks covered by extent
+ *
  */
 uint16_t ext4_extent_get_block_count(ext4_extent_t *extent)
@@ -73,6 +77,7 @@
 /** Set number of blocks covered by extent.
  *
- * @param extent	extent to load count from
- * @param count 	number of blocks covered by extent
+ * @param extent Extent to load count from
+ * @param count  Number of blocks covered by extent
+ *
  */
 void ext4_extent_set_block_count(ext4_extent_t *extent, uint16_t count)
@@ -83,17 +88,20 @@
 /** Get physical number of the first block covered by extent.
  *
- * @param extent 	extent to load number
- * @return			physical number of the first block covered by extent
+ * @param extent Extent to load number
+ *
+ * @return Physical number of the first block covered by extent
+ *
  */
 uint64_t ext4_extent_get_start(ext4_extent_t *extent)
 {
 	return ((uint64_t)uint16_t_le2host(extent->start_hi)) << 32 |
-			((uint64_t)uint32_t_le2host(extent->start_lo));
+	    ((uint64_t)uint32_t_le2host(extent->start_lo));
 }
 
 /** Set physical number of the first block covered by extent.
  *
- * @param extent 	extent to load number
- * @param fblock	physical number of the first block covered by extent
+ * @param extent Extent to load number
+ * @param fblock Physical number of the first block covered by extent
+ *
  */
 void ext4_extent_set_start(ext4_extent_t *extent, uint64_t fblock)
@@ -105,6 +113,8 @@
 /** Get logical number of the block covered by extent index.
  *
- * @param index 	extent index to load number from
- * @return			logical number of the first block covered by extent index
+ * @param index Extent index to load number from
+ *
+ * @return Logical number of the first block covered by extent index
+ *
  */
 uint32_t ext4_extent_index_get_first_block(ext4_extent_index_t *index)
@@ -115,9 +125,10 @@
 /** Set logical number of the block covered by extent index.
  *
- * @param index 	extent index to set number to
- * @param iblock	logical number of the first block covered by extent index
+ * @param index  Extent index to set number to
+ * @param iblock Logical number of the first block covered by extent index
+ *
  */
 void ext4_extent_index_set_first_block(ext4_extent_index_t *index,
-		uint32_t iblock)
+    uint32_t iblock)
 {
 	index->first_block = host2uint32_t_le(iblock);
@@ -126,28 +137,33 @@
 /** Get physical number of block where the child node is located.
  *
- * @param index		extent index to load number from
- * @return			physical number of the block with child node
+ * @param index Extent index to load number from
+ *
+ * @return Physical number of the block with child node
+ *
  */
 uint64_t ext4_extent_index_get_leaf(ext4_extent_index_t *index)
 {
-	return ((uint64_t)uint16_t_le2host(index->leaf_hi)) << 32 |
-		((uint64_t)uint32_t_le2host(index->leaf_lo));
+	return ((uint64_t) uint16_t_le2host(index->leaf_hi)) << 32 |
+	    ((uint64_t)uint32_t_le2host(index->leaf_lo));
 }
 
 /** Set physical number of block where the child node is located.
  *
- * @param index		extent index to set number to
- * @param fblock	physical number of the block with child node
+ * @param index  Extent index to set number to
+ * @param fblock Ohysical number of the block with child node
+ *
  */
 void ext4_extent_index_set_leaf(ext4_extent_index_t *index, uint64_t fblock)
 {
 	index->leaf_lo = host2uint32_t_le((fblock << 32) >> 32);
-	index->leaf_hi = host2uint16_t_le((uint16_t)(fblock >> 32));
+	index->leaf_hi = host2uint16_t_le((uint16_t) (fblock >> 32));
 }
 
 /** Get magic value from extent header.
  *
- * @param header	extent header to load value from
- * @return			magic value of extent header
+ * @param header Extent header to load value from
+ *
+ * @return Magic value of extent header
+ *
  */
 uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *header)
@@ -158,6 +174,7 @@
 /** Set magic value to extent header.
  *
- * @param header	extent header to set value to
- * @param magic		magic value of extent header
+ * @param header Extent header to set value to
+ * @param magic  Magic value of extent header
+ *
  */
 void ext4_extent_header_set_magic(ext4_extent_header_t *header, uint16_t magic)
@@ -168,6 +185,8 @@
 /** Get number of entries from extent header
  *
- * @param header	extent header to get value from
- * @return			number of entries covered by extent header
+ * @param header Extent header to get value from
+ *
+ * @return Number of entries covered by extent header
+ *
  */
 uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *header)
@@ -178,9 +197,10 @@
 /** Set number of entries to extent header
  *
- * @param header	extent header to set value to
- * @param count		number of entries covered by extent header
+ * @param header Extent header to set value to
+ * @param count  Number of entries covered by extent header
+ *
  */
 void ext4_extent_header_set_entries_count(ext4_extent_header_t *header,
-		uint16_t count)
+    uint16_t count)
 {
 	header->entries_count = host2uint16_t_le(count);
@@ -189,6 +209,8 @@
 /** Get maximum number of entries from extent header
  *
- * @param header	extent header to get value from
- * @return			maximum number of entries covered by extent header
+ * @param header Extent header to get value from
+ *
+ * @return Maximum number of entries covered by extent header
+ *
  */
 uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *header)
@@ -199,9 +221,10 @@
 /** Set maximum number of entries to extent header
  *
- * @param header	extent header to set value to
- * @param max_count maximum number of entries covered by extent header
+ * @param header    Extent header to set value to
+ * @param max_count Maximum number of entries covered by extent header
+ *
  */
 void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *header,
-		uint16_t max_count)
+    uint16_t max_count)
 {
 	header->max_entries_count = host2uint16_t_le(max_count);
@@ -210,6 +233,8 @@
 /** Get depth of extent subtree.
  *
- * @param header	extent header to get value from
- * @return			depth of extent subtree
+ * @param header Extent header to get value from
+ *
+ * @return Depth of extent subtree
+ *
  */
 uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *header)
@@ -220,6 +245,7 @@
 /** Set depth of extent subtree.
  *
- * @param header	extent header to set value to
- * @param depth 	depth of extent subtree
+ * @param header Extent header to set value to
+ * @param depth  Depth of extent subtree
+ *
  */
 void ext4_extent_header_set_depth(ext4_extent_header_t *header, uint16_t depth)
@@ -230,6 +256,8 @@
 /** Get generation from extent header
  *
- * @param header 	extent header to get value from
- * @return 			generation
+ * @param header Extent header to get value from
+ *
+ * @return Generation
+ *
  */
 uint32_t ext4_extent_header_get_generation(ext4_extent_header_t *header)
@@ -240,9 +268,10 @@
 /** Set generation to extent header
  *
- * @param header 		extent header to set value to
- * @param generation	generation
+ * @param header     Extent header to set value to
+ * @param generation Generation
+ *
  */
 void ext4_extent_header_set_generation(ext4_extent_header_t *header,
-		uint32_t generation)
+    uint32_t generation)
 {
 	header->generation = host2uint32_t_le(generation);
@@ -251,30 +280,34 @@
 /** Binary search in extent index node.
  *
- * @param header	extent header of index node
- * @param index		output value - found index will be set here
- * @param iblock	logical block number to find in index node
+ * @param header Extent header of index node
+ * @param index  Output value - found index will be set here
+ * @param iblock Logical block number to find in index node
+ *
  */
 static void ext4_extent_binsearch_idx(ext4_extent_header_t *header,
-	ext4_extent_index_t **index, uint32_t iblock)
-{
-	ext4_extent_index_t *r, *l, *m;
-
-	uint16_t entries_count = ext4_extent_header_get_entries_count(header);
-
+    ext4_extent_index_t **index, uint32_t iblock)
+{
+	ext4_extent_index_t *r;
+	ext4_extent_index_t *l;
+	ext4_extent_index_t *m;
+	
+	uint16_t entries_count =
+	    ext4_extent_header_get_entries_count(header);
+	
 	/* Initialize bounds */
 	l = EXT4_EXTENT_FIRST_INDEX(header) + 1;
 	r = EXT4_EXTENT_FIRST_INDEX(header) + entries_count - 1;
-
+	
 	/* Do binary search */
 	while (l <= r) {
 		m = l + (r - l) / 2;
 		uint32_t first_block = ext4_extent_index_get_first_block(m);
-		if (iblock < first_block) {
-				r = m - 1;
-		} else {
-				l = m + 1;
-		}
-	}
-
+		
+		if (iblock < first_block)
+			r = m - 1;
+		else
+			l = m + 1;
+	}
+	
 	/* Set output value */
 	*index = l - 1;
@@ -282,17 +315,21 @@
 
 /** Binary search in extent leaf node.
- * @param header	extent header of leaf node
- * @param extent	output value - found extent will be set here,
- * 					or NULL if node is empty
- * @param iblock	logical block number to find in leaf node
+ *
+ * @param header Extent header of leaf node
+ * @param extent Output value - found extent will be set here,
+ *               or NULL if node is empty
+ * @param iblock Logical block number to find in leaf node
  *
  */
 static void ext4_extent_binsearch(ext4_extent_header_t *header,
-		ext4_extent_t **extent, uint32_t iblock)
-{
-	ext4_extent_t *r, *l, *m;
-
-	uint16_t entries_count = ext4_extent_header_get_entries_count(header);
-
+    ext4_extent_t **extent, uint32_t iblock)
+{
+	ext4_extent_t *r;
+	ext4_extent_t *l;
+	ext4_extent_t *m;
+	
+	uint16_t entries_count =
+	    ext4_extent_header_get_entries_count(header);
+	
 	if (entries_count == 0) {
 		/* this leaf is empty */
@@ -300,20 +337,20 @@
 		return;
 	}
-
+	
 	/* Initialize bounds */
 	l = EXT4_EXTENT_FIRST(header) + 1;
 	r = EXT4_EXTENT_FIRST(header) + entries_count - 1;
-
+	
 	/* Do binary search */
 	while (l <= r) {
 		m = l + (r - l) / 2;
 		uint32_t first_block = ext4_extent_get_first_block(m);
-		if (iblock < first_block) {
-				r = m - 1;
-		} else {
-				l = m + 1;
-		}
-	}
-
+		
+		if (iblock < first_block)
+			r = m - 1;
+		else
+			l = m + 1;
+	}
+	
 	/* Set output value */
 	*extent = l - 1;
@@ -324,23 +361,23 @@
  * There is no need to save path in the tree during this algorithm.
  *
- * @param inode_ref		i-node to load block from
- * @param iblock		logical block number to find
- * @param fblock		output value for physical block number
- * @return				error code
- */
-int ext4_extent_find_block(ext4_inode_ref_t *inode_ref,
-		uint32_t iblock, uint32_t *fblock)
-{
-	int rc;
-
+ * @param inode_ref I-node to load block from
+ * @param iblock    Logical block number to find
+ * @param fblock    Output value for physical block number
+ *
+ * @return Error code
+ *
+ */
+int ext4_extent_find_block(ext4_inode_ref_t *inode_ref, uint32_t iblock,
+    uint32_t *fblock)
+{
 	/* Compute bound defined by i-node size */
-	uint64_t inode_size = ext4_inode_get_size(
-			inode_ref->fs->superblock, inode_ref->inode);
-
-	uint32_t block_size = ext4_superblock_get_block_size(
-			inode_ref->fs->superblock);
-
+	uint64_t inode_size =
+	    ext4_inode_get_size(inode_ref->fs->superblock, inode_ref->inode);
+	
+	uint32_t block_size =
+	    ext4_superblock_get_block_size(inode_ref->fs->superblock);
+	
 	uint32_t last_idx = (inode_size - 1) / block_size;
-
+	
 	/* Check if requested iblock is not over size of i-node */
 	if (iblock > last_idx) {
@@ -348,56 +385,52 @@
 		return EOK;
 	}
-
-	block_t* block = NULL;
-
+	
+	block_t *block = NULL;
+	
 	/* Walk through extent tree */
-	ext4_extent_header_t *header = ext4_inode_get_extent_header(inode_ref->inode);
-
+	ext4_extent_header_t *header =
+	    ext4_inode_get_extent_header(inode_ref->inode);
+	
 	while (ext4_extent_header_get_depth(header) != 0) {
-
 		/* Search index in node */
 		ext4_extent_index_t *index;
 		ext4_extent_binsearch_idx(header, &index, iblock);
-
+		
 		/* Load child node and set values for the next iteration */
 		uint64_t child = ext4_extent_index_get_leaf(index);
-
-		if (block != NULL) {
+		
+		if (block != NULL)
 			block_put(block);
-		}
-
-		rc = block_get(&block, inode_ref->fs->device, child, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
+		
+		int rc = block_get(&block, inode_ref->fs->device, child,
+		    BLOCK_FLAGS_NONE);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		header = (ext4_extent_header_t *)block->data;
 	}
-
+	
 	/* Search extent in the leaf block */
 	ext4_extent_t* extent = NULL;
 	ext4_extent_binsearch(header, &extent, iblock);
-
+	
 	/* Prevent empty leaf */
 	if (extent == NULL) {
 		*fblock = 0;
 	} else {
-
 		/* Compute requested physical block address */
 		uint32_t phys_block;
 		uint32_t first = ext4_extent_get_first_block(extent);
 		phys_block = ext4_extent_get_start(extent) + iblock - first;
-
+		
 		*fblock = phys_block;
 	}
-
+	
 	/* Cleanup */
-	if (block != NULL) {
+	if (block != NULL)
 		block_put(block);
-	}
-
+	
 	return EOK;
 }
-
 
 /** Find extent for specified iblock.
@@ -406,84 +439,82 @@
  * saving the path through the tree for possible future modifications.
  *
- * @param inode_ref		i-node to read extent tree from
- * @param iblock		iblock to find extent for
- * @param ret_path		output value for loaded path from extent tree
- * @return				error code
- */
-static int ext4_extent_find_extent(ext4_inode_ref_t *inode_ref,
-		uint32_t iblock, ext4_extent_path_t **ret_path)
-{
-	int rc;
-
+ * @param inode_ref I-node to read extent tree from
+ * @param iblock    Iblock to find extent for
+ * @param ret_path  Output value for loaded path from extent tree
+ *
+ * @return Error code
+ *
+ */
+static int ext4_extent_find_extent(ext4_inode_ref_t *inode_ref, uint32_t iblock,
+    ext4_extent_path_t **ret_path)
+{
 	ext4_extent_header_t *eh =
-			ext4_inode_get_extent_header(inode_ref->inode);
-
+	    ext4_inode_get_extent_header(inode_ref->inode);
+	
 	uint16_t depth = ext4_extent_header_get_depth(eh);
-
+	
 	ext4_extent_path_t *tmp_path;
-
+	
 	/* Added 2 for possible tree growing */
 	tmp_path = malloc(sizeof(ext4_extent_path_t) * (depth + 2));
-	if (tmp_path == NULL) {
+	if (tmp_path == NULL)
 		return ENOMEM;
-	}
-
+	
 	/* Initialize structure for algorithm start */
 	tmp_path[0].block = inode_ref->block;
 	tmp_path[0].header = eh;
-
+	
 	/* Walk through the extent tree */
 	uint16_t pos = 0;
+	int rc;
 	while (ext4_extent_header_get_depth(eh) != 0) {
-
 		/* Search index in index node by iblock */
-		ext4_extent_binsearch_idx(tmp_path[pos].header, &tmp_path[pos].index, iblock);
-
+		ext4_extent_binsearch_idx(tmp_path[pos].header,
+		    &tmp_path[pos].index, iblock);
+		
 		tmp_path[pos].depth = depth;
 		tmp_path[pos].extent = NULL;
-
+		
 		assert(tmp_path[pos].index != NULL);
-
+		
 		/* Load information for the next iteration */
 		uint64_t fblock = ext4_extent_index_get_leaf(tmp_path[pos].index);
-
+		
 		block_t *block;
-		rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
+		rc = block_get(&block, inode_ref->fs->device, fblock,
+		    BLOCK_FLAGS_NONE);
+		if (rc != EOK)
 			goto cleanup;
-		}
-
+		
 		pos++;
-
+		
 		eh = (ext4_extent_header_t *)block->data;
 		tmp_path[pos].block = block;
 		tmp_path[pos].header = eh;
-
-	}
-
+	}
+	
 	tmp_path[pos].depth = 0;
 	tmp_path[pos].extent = NULL;
 	tmp_path[pos].index = NULL;
-
-    /* Find extent in the leaf node */
+	
+	/* Find extent in the leaf node */
 	ext4_extent_binsearch(tmp_path[pos].header, &tmp_path[pos].extent, iblock);
-
 	*ret_path = tmp_path;
-
+	
 	return EOK;
-
+	
 cleanup:
-	/* Put loaded blocks
+	/*
+	 * Put loaded blocks
 	 * From 1: 0 is a block with inode data
 	 */
 	for (uint16_t i = 1; i < tmp_path->depth; ++i) {
-		if (tmp_path[i].block) {
+		if (tmp_path[i].block)
 			block_put(tmp_path[i].block);
-		}
-	}
-
+	}
+	
 	/* Destroy temporary data structure */
 	free(tmp_path);
-
+	
 	return rc;
 }
@@ -491,23 +522,18 @@
 /** Release extent and all data blocks covered by the extent.
  *
- * @param inode_ref		i-node to release extent and block from
- * @param extent		extent to release
- * @return				error code
- */
-static int ext4_extent_release(
-		ext4_inode_ref_t *inode_ref, ext4_extent_t *extent)
-{
-	int rc;
-
+ * @param inode_ref I-node to release extent and block from
+ * @param extent    Extent to release
+ *
+ * @return Error code
+ *
+ */
+static int ext4_extent_release(ext4_inode_ref_t *inode_ref,
+    ext4_extent_t *extent)
+{
 	/* Compute number of the first physical block to release */
 	uint64_t start = ext4_extent_get_start(extent);
 	uint16_t block_count = ext4_extent_get_block_count(extent);
-
-	rc = ext4_balloc_free_blocks(inode_ref, start, block_count);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	
+	return ext4_balloc_free_blocks(inode_ref, start, block_count);
 }
 
@@ -517,62 +543,57 @@
  * the node. In the leaf node all extents will be released.
  *
- * @param inode_ref		i-node where the branch is released
- * @param index			index in the non-leaf node to be released
- * 						with the whole subtree
- * @return				error code
+ * @param inode_ref I-node where the branch is released
+ * @param index     Index in the non-leaf node to be released
+ *                  with the whole subtree
+ *
+ * @return Error code
+ *
  */
 static int ext4_extent_release_branch(ext4_inode_ref_t *inode_ref,
 		ext4_extent_index_t *index)
 {
-	int rc;
-
+	uint32_t fblock = ext4_extent_index_get_leaf(index);
+	
 	block_t* block;
-
-	uint32_t fblock = ext4_extent_index_get_leaf(index);
-
-	rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
+	int rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	ext4_extent_header_t *header = block->data;
-
+	
 	if (ext4_extent_header_get_depth(header)) {
-
 		/* The node is non-leaf, do recursion */
-
 		ext4_extent_index_t *idx = EXT4_EXTENT_FIRST_INDEX(header);
-
+		
 		/* Release all subbranches */
-		for (uint32_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i, ++idx) {
+		for (uint32_t i = 0;
+		    i < ext4_extent_header_get_entries_count(header);
+		    ++i, ++idx) {
 			rc = ext4_extent_release_branch(inode_ref, idx);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
 		}
 	} else {
-
 		/* Leaf node reached */
 		ext4_extent_t *ext = EXT4_EXTENT_FIRST(header);
-
+		
 		/* Release all extents and stop recursion */
-
-		for (uint32_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i, ++ext) {
+		for (uint32_t i = 0;
+		    i < ext4_extent_header_get_entries_count(header);
+		    ++i, ++ext) {
 			rc = ext4_extent_release(inode_ref, ext);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
 		}
 	}
-
+	
 	/* Release data block where the node was stored */
-
+	
 	rc = block_put(block);
-	if (rc != EOK) {
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	ext4_balloc_free_block(inode_ref, fblock);
-
+	
 	return EOK;
 }
@@ -580,89 +601,85 @@
 /** Release all data blocks starting from specified logical block.
  *
- * @param inode_ref		i-node to release blocks from
- * @param iblock_from	first logical block to release
+ * @param inode_ref   I-node to release blocks from
+ * @param iblock_from First logical block to release
+ *
  */
 int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref,
-		uint32_t iblock_from)
-{
-	int rc = EOK;
-
+    uint32_t iblock_from)
+{
 	/* Find the first extent to modify */
 	ext4_extent_path_t *path;
-	rc = ext4_extent_find_extent(inode_ref, iblock_from, &path);
-	if (rc != EOK) {
+	int rc = ext4_extent_find_extent(inode_ref, iblock_from, &path);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Jump to last item of the path (extent) */
 	ext4_extent_path_t *path_ptr = path;
-	while (path_ptr->depth != 0) {
+	while (path_ptr->depth != 0)
 		path_ptr++;
-	}
-
+	
 	assert(path_ptr->extent != NULL);
-
+	
 	/* First extent maybe released partially */
-	uint32_t first_iblock = ext4_extent_get_first_block(path_ptr->extent);
-	uint32_t first_fblock = ext4_extent_get_start(path_ptr->extent) + iblock_from - first_iblock;
-
-
+	uint32_t first_iblock =
+	    ext4_extent_get_first_block(path_ptr->extent);
+	uint32_t first_fblock =
+	    ext4_extent_get_start(path_ptr->extent) + iblock_from - first_iblock;
+	
 	uint16_t block_count = ext4_extent_get_block_count(path_ptr->extent);
-
-	uint16_t delete_count = block_count - (
-			ext4_extent_get_start(path_ptr->extent) - first_fblock);
-
+	
+	uint16_t delete_count = block_count -
+	    (ext4_extent_get_start(path_ptr->extent) - first_fblock);
+	
 	/* Release all blocks */
 	rc = ext4_balloc_free_blocks(inode_ref, first_fblock, delete_count);
-	if (rc != EOK) {
+	if (rc != EOK)
 		goto cleanup;
-	}
-
+	
 	/* Correct counter */
 	block_count -= delete_count;
 	ext4_extent_set_block_count(path_ptr->extent, block_count);
-
+	
 	/* Initialize the following loop */
-	uint16_t entries = ext4_extent_header_get_entries_count(path_ptr->header);
+	uint16_t entries =
+	    ext4_extent_header_get_entries_count(path_ptr->header);
 	ext4_extent_t *tmp_ext = path_ptr->extent + 1;
 	ext4_extent_t *stop_ext = EXT4_EXTENT_FIRST(path_ptr->header) + entries;
-
+	
 	/* If first extent empty, release it */
-	if (block_count == 0) {
+	if (block_count == 0)
 		entries--;
-	}
-
+	
 	/* Release all successors of the first extent in the same node */
 	while (tmp_ext < stop_ext) {
 		first_fblock = ext4_extent_get_start(tmp_ext);
 		delete_count = ext4_extent_get_block_count(tmp_ext);
-
+		
 		rc = ext4_balloc_free_blocks(inode_ref, first_fblock, delete_count);
-		if (rc != EOK) {
+		if (rc != EOK)
 			goto cleanup;
-		}
-
+		
 		entries--;
 		tmp_ext++;
 	}
-
+	
 	ext4_extent_header_set_entries_count(path_ptr->header, entries);
 	path_ptr->block->dirty = true;
-
+	
 	/* If leaf node is empty, parent entry must be modified */
 	bool remove_parent_record = false;
-
+	
 	/* Don't release root block (including inode data) !!! */
 	if ((path_ptr != path) && (entries == 0)) {
 		rc = ext4_balloc_free_block(inode_ref, path_ptr->block->lba);
-		if (rc != EOK) {
+		if (rc != EOK)
 			goto cleanup;
-		}
+		
 		remove_parent_record = true;
 	}
-
+	
 	/* Jump to the parent */
 	--path_ptr;
-
+	
 	/* Release all successors in all tree levels */
 	while (path_ptr >= path) {
@@ -670,106 +687,101 @@
 		ext4_extent_index_t *index = path_ptr->index + 1;
 		ext4_extent_index_t *stop =
-				EXT4_EXTENT_FIRST_INDEX(path_ptr->header) + entries;
-
+		    EXT4_EXTENT_FIRST_INDEX(path_ptr->header) + entries;
+		
 		/* Correct entries count because of changes in the previous iteration */
-		if (remove_parent_record) {
+		if (remove_parent_record)
 			entries--;
-		}
-
+		
 		/* Iterate over all entries and release the whole subtrees */
 		while (index < stop) {
 			rc = ext4_extent_release_branch(inode_ref, index);
-			if (rc != EOK) {
+			if (rc != EOK)
 				goto cleanup;
-			}
+			
 			++index;
 			--entries;
 		}
-
+		
 		ext4_extent_header_set_entries_count(path_ptr->header, entries);
 		path_ptr->block->dirty = true;
-
+		
 		/* Free the node if it is empty */
 		if ((entries == 0) && (path_ptr != path)) {
 			rc = ext4_balloc_free_block(inode_ref, path_ptr->block->lba);
-			if (rc != EOK) {
+			if (rc != EOK)
 				goto cleanup;
-			}
-
+			
 			/* Mark parent to be checked */
 			remove_parent_record = true;
-		} else {
+		} else
 			remove_parent_record = false;
-		}
-
+		
 		--path_ptr;
 	}
-
-
+	
 cleanup:
-	/* Put loaded blocks
+	/*
+	 * Put loaded blocks
 	 * starting from 1: 0 is a block with inode data
 	 */
 	for (uint16_t i = 1; i <= path->depth; ++i) {
-		if (path[i].block) {
+		if (path[i].block)
 			block_put(path[i].block);
-		}
-	}
-
+	}
+	
 	/* Destroy temporary data structure */
 	free(path);
-
+	
 	return rc;
 }
 
-
 /** Append new extent to the i-node and do some splitting if necessary.
  *
- * @param inode_ref			i-node to append extent to
- * @param path				path in the extent tree for possible splitting
- * @param last_path_item	input/output parameter for pointer to the last
- * 							valid item in the extent tree path
- * @param iblock			logical index of block to append extent for
- * @return					error code
+ * @param inode_ref      I-node to append extent to
+ * @param path           Path in the extent tree for possible splitting
+ * @param last_path_item Input/output parameter for pointer to the last
+ *                       valid item in the extent tree path
+ * @param iblock         Logical index of block to append extent for
+ *
+ * @return Error code
+ *
  */
 static int ext4_extent_append_extent(ext4_inode_ref_t *inode_ref,
-		ext4_extent_path_t *path, uint32_t iblock)
-{
-	int rc;
-
+    ext4_extent_path_t *path, uint32_t iblock)
+{
 	ext4_extent_path_t *path_ptr = path + path->depth;
-
+	
 	uint32_t block_size =
-			ext4_superblock_get_block_size(inode_ref->fs->superblock);
-
+	    ext4_superblock_get_block_size(inode_ref->fs->superblock);
+	
 	/* Start splitting */
 	while (path_ptr > path) {
-
-		uint16_t entries = ext4_extent_header_get_entries_count(path_ptr->header);
-		uint16_t limit = ext4_extent_header_get_max_entries_count(path_ptr->header);
-
+		uint16_t entries =
+		    ext4_extent_header_get_entries_count(path_ptr->header);
+		uint16_t limit =
+		    ext4_extent_header_get_max_entries_count(path_ptr->header);
+		
 		if (entries == limit) {
-
 			/* Full node - allocate block for new one */
 			uint32_t fblock;
-			rc = ext4_balloc_alloc_block(inode_ref, &fblock);
-			if (rc != EOK) {
+			int rc = ext4_balloc_alloc_block(inode_ref, &fblock);
+			if (rc != EOK)
 				return rc;
-			}
-
+			
 			block_t *block;
-			rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NOREAD);
+			rc = block_get(&block, inode_ref->fs->device, fblock,
+			    BLOCK_FLAGS_NOREAD);
 			if (rc != EOK) {
 				ext4_balloc_free_block(inode_ref, fblock);
 				return rc;
 			}
-
+			
 			/* Put back not modified old block */
 			block_put(path_ptr->block);
-
+			
 			/* Initialize newly allocated block and remember it */
 			memset(block->data, 0, block_size);
 			path_ptr->block = block;
-
+			
 			/* Update pointers in extent path structure */
 			path_ptr->header = block->data;
@@ -779,12 +791,12 @@
 				ext4_extent_index_set_leaf(path_ptr->index, (path_ptr + 1)->block->lba);
 				limit = (block_size - sizeof(ext4_extent_header_t)) /
-									sizeof(ext4_extent_index_t);
+				    sizeof(ext4_extent_index_t);
 			} else {
 				path_ptr->extent = EXT4_EXTENT_FIRST(path_ptr->header);
 				ext4_extent_set_first_block(path_ptr->extent, iblock);
 				limit = (block_size - sizeof(ext4_extent_header_t)) /
-									sizeof(ext4_extent_t);
+				    sizeof(ext4_extent_t);
 			}
-
+			
 			/* Initialize on-disk structure (header) */
 			ext4_extent_header_set_entries_count(path_ptr->header, 1);
@@ -793,12 +805,10 @@
 			ext4_extent_header_set_depth(path_ptr->header, path_ptr->depth);
 			ext4_extent_header_set_generation(path_ptr->header, 0);
-
+			
 			path_ptr->block->dirty = true;
-
+			
 			/* Jump to the preceeding item */
 			path_ptr--;
-
 		} else {
-
 			/* Node with free space */
 			if (path_ptr->depth) {
@@ -810,65 +820,61 @@
 				ext4_extent_set_first_block(path_ptr->extent, iblock);
 			}
-
+			
 			ext4_extent_header_set_entries_count(path_ptr->header, entries + 1);
 			path_ptr->block->dirty = true;
-
+			
 			/* No more splitting needed */
 			return EOK;
 		}
-
-	}
-
+	}
+	
 	assert(path_ptr == path);
-
+	
 	/* Should be the root split too? */
-
+	
 	uint16_t entries = ext4_extent_header_get_entries_count(path->header);
 	uint16_t limit = ext4_extent_header_get_max_entries_count(path->header);
-
+	
 	if (entries == limit) {
-
 		uint32_t new_fblock;
-		rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
-		if (rc != EOK) {
+		int rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		block_t *block;
-		rc = block_get(&block, inode_ref->fs->device,
-				new_fblock, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK) {
+		rc = block_get(&block, inode_ref->fs->device, new_fblock,
+		    BLOCK_FLAGS_NOREAD);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		/* Initialize newly allocated block */
 		memset(block->data, 0, block_size);
-
+		
 		/* Move data from root to the new block */
 		memcpy(block->data, inode_ref->inode->blocks,
-				EXT4_INODE_BLOCKS * sizeof(uint32_t));
-
-		// Data block initialized !!!
-
+		    EXT4_INODE_BLOCKS * sizeof(uint32_t));
+		
+		/* Data block is initialized */
+		
 		block_t *root_block = path->block;
 		uint16_t root_depth = path->depth;
 		ext4_extent_header_t *root_header = path->header;
-
+		
 		/* Make space for tree growing */
 		ext4_extent_path_t *new_root = path;
 		ext4_extent_path_t *old_root = path + 1;
-
+		
 		size_t nbytes = sizeof(ext4_extent_path_t) * (path->depth + 1);
 		memmove(old_root, new_root, nbytes);
 		memset(new_root, 0, sizeof(ext4_extent_path_t));
-
+		
 		/* Update old root structure */
 		old_root->block = block;
 		old_root->header = (ext4_extent_header_t *)block->data;
-
+		
 		/* Add new entry and update limit for entries */
 		if (old_root->depth) {
 			limit = (block_size - sizeof(ext4_extent_header_t)) /
-								sizeof(ext4_extent_index_t);
+			    sizeof(ext4_extent_index_t);
 			old_root->index = EXT4_EXTENT_FIRST_INDEX(old_root->header) + entries;
 			ext4_extent_index_set_first_block(old_root->index, iblock);
@@ -877,14 +883,15 @@
 		} else {
 			limit = (block_size - sizeof(ext4_extent_header_t)) /
-								sizeof(ext4_extent_t);
+			    sizeof(ext4_extent_t);
 			old_root->extent = EXT4_EXTENT_FIRST(old_root->header) + entries;
 			ext4_extent_set_first_block(old_root->extent, iblock);
 			old_root->index = NULL;
 		}
+		
 		ext4_extent_header_set_entries_count(old_root->header, entries + 1);
 		ext4_extent_header_set_max_entries_count(old_root->header, limit);
-
+		
 		old_root->block->dirty = true;
-
+		
 		/* Re-initialize new root metadata */
 		new_root->depth = root_depth + 1;
@@ -893,16 +900,14 @@
 		new_root->extent = NULL;
 		new_root->index = EXT4_EXTENT_FIRST_INDEX(new_root->header);
-
+		
 		ext4_extent_header_set_depth(new_root->header, new_root->depth);
-
+		
 		/* Create new entry in root */
 		ext4_extent_header_set_entries_count(new_root->header, 1);
 		ext4_extent_index_set_first_block(new_root->index, 0);
 		ext4_extent_index_set_leaf(new_root->index, new_fblock);
-
+		
 		new_root->block->dirty = true;
-
 	} else {
-
 		if (path->depth) {
 			path->index = EXT4_EXTENT_FIRST_INDEX(path->header) + entries;
@@ -913,9 +918,9 @@
 			ext4_extent_set_first_block(path->extent, iblock);
 		}
-
+		
 		ext4_extent_header_set_entries_count(path->header, entries + 1);
 		path->block->dirty = true;
 	}
-
+	
 	return EOK;
 }
@@ -927,67 +932,59 @@
  * It includes possible extent tree modifications (splitting).
  *<
- * @param inode_ref			i-node to append block to
- * @param iblock			output logical number of newly allocated block
- * @param fblock			output physical block address of newly allocated block
- * @return					error code
- */
-int ext4_extent_append_block(ext4_inode_ref_t *inode_ref,
-		uint32_t *iblock, uint32_t *fblock, bool update_size)
-{
-	int rc = EOK;
-
+ * @param inode_ref I-node to append block to
+ * @param iblock    Output logical number of newly allocated block
+ * @param fblock    Output physical block address of newly allocated block
+ *
+ * @return Error code
+ *
+ */
+int ext4_extent_append_block(ext4_inode_ref_t *inode_ref, uint32_t *iblock,
+    uint32_t *fblock, bool update_size)
+{
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
 	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Calculate number of new logical block */
 	uint32_t new_block_idx = 0;
 	if (inode_size > 0) {
-		if ((inode_size % block_size) != 0) {
+		if ((inode_size % block_size) != 0)
 			inode_size += block_size - (inode_size % block_size);
-		}
+		
 		new_block_idx = inode_size / block_size;
 	}
-
+	
 	/* Load the nearest leaf (with extent) */
 	ext4_extent_path_t *path;
-	rc = ext4_extent_find_extent(inode_ref, new_block_idx, &path);
-	if (rc != EOK) {
+	int rc = ext4_extent_find_extent(inode_ref, new_block_idx, &path);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Jump to last item of the path (extent) */
 	ext4_extent_path_t *path_ptr = path;
-	while (path_ptr->depth != 0) {
+	while (path_ptr->depth != 0)
 		path_ptr++;
-	}
-
+	
 	/* Add new extent to the node if not present */
-	if (path_ptr->extent == NULL) {
+	if (path_ptr->extent == NULL)
 		goto append_extent;
-	}
-
+	
 	uint16_t block_count = ext4_extent_get_block_count(path_ptr->extent);
 	uint16_t block_limit = (1 << 15);
-
+	
 	uint32_t phys_block = 0;
 	if (block_count < block_limit) {
-
 		/* There is space for new block in the extent */
-
 		if (block_count == 0) {
-
 			/* Existing extent is empty */
-
 			rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
-			if (rc != EOK) {
+			if (rc != EOK)
 				goto finish;
-			}
-
+			
 			/* Initialize extent */
 			ext4_extent_set_first_block(path_ptr->extent, new_block_idx);
 			ext4_extent_set_start(path_ptr->extent, phys_block);
 			ext4_extent_set_block_count(path_ptr->extent, 1);
-
+			
 			/* Update i-node */
 			if (update_size) {
@@ -995,31 +992,27 @@
 				inode_ref->dirty = true;
 			}
-
+			
 			path_ptr->block->dirty = true;
-
+			
 			goto finish;
 		} else {
-
 			/* Existing extent contains some blocks */
-
 			phys_block = ext4_extent_get_start(path_ptr->extent);
 			phys_block += ext4_extent_get_block_count(path_ptr->extent);
-
+			
 			/* Check if the following block is free for allocation */
 			bool free;
 			rc = ext4_balloc_try_alloc_block(inode_ref, phys_block, &free);
-			if (rc != EOK) {
+			if (rc != EOK)
 				goto finish;
-			}
-
-			if (! free) {
-				/* target is not free, new block must be appended to new extent */
+			
+			if (!free) {
+				/* Target is not free, new block must be appended to new extent */
 				goto append_extent;
 			}
-
-
+			
 			/* Update extent */
 			ext4_extent_set_block_count(path_ptr->extent, block_count + 1);
-
+			
 			/* Update i-node */
 			if (update_size) {
@@ -1027,22 +1020,21 @@
 				inode_ref->dirty = true;
 			}
-
+			
 			path_ptr->block->dirty = true;
-
+			
 			goto finish;
 		}
 	}
-
-/* Append new extent to the tree */
+	
+	
 append_extent:
-
+	/* Append new extent to the tree */
 	phys_block = 0;
-
+	
 	/* Allocate new data block */
 	rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
-	if (rc != EOK) {
+	if (rc != EOK)
 		goto finish;
-	}
-
+	
 	/* Append extent for new block (includes tree splitting if needed) */
 	rc = ext4_extent_append_extent(inode_ref, path, new_block_idx);
@@ -1051,13 +1043,13 @@
 		goto finish;
 	}
-
+	
 	uint32_t tree_depth = ext4_extent_header_get_depth(path->header);
 	path_ptr = path + tree_depth;
-
+	
 	/* Initialize newly created extent */
 	ext4_extent_set_block_count(path_ptr->extent, 1);
 	ext4_extent_set_first_block(path_ptr->extent, new_block_idx);
 	ext4_extent_set_start(path_ptr->extent, phys_block);
-
+	
 	/* Update i-node */
 	if (update_size) {
@@ -1065,25 +1057,24 @@
 		inode_ref->dirty = true;
 	}
-
+	
 	path_ptr->block->dirty = true;
-
-
+	
 finish:
 	/* Set return values */
 	*iblock = new_block_idx;
 	*fblock = phys_block;
-
-	/* Put loaded blocks
+	
+	/*
+	 * Put loaded blocks
 	 * starting from 1: 0 is a block with inode data
 	 */
 	for (uint16_t i = 1; i <= path->depth; ++i) {
-		if (path[i].block) {
+		if (path[i].block)
 			block_put(path[i].block);
-		}
-	}
-
+	}
+	
 	/* Destroy temporary data structure */
 	free(path);
-
+	
 	return rc;
 }
@@ -1091,3 +1082,3 @@
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_extent.h
===================================================================
--- uspace/lib/ext4/libext4_extent.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_extent.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_EXTENT_H_
@@ -52,8 +52,8 @@
 extern uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *);
 extern void ext4_extent_header_set_entries_count(ext4_extent_header_t *,
-		uint16_t);
+    uint16_t);
 extern uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *);
 extern void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *,
-		uint16_t);
+    uint16_t);
 extern uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *);
 extern void ext4_extent_header_set_depth(ext4_extent_header_t *, uint16_t);
@@ -64,5 +64,6 @@
 extern int ext4_extent_release_blocks_from(ext4_inode_ref_t *, uint32_t);
 
-extern int ext4_extent_append_block(ext4_inode_ref_t *, uint32_t *, uint32_t *, bool);
+extern int ext4_extent_append_block(ext4_inode_ref_t *, uint32_t *, uint32_t *,
+    bool);
 
 #endif
Index: uspace/lib/ext4/libext4_filesystem.c
===================================================================
--- uspace/lib/ext4/libext4_filesystem.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_filesystem.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_filesystem.c
- * @brief	More complex filesystem operations.
+ * @file  libext4_filesystem.c
+ * @brief More complex filesystem operations.
  */
 
@@ -43,21 +42,20 @@
 /** Initialize filesystem and read all needed data.
  *
- * @param fs				filesystem instance to be initialized
- * @param service_id		identifier if device with the filesystem
- * @return					error code
+ * @param fs         Filesystem instance to be initialized
+ * @param service_id Identifier if device with the filesystem
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_init(ext4_filesystem_t *fs, service_id_t service_id,
-		enum cache_mode cmode)
-{
-	int rc;
-
+    enum cache_mode cmode)
+{
 	fs->device = service_id;
-
+	
 	/* Initialize block library (4096 is size of communication channel) */
-	rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
-	if (rc != EOK) {
+	int rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Read superblock from device to memory */
 	ext4_superblock_t *temp_superblock;
@@ -67,5 +65,5 @@
 		return rc;
 	}
-
+	
 	/* Read block size from superblock and check */
 	uint32_t block_size = ext4_superblock_get_block_size(temp_superblock);
@@ -74,5 +72,5 @@
 		return ENOTSUP;
 	}
-
+	
 	/* Initialize block caching by libblock */
 	rc = block_cache_init(service_id, block_size, 0, cmode);
@@ -81,21 +79,21 @@
 		return rc;
 	}
-
+	
 	/* Compute limits for indirect block levels */
 	uint32_t block_ids_per_block = block_size / sizeof(uint32_t);
 	fs->inode_block_limits[0] = EXT4_INODE_DIRECT_BLOCK_COUNT;
 	fs->inode_blocks_per_level[0] = 1;
-	for (int i = 1; i < 4; i++) {
-		fs->inode_blocks_per_level[i] = fs->inode_blocks_per_level[i-1] *
+	for (unsigned int i = 1; i < 4; i++) {
+		fs->inode_blocks_per_level[i] = fs->inode_blocks_per_level[i - 1] *
 		    block_ids_per_block;
-		fs->inode_block_limits[i] = fs->inode_block_limits[i-1] +
-				fs->inode_blocks_per_level[i];
-	}
-
+		fs->inode_block_limits[i] = fs->inode_block_limits[i - 1] +
+		    fs->inode_blocks_per_level[i];
+	}
+	
 	/* Return loaded superblock */
 	fs->superblock = temp_superblock;
-
+	
 	uint16_t state = ext4_superblock_get_state(fs->superblock);
-
+	
 	if (state != EXT4_SUPERBLOCK_STATE_VALID_FS) {
 		block_cache_fini(fs->device);
@@ -103,5 +101,5 @@
 		return ENOTSUP;
 	}
-
+	
 	/* Mark system as mounted */
 	ext4_superblock_set_state(fs->superblock, EXT4_SUPERBLOCK_STATE_ERROR_FS);
@@ -112,8 +110,8 @@
 		return rc;
 	}
-
+	
 	uint16_t mnt_count = ext4_superblock_get_mount_count(fs->superblock);
 	ext4_superblock_set_mount_count(fs->superblock, mnt_count + 1);
-
+	
 	return EOK;
 }
@@ -121,23 +119,22 @@
 /** Destroy filesystem instance (used by unmount operation).
  *
- * @param fs		filesystem to be destroyed
- * @param write_sb	flag if superblock should be written to device
- * @return			error code
+ * @param fs Filesystem to be destroyed
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_fini(ext4_filesystem_t *fs)
 {
-	int rc = EOK;
-
 	/* Write the superblock to the device */
 	ext4_superblock_set_state(fs->superblock, EXT4_SUPERBLOCK_STATE_VALID_FS);
-	rc = ext4_superblock_write_direct(fs->device, fs->superblock);
-
+	int rc = ext4_superblock_write_direct(fs->device, fs->superblock);
+	
 	/* Release memory space for superblock */
 	free(fs->superblock);
-
+	
 	/* Finish work with block library */
 	block_cache_fini(fs->device);
 	block_fini(fs->device);
-
+	
 	return rc;
 }
@@ -147,18 +144,13 @@
  * Main is the check of the superblock structure.
  *
- * @param fs		filesystem to be checked
- * @return			error code
+ * @param fs Filesystem to be checked
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_check_sanity(ext4_filesystem_t *fs)
 {
-	int rc;
-
 	/* Check superblock */
-	rc = ext4_superblock_check_sanity(fs->superblock);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	return ext4_superblock_check_sanity(fs->superblock);
 }
 
@@ -169,7 +161,9 @@
  * during some write operations.
  *
- * @param fs			filesystem to be checked
- * @param read_only		flag if filesystem should be mounted only for reading
- * @return				error code
+ * @param fs        Filesystem to be checked
+ * @param read_only Flag if filesystem should be mounted only for reading
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_check_features(ext4_filesystem_t *fs, bool *read_only)
@@ -180,20 +174,23 @@
 		return EOK;
 	}
-
-	/* Check incompatible features - if filesystem has some,
+	
+	/*
+	 * Check incompatible features - if filesystem has some,
 	 * volume can't be mounted
 	 */
 	uint32_t incompatible_features;
-	incompatible_features = ext4_superblock_get_features_incompatible(fs->superblock);
+	incompatible_features =
+	    ext4_superblock_get_features_incompatible(fs->superblock);
 	incompatible_features &= ~EXT4_FEATURE_INCOMPAT_SUPP;
-	if (incompatible_features > 0) {
+	if (incompatible_features > 0)
 		return ENOTSUP;
-	}
-
-	/* Check read-only features, if filesystem has some,
+	
+	/*
+	 * Check read-only features, if filesystem has some,
 	 * volume can be mount only in read-only mode
 	 */
 	uint32_t compatible_read_only;
-	compatible_read_only = ext4_superblock_get_features_read_only(fs->superblock);
+	compatible_read_only =
+	    ext4_superblock_get_features_read_only(fs->superblock);
 	compatible_read_only &= ~EXT4_FEATURE_RO_COMPAT_SUPP;
 	if (compatible_read_only > 0) {
@@ -201,5 +198,5 @@
 		return EOK;
 	}
-
+	
 	return EOK;
 }
@@ -208,20 +205,21 @@
 /** Convert block address to relative index in block group.
  *
- * @param sb			superblock pointer
- * @param block_addr	block number to convert
- * @return				relative number of block
+ * @param sb         Superblock pointer
+ * @param block_addr Block number to convert
+ *
+ * @return Relative number of block
+ *
  */
 uint32_t ext4_filesystem_blockaddr2_index_in_group(ext4_superblock_t *sb,
-		uint32_t block_addr)
+    uint32_t block_addr)
 {
 	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
 	uint32_t first_block = ext4_superblock_get_first_data_block(sb);
-
+	
 	/* First block == 0 or 1 */
-	if (first_block == 0) {
+	if (first_block == 0)
 		return block_addr % blocks_per_group;
-	} else {
+	else
 		return (block_addr - 1) % blocks_per_group;
-	}
 }
 
@@ -229,169 +227,151 @@
 /** Convert relative block address in group to absolute address.
  *
- * @param sb			superblock pointer
- * @param block_addr	block number to convert
- * @return				absolute block address
+ * @param sb Superblock pointer
+ *
+ * @return Absolute block address
+ *
  */
 uint32_t ext4_filesystem_index_in_group2blockaddr(ext4_superblock_t *sb,
-		uint32_t index, uint32_t bgid)
+    uint32_t index, uint32_t bgid)
 {
 	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-
-	if (ext4_superblock_get_first_data_block(sb) == 0) {
+	
+	if (ext4_superblock_get_first_data_block(sb) == 0)
 		return bgid * blocks_per_group + index;
-	} else {
+	else
 		return bgid * blocks_per_group + index + 1;
-	}
-
 }
 
 /** Initialize block bitmap in block group.
- * 
- * @param bg_ref	reference to block group
- * @return			error code
+ *
+ * @param bg_ref Reference to block group
+ *
+ * @return Error code
+ *
  */
 static int ext4_filesystem_init_block_bitmap(ext4_block_group_ref_t *bg_ref)
 {
-	int rc;
-
 	/* Load bitmap */
 	uint32_t bitmap_block_addr = ext4_block_group_get_block_bitmap(
-			bg_ref->block_group, bg_ref->fs->superblock);
+	    bg_ref->block_group, bg_ref->fs->superblock);
+	
 	block_t *bitmap_block;
-
-	rc = block_get(&bitmap_block, bg_ref->fs->device,
-			bitmap_block_addr, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK) {
+	int rc = block_get(&bitmap_block, bg_ref->fs->device,
+	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	uint8_t *bitmap = bitmap_block->data;
-
+	
 	/* Initialize all bitmap bits to zero */
 	uint32_t block_size = ext4_superblock_get_block_size(bg_ref->fs->superblock);
 	memset(bitmap, 0, block_size);
-
+	
 	/* Determine first block and first data block in group */
 	uint32_t first_idx = 0;
-
+	
 	uint32_t first_data = ext4_balloc_get_first_data_block_in_group(
-			bg_ref->fs->superblock, bg_ref);
+	    bg_ref->fs->superblock, bg_ref);
 	uint32_t first_data_idx = ext4_filesystem_blockaddr2_index_in_group(
-			bg_ref->fs->superblock, first_data);
-
+	    bg_ref->fs->superblock, first_data);
+	
 	/* Set bits from to first block to first data block - 1 to one (allocated) */
-	for (uint32_t block = first_idx; block < first_data_idx; ++block) {
+	for (uint32_t block = first_idx; block < first_data_idx; ++block)
 		ext4_bitmap_set_bit(bitmap, block);
-	}
-
+	
 	bitmap_block->dirty = true;
-
+	
 	/* Save bitmap */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	return block_put(bitmap_block);
 }
 
 /** Initialize i-node bitmap in block group.
- * 
- * @param bg_ref	reference to block group
- * @return			error code
+ *
+ * @param bg_ref Reference to block group
+ *
+ * @return Error code
+ *
  */
 static int ext4_filesystem_init_inode_bitmap(ext4_block_group_ref_t *bg_ref)
 {
-	int rc;
-
 	/* Load bitmap */
 	uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
-			bg_ref->block_group, bg_ref->fs->superblock);
+	    bg_ref->block_group, bg_ref->fs->superblock);
 	block_t *bitmap_block;
-
-	rc = block_get(&bitmap_block, bg_ref->fs->device,
-			bitmap_block_addr, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK) {
+	
+	int rc = block_get(&bitmap_block, bg_ref->fs->device,
+	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	uint8_t *bitmap = bitmap_block->data;
-
+	
 	/* Initialize all bitmap bits to zero */
 	uint32_t block_size = ext4_superblock_get_block_size(bg_ref->fs->superblock);
 	uint32_t inodes_per_group =
-			ext4_superblock_get_inodes_per_group(bg_ref->fs->superblock);
+	    ext4_superblock_get_inodes_per_group(bg_ref->fs->superblock);
 	memset(bitmap, 0, (inodes_per_group + 7) / 8);
-
+	
 	uint32_t start_bit = inodes_per_group;
 	uint32_t end_bit = block_size * 8;
-
+	
 	uint32_t i;
-	for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++) {
+	for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
 		ext4_bitmap_set_bit(bitmap, i);
-	}
-
-	if (i < end_bit) {
+	
+	if (i < end_bit)
 		memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
-	}
-
+	
 	bitmap_block->dirty = true;
-
+	
 	/* Save bitmap */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	return block_put(bitmap_block);
 }
 
 /** Initialize i-node table in block group.
- * 
- * @param bg_ref	reference to block group
- * @return			error code
+ *
+ * @param bg_ref Reference to block group
+ *
+ * @return Error code
+ *
  */
 static int ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
 {
-	int rc;
-
 	ext4_superblock_t *sb = bg_ref->fs->superblock;
-
+	
 	uint32_t inode_size = ext4_superblock_get_inode_size(sb);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
 	uint32_t inodes_per_block = block_size / inode_size;
-
+	
 	uint32_t inodes_in_group =
-			ext4_superblock_get_inodes_in_group(sb, bg_ref->index);
-
+	    ext4_superblock_get_inodes_in_group(sb, bg_ref->index);
+	
 	uint32_t table_blocks = inodes_in_group / inodes_per_block;
-
-	if (inodes_in_group % inodes_per_block) {
+	
+	if (inodes_in_group % inodes_per_block)
 		table_blocks++;
-	}
-
+	
 	/* Compute initialization bounds */
 	uint32_t first_block = ext4_block_group_get_inode_table_first_block(
-			bg_ref->block_group, sb);
-
+	    bg_ref->block_group, sb);
+	
 	uint32_t last_block = first_block + table_blocks - 1;
-
+	
 	/* Initialization of all itable blocks */
 	for (uint32_t fblock = first_block; fblock <= last_block; ++fblock) {
 		block_t *block;
-		rc = block_get(&block, bg_ref->fs->device, fblock, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = block_get(&block, bg_ref->fs->device, fblock,
+		    BLOCK_FLAGS_NOREAD);
+		if (rc != EOK)
+			return rc;
+		
 		memset(block->data, 0, block_size);
 		block->dirty = true;
-
+		
 		rc = block_put(block);
-		if (rc != EOK) {
-			return rc;
-		}
-	}
-
+		if (rc != EOK)
+			return rc;
+	}
+	
 	return EOK;
 }
@@ -399,38 +379,41 @@
 /** Get reference to block group specified by index.
  *
- * @param fs		filesystem to find block group on
- * @param bgid		index of block group to load
- * @param ref		output pointer for reference
- * @return			error code
+ * @param fs   Filesystem to find block group on
+ * @param bgid Index of block group to load
+ * @param ref  Output pointer for reference
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
     ext4_block_group_ref_t **ref)
 {
-	int rc;
-
 	/* Allocate memory for new structure */
-	ext4_block_group_ref_t *newref = malloc(sizeof(ext4_block_group_ref_t));
-	if (newref == NULL) {
+	ext4_block_group_ref_t *newref =
+	    malloc(sizeof(ext4_block_group_ref_t));
+	if (newref == NULL)
 		return ENOMEM;
-	}
-
+	
 	/* Compute number of descriptors, that fits in one data block */
-	uint32_t descriptors_per_block = ext4_superblock_get_block_size(fs->superblock)
-	    / ext4_superblock_get_desc_size(fs->superblock);
-
+	uint32_t descriptors_per_block =
+	    ext4_superblock_get_block_size(fs->superblock) /
+	    ext4_superblock_get_desc_size(fs->superblock);
+	
 	/* Block group descriptor table starts at the next block after superblock */
-	aoff64_t block_id = ext4_superblock_get_first_data_block(fs->superblock) + 1;
-
+	aoff64_t block_id =
+	    ext4_superblock_get_first_data_block(fs->superblock) + 1;
+	
 	/* Find the block containing the descriptor we are looking for */
 	block_id += bgid / descriptors_per_block;
-	uint32_t offset = (bgid % descriptors_per_block) * ext4_superblock_get_desc_size(fs->superblock);
-
+	uint32_t offset = (bgid % descriptors_per_block) *
+	    ext4_superblock_get_desc_size(fs->superblock);
+	
 	/* Load block with descriptors */
-	rc = block_get(&newref->block, fs->device, block_id, 0);
+	int rc = block_get(&newref->block, fs->device, block_id, 0);
 	if (rc != EOK) {
 		free(newref);
 		return rc;
 	}
-
+	
 	/* Inititialize in-memory representation */
 	newref->block_group = newref->block->data + offset;
@@ -438,10 +421,9 @@
 	newref->index = bgid;
 	newref->dirty = false;
-
+	
 	*ref = newref;
-
+	
 	if (ext4_block_group_has_flag(newref->block_group,
-			EXT4_BLOCK_GROUP_BLOCK_UNINIT)) {
-
+	    EXT4_BLOCK_GROUP_BLOCK_UNINIT)) {
 		rc = ext4_filesystem_init_block_bitmap(newref);
 		if (rc != EOK) {
@@ -450,13 +432,13 @@
 			return rc;
 		}
+		
 		ext4_block_group_clear_flag(newref->block_group,
-				EXT4_BLOCK_GROUP_BLOCK_UNINIT);
-
+		    EXT4_BLOCK_GROUP_BLOCK_UNINIT);
+		
 		newref->dirty = true;
 	}
-
+	
 	if (ext4_block_group_has_flag(newref->block_group,
-			EXT4_BLOCK_GROUP_INODE_UNINIT)) {
-
+	    EXT4_BLOCK_GROUP_INODE_UNINIT)) {
 		rc = ext4_filesystem_init_inode_bitmap(newref);
 		if (rc != EOK) {
@@ -465,24 +447,21 @@
 			return rc;
 		}
-
+		
 		ext4_block_group_clear_flag(newref->block_group,
-				EXT4_BLOCK_GROUP_INODE_UNINIT);
-
-		if (! ext4_block_group_has_flag(newref->block_group,
-				EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
-
+		    EXT4_BLOCK_GROUP_INODE_UNINIT);
+		
+		if (!ext4_block_group_has_flag(newref->block_group,
+		    EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
 			rc = ext4_filesystem_init_inode_table(newref);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
+			
 			ext4_block_group_set_flag(newref->block_group,
-					EXT4_BLOCK_GROUP_ITABLE_ZEROED);
-
+			    EXT4_BLOCK_GROUP_ITABLE_ZEROED);
 		}
+		
 		newref->dirty = true;
-
-	}
-
+	}
+	
 	return EOK;
 }
@@ -492,75 +471,76 @@
  * It uses crc functions from Linux kernel implementation.
  *
- * @param sb		superblock
- * @param bgid		index of block group in the filesystem
- * @param bg		block group to compute checksum for
- * @return			checksum value
+ * @param sb   Superblock
+ * @param bgid Index of block group in the filesystem
+ * @param bg   Block group to compute checksum for
+ *
+ * @return Checksum value
+ *
  */
 static uint16_t ext4_filesystem_bg_checksum(ext4_superblock_t *sb, uint32_t bgid,
-                            ext4_block_group_t *bg)
+    ext4_block_group_t *bg)
 {
 	/* If checksum not supported, 0 will be returned */
 	uint16_t crc = 0;
-
+	
 	/* Compute the checksum only if the filesystem supports it */
-	if (ext4_superblock_has_feature_read_only(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
-
+	if (ext4_superblock_has_feature_read_only(sb,
+	    EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
 		void *base = bg;
 		void *checksum = &bg->checksum;
-
-		uint32_t offset = (uint32_t)(checksum - base);
-
+		
+		uint32_t offset = (uint32_t) (checksum - base);
+		
 		/* Convert block group index to little endian */
 		uint32_t le_group = host2uint32_t_le(bgid);
-
+		
 		/* Initialization */
 		crc = crc16(~0, sb->uuid, sizeof(sb->uuid));
-
+		
 		/* Include index of block group */
-		crc = crc16(crc, (uint8_t *)&le_group, sizeof(le_group));
-
+		crc = crc16(crc, (uint8_t *) &le_group, sizeof(le_group));
+		
 		/* Compute crc from the first part (stop before checksum field) */
-		crc = crc16(crc, (uint8_t *)bg, offset);
-
+		crc = crc16(crc, (uint8_t *) bg, offset);
+		
 		/* Skip checksum */
 		offset += sizeof(bg->checksum);
-
+		
 		/* Checksum of the rest of block group descriptor */
-		if ((ext4_superblock_has_feature_incompatible(sb, EXT4_FEATURE_INCOMPAT_64BIT)) &&
-			offset < ext4_superblock_get_desc_size(sb)) {
-
-			crc = crc16(crc, ((uint8_t *)bg) + offset, ext4_superblock_get_desc_size(sb) - offset);
-		}
-	}
-
+		if ((ext4_superblock_has_feature_incompatible(sb,
+		    EXT4_FEATURE_INCOMPAT_64BIT)) &&
+		    (offset < ext4_superblock_get_desc_size(sb)))
+			crc = crc16(crc, ((uint8_t *) bg) + offset,
+			    ext4_superblock_get_desc_size(sb) - offset);
+	}
+	
 	return crc;
-
 }
 
 /** Put reference to block group.
  *
- * @oaram ref		pointer for reference to be put back
- * @return			error code
+ * @oaram ref Pointer for reference to be put back
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *ref)
 {
-	int rc;
-
 	/* Check if reference modified */
 	if (ref->dirty) {
-
 		/* Compute new checksum of block group */
-		uint16_t checksum = ext4_filesystem_bg_checksum(
-				ref->fs->superblock, ref->index, ref->block_group);
+		uint16_t checksum =
+		    ext4_filesystem_bg_checksum(ref->fs->superblock, ref->index,
+		    ref->block_group);
 		ext4_block_group_set_checksum(ref->block_group, checksum);
-
+		
 		/* Mark block dirty for writing changes to physical device */
 		ref->block->dirty = true;
 	}
-
+	
 	/* Put back block, that contains block group descriptor */
-	rc = block_put(ref->block);
+	int rc = block_put(ref->block);
 	free(ref);
-
+	
 	return rc;
 }
@@ -568,25 +548,26 @@
 /** Get reference to i-node specified by index.
  *
- * @param fs		filesystem to find i-node on
- * @param index		index of i-node to load
- * @oaram ref		output pointer for reference
- * @return			error code
+ * @param fs    Filesystem to find i-node on
+ * @param index Index of i-node to load
+ * @oaram ref   Output pointer for reference
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_get_inode_ref(ext4_filesystem_t *fs, uint32_t index,
     ext4_inode_ref_t **ref)
 {
-	int rc;
-
 	/* Allocate memory for new structure */
-	ext4_inode_ref_t *newref = malloc(sizeof(ext4_inode_ref_t));
-	if (newref == NULL) {
+	ext4_inode_ref_t *newref =
+	    malloc(sizeof(ext4_inode_ref_t));
+	if (newref == NULL)
 		return ENOMEM;
-	}
-
+	
 	/* Compute number of i-nodes, that fits in one data block */
 	uint32_t inodes_per_group =
-			ext4_superblock_get_inodes_per_group(fs->superblock);
-
-	/* Inode numbers are 1-based, but it is simpler to work with 0-based
+	    ext4_superblock_get_inodes_per_group(fs->superblock);
+	
+	/*
+	 * Inode numbers are 1-based, but it is simpler to work with 0-based
 	 * when computing indices
 	 */
@@ -594,17 +575,18 @@
 	uint32_t block_group = index / inodes_per_group;
 	uint32_t offset_in_group = index % inodes_per_group;
-
+	
 	/* Load block group, where i-node is located */
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
 	if (rc != EOK) {
 		free(newref);
 		return rc;
 	}
-
+	
 	/* Load block address, where i-node table is located */
-	uint32_t inode_table_start = ext4_block_group_get_inode_table_first_block(
-	    bg_ref->block_group, fs->superblock);
-
+	uint32_t inode_table_start =
+	    ext4_block_group_get_inode_table_first_block(bg_ref->block_group,
+	    fs->superblock);
+	
 	/* Put back block group reference (not needed more) */
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
@@ -613,10 +595,10 @@
 		return rc;
 	}
-
+	
 	/* Compute position of i-node in the block group */
 	uint16_t inode_size = ext4_superblock_get_inode_size(fs->superblock);
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
 	uint32_t byte_offset_in_group = offset_in_group * inode_size;
-
+	
 	/* Compute block address */
 	aoff64_t block_id = inode_table_start + (byte_offset_in_group / block_size);
@@ -626,16 +608,16 @@
 		return rc;
 	}
-
+	
 	/* Compute position of i-node in the data block */
 	uint32_t offset_in_block = byte_offset_in_group % block_size;
 	newref->inode = newref->block->data + offset_in_block;
-
+	
 	/* We need to store the original value of index in the reference */
 	newref->index = index + 1;
 	newref->fs = fs;
 	newref->dirty = false;
-
+	
 	*ref = newref;
-
+	
 	return EOK;
 }
@@ -643,22 +625,21 @@
 /** Put reference to i-node.
  *
- * @param ref		pointer for reference to be put back
- * @return			error code
+ * @param ref Pointer for reference to be put back
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_put_inode_ref(ext4_inode_ref_t *ref)
 {
-	int rc;
-
 	/* Check if reference modified */
 	if (ref->dirty) {
-
 		/* Mark block dirty for writing changes to physical device */
 		ref->block->dirty = true;
 	}
-
+	
 	/* Put back block, that contains i-node */
-	rc = block_put(ref->block);
+	int rc = block_put(ref->block);
 	free(ref);
-
+	
 	return rc;
 }
@@ -666,27 +647,25 @@
 /** Allocate new i-node in the filesystem.
  *
- * @param fs			filesystem to allocated i-node on
- * @param inode_ref		output pointer to return reference to allocated i-node
- * @param flags			flags to be set for newly created i-node
- * @return				error code
+ * @param fs        Filesystem to allocated i-node on
+ * @param inode_ref Output pointer to return reference to allocated i-node
+ * @param flags     Flags to be set for newly created i-node
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_alloc_inode(ext4_filesystem_t *fs,
-		ext4_inode_ref_t **inode_ref, int flags)
-{
-	int rc;
-
+    ext4_inode_ref_t **inode_ref, int flags)
+{
 	/* Check if newly allocated i-node will be a directory */
 	bool is_dir = false;
-	if (flags & L_DIRECTORY) {
+	if (flags & L_DIRECTORY)
 		is_dir = true;
-	}
-
+	
 	/* Allocate inode by allocation algorithm */
 	uint32_t index;
-	rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
-	if (rc != EOK) {
+	int rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Load i-node from on-disk i-node table */
 	rc = ext4_filesystem_get_inode_ref(fs, index, inode_ref);
@@ -695,8 +674,8 @@
 		return rc;
 	}
-
+	
 	/* Initialize i-node */
 	ext4_inode_t *inode = (*inode_ref)->inode;
-
+	
 	uint16_t mode;
 	if (is_dir) {
@@ -705,8 +684,9 @@
 		 * 0777 (octal) == rwxrwxrwx
 		 */
+		
 		mode = 0777;
 		mode |= EXT4_INODE_MODE_DIRECTORY;
 		ext4_inode_set_mode(fs->superblock, inode, mode);
-		ext4_inode_set_links_count(inode, 1); /* '.' entry */
+		ext4_inode_set_links_count(inode, 1);  /* '.' entry */
 	} else {
 		/*
@@ -714,5 +694,5 @@
 		 * 0666 (octal) == rw-rw-rw-
 		 */
-
+		
 		mode = 0666;
 		mode |= EXT4_INODE_MODE_FILE;
@@ -720,5 +700,5 @@
 		ext4_inode_set_links_count(inode, 0);
 	}
-
+	
 	ext4_inode_set_uid(inode, 0);
 	ext4_inode_set_gid(inode, 0);
@@ -731,16 +711,14 @@
 	ext4_inode_set_flags(inode, 0);
 	ext4_inode_set_generation(inode, 0);
-
+	
 	/* Reset blocks array */
-	for (uint32_t i = 0; i < EXT4_INODE_BLOCKS; i++) {
+	for (uint32_t i = 0; i < EXT4_INODE_BLOCKS; i++)
 		inode->blocks[i] = 0;
-	}
-
+	
 	/* Initialize extents if needed */
 	if (ext4_superblock_has_feature_incompatible(
-			fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
-
+	    fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
 		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
-
+		
 		/* Initialize extent root header */
 		ext4_extent_header_t *header = ext4_inode_get_extent_header(inode);
@@ -749,13 +727,13 @@
 		ext4_extent_header_set_generation(header, 0);
 		ext4_extent_header_set_magic(header, EXT4_EXTENT_MAGIC);
-
-		uint16_t max_entries = (EXT4_INODE_BLOCKS * sizeof (uint32_t) - sizeof(ext4_extent_header_t))
-				/ sizeof(ext4_extent_t);
-
+		
+		uint16_t max_entries = (EXT4_INODE_BLOCKS * sizeof(uint32_t) -
+		    sizeof(ext4_extent_header_t)) / sizeof(ext4_extent_t);
+		
 		ext4_extent_header_set_max_entries_count(header, max_entries);
 	}
-
+	
 	(*inode_ref)->dirty = true;
-
+	
 	return EOK;
 }
@@ -763,51 +741,48 @@
 /** Release i-node and mark it as free.
  *
- * @param inode_ref			i-node to be released
- * @return					error code
+ * @param inode_ref I-node to be released
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_free_inode(ext4_inode_ref_t *inode_ref)
 {
-	int rc;
-
 	ext4_filesystem_t *fs = inode_ref->fs;
-
+	
 	/* For extents must be data block destroyed by other way */
-	if (ext4_superblock_has_feature_incompatible(
-			fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-				ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) {
-
+	if ((ext4_superblock_has_feature_incompatible(fs->superblock,
+	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		/* Data structures are released during truncate operation... */
 		goto finish;
 	}
-
+	
 	/* Release all indirect (no data) blocks */
-
+	
 	/* 1) Single indirect */
 	uint32_t fblock = ext4_inode_get_indirect_block(inode_ref->inode, 0);
 	if (fblock != 0) {
-		rc = ext4_balloc_free_block(inode_ref, fblock);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = ext4_balloc_free_block(inode_ref, fblock);
+		if (rc != EOK)
+			return rc;
+		
 		ext4_inode_set_indirect_block(inode_ref->inode, 0, 0);
 	}
-
+	
 	block_t *block;
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
 	uint32_t count = block_size / sizeof(uint32_t);
-
+	
 	/* 2) Double indirect */
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 1);
 	if (fblock != 0) {
-		rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			return rc;
+		
 		uint32_t ind_block;
 		for (uint32_t offset = 0; offset < count; ++offset) {
-			ind_block = uint32_t_le2host(((uint32_t*)block->data)[offset]);
-
+			ind_block = uint32_t_le2host(((uint32_t *) block->data)[offset]);
+			
 			if (ind_block != 0) {
 				rc = ext4_balloc_free_block(inode_ref, ind_block);
@@ -818,39 +793,39 @@
 			}
 		}
-
+		
 		block_put(block);
 		rc = ext4_balloc_free_block(inode_ref, fblock);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		if (rc != EOK)
+			return rc;
+		
 		ext4_inode_set_indirect_block(inode_ref->inode, 1, 0);
 	}
-
-
+	
 	/* 3) Tripple indirect */
 	block_t *subblock;
 	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 2);
 	if (fblock != 0) {
-		rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
+		if (rc != EOK)
+			return rc;
+		
 		uint32_t ind_block;
 		for (uint32_t offset = 0; offset < count; ++offset) {
-			ind_block = uint32_t_le2host(((uint32_t*)block->data)[offset]);
-
+			ind_block = uint32_t_le2host(((uint32_t *) block->data)[offset]);
+			
 			if (ind_block != 0) {
-				rc = block_get(&subblock, fs->device, ind_block, BLOCK_FLAGS_NONE);
+				rc = block_get(&subblock, fs->device, ind_block,
+				    BLOCK_FLAGS_NONE);
 				if (rc != EOK) {
 					block_put(block);
 					return rc;
 				}
-
+				
 				uint32_t ind_subblock;
-				for (uint32_t suboffset = 0; suboffset < count; ++suboffset) {
-					ind_subblock = uint32_t_le2host(((uint32_t*)subblock->data)[suboffset]);
-
+				for (uint32_t suboffset = 0; suboffset < count;
+				    ++suboffset) {
+					ind_subblock = uint32_t_le2host(((uint32_t *)
+					    subblock->data)[suboffset]);
+					
 					if (ind_subblock != 0) {
 						rc = ext4_balloc_free_block(inode_ref, ind_subblock);
@@ -861,10 +836,9 @@
 						}
 					}
-
 				}
+				
 				block_put(subblock);
-
 			}
-
+			
 			rc = ext4_balloc_free_block(inode_ref, ind_block);
 			if (rc != EOK) {
@@ -872,118 +846,101 @@
 				return rc;
 			}
-
-
 		}
-
+		
 		block_put(block);
 		rc = ext4_balloc_free_block(inode_ref, fblock);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		if (rc != EOK)
+			return rc;
+		
 		ext4_inode_set_indirect_block(inode_ref->inode, 2, 0);
 	}
-
+	
 finish:
-
 	/* Mark inode dirty for writing to the physical device */
 	inode_ref->dirty = true;
-
+	
 	/* Free block with extended attributes if present */
 	uint32_t xattr_block = ext4_inode_get_file_acl(
-			inode_ref->inode, fs->superblock);
+	    inode_ref->inode, fs->superblock);
 	if (xattr_block) {
-		rc = ext4_balloc_free_block(inode_ref, xattr_block);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = ext4_balloc_free_block(inode_ref, xattr_block);
+		if (rc != EOK)
+			return rc;
+		
 		ext4_inode_set_file_acl(inode_ref->inode, fs->superblock, 0);
 	}
-
+	
 	/* Free inode by allocator */
+	int rc;
 	if (ext4_inode_is_type(fs->superblock, inode_ref->inode,
-			EXT4_INODE_MODE_DIRECTORY)) {
+	    EXT4_INODE_MODE_DIRECTORY))
 		rc = ext4_ialloc_free_inode(fs, inode_ref->index, true);
-	} else {
+	else
 		rc = ext4_ialloc_free_inode(fs, inode_ref->index, false);
-	}
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
+	
+	return rc;
 }
 
 /** Truncate i-node data blocks.
  *
- * @param inode_ref		i-node to be truncated
- * @param new_size		new size of inode (must be < current size)
- * @return				error code
- */
-int ext4_filesystem_truncate_inode(
-		ext4_inode_ref_t *inode_ref, aoff64_t new_size)
-{
-	int rc;
-
+ * @param inode_ref I-node to be truncated
+ * @param new_size  New size of inode (must be < current size)
+ *
+ * @return Error code
+ *
+ */
+int ext4_filesystem_truncate_inode(ext4_inode_ref_t *inode_ref,
+    aoff64_t new_size)
+{
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
+	
 	/* Check flags, if i-node can be truncated */
-	if (! ext4_inode_can_truncate(sb, inode_ref->inode)) {
+	if (!ext4_inode_can_truncate(sb, inode_ref->inode))
 		return EINVAL;
-	}
-
+	
 	/* If sizes are equal, nothing has to be done. */
 	aoff64_t old_size = ext4_inode_get_size(sb, inode_ref->inode);
-	if (old_size == new_size) {
+	if (old_size == new_size)
 		return EOK;
-	}
-
+	
 	/* It's not suppported to make the larger file by truncate operation */
-	if (old_size < new_size) {
+	if (old_size < new_size)
 		return EINVAL;
-	}
-
+	
 	/* Compute how many blocks will be released */
 	aoff64_t size_diff = old_size - new_size;
 	uint32_t block_size  = ext4_superblock_get_block_size(sb);
 	uint32_t diff_blocks_count = size_diff / block_size;
-	if (size_diff % block_size != 0) {
+	if (size_diff % block_size != 0)
 		diff_blocks_count++;
-	}
-
+	
 	uint32_t old_blocks_count = old_size / block_size;
-	if (old_size % block_size != 0) {
+	if (old_size % block_size != 0)
 		old_blocks_count++;
-	}
-
-	if (ext4_superblock_has_feature_incompatible(
-			inode_ref->fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-				ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) {
-
+	
+	if ((ext4_superblock_has_feature_incompatible(inode_ref->fs->superblock,
+	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		/* Extents require special operation */
-
-		rc = ext4_extent_release_blocks_from(inode_ref,
-				old_blocks_count - diff_blocks_count);
-		if (rc != EOK) {
-			return rc;
-		}
+		int rc = ext4_extent_release_blocks_from(inode_ref,
+		    old_blocks_count - diff_blocks_count);
+		if (rc != EOK)
+			return rc;
 	} else {
-
 		/* Release data blocks from the end of file */
-
+		
 		/* Starting from 1 because of logical blocks are numbered from 0 */
 		for (uint32_t i = 1; i <= diff_blocks_count; ++i) {
-			rc = ext4_filesystem_release_inode_block(inode_ref, old_blocks_count - i);
-			if (rc != EOK) {
+			int rc = ext4_filesystem_release_inode_block(inode_ref,
+			    old_blocks_count - i);
+			if (rc != EOK)
 				return rc;
-			}
 		}
 	}
-
+	
 	/* Update i-node */
 	ext4_inode_set_size(inode_ref->inode, new_size);
 	inode_ref->dirty = true;
-
+	
 	return EOK;
 }
@@ -991,16 +948,16 @@
 /** Get physical block address by logical index of the block.
  *
- * @param inode_ref		i-node to read block address from
- * @param iblock		logical index of block
- * @param fblock		output pointer for return physical block address
- * @return				error code
+ * @param inode_ref I-node to read block address from
+ * @param iblock    Logical index of block
+ * @param fblock    Output pointer for return physical block address
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *inode_ref,
-		aoff64_t iblock, uint32_t *fblock)
-{
-	int rc;
-
+    aoff64_t iblock, uint32_t *fblock)
+{
 	ext4_filesystem_t *fs = inode_ref->fs;
-
+	
 	/* For empty file is situation simple */
 	if (ext4_inode_get_size(fs->superblock, inode_ref->inode) == 0) {
@@ -1008,34 +965,31 @@
 		return EOK;
 	}
-
+	
 	uint32_t current_block;
-
+	
 	/* Handle i-node using extents */
-	if (ext4_superblock_has_feature_incompatible(fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-			ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) {
-
-		rc = ext4_extent_find_block(inode_ref, iblock, &current_block);
-
-		if (rc != EOK) {
-			return rc;
-		}
-
+	if ((ext4_superblock_has_feature_incompatible(fs->superblock,
+	    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);
+		if (rc != EOK)
+			return rc;
+		
 		*fblock = current_block;
 		return EOK;
-
-	}
-
+	}
+	
 	ext4_inode_t *inode = inode_ref->inode;
-
+	
 	/* Direct block are read directly from array in i-node structure */
 	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
-		current_block = ext4_inode_get_direct_block(inode, (uint32_t)iblock);
+		current_block = ext4_inode_get_direct_block(inode, (uint32_t) iblock);
 		*fblock = current_block;
 		return EOK;
 	}
-
+	
 	/* Determine indirection level of the target block */
-	int level = -1;
-	for (int i = 1; i < 4; i++) {
+	unsigned int level = 0;
+	for (unsigned int i = 1; i < 4; i++) {
 		if (iblock < fs->inode_block_limits[i]) {
 			level = i;
@@ -1043,14 +997,15 @@
 		}
 	}
-
-	if (level == -1) {
+	
+	if (level == 0)
 		return EIO;
-	}
-
+	
 	/* Compute offsets for the topmost level */
-	aoff64_t block_offset_in_level = iblock - fs->inode_block_limits[level-1];
-	current_block = ext4_inode_get_indirect_block(inode, level-1);
-	uint32_t offset_in_block = block_offset_in_level / fs->inode_blocks_per_level[level-1];
-
+	aoff64_t block_offset_in_level =
+	    iblock - fs->inode_block_limits[level - 1];
+	current_block = ext4_inode_get_indirect_block(inode, level - 1);
+	uint32_t offset_in_block =
+	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
+	
 	/* Sparse file */
 	if (current_block == 0) {
@@ -1058,27 +1013,26 @@
 		return EOK;
 	}
-
+	
 	block_t *block;
-
-	/* Navigate through other levels, until we find the block number
+	
+	/*
+	 * Navigate through other levels, until we find the block number
 	 * or find null reference meaning we are dealing with sparse file
 	 */
 	while (level > 0) {
-
 		/* Load indirect block */
-		rc = block_get(&block, fs->device, current_block, 0);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = block_get(&block, fs->device, current_block, 0);
+		if (rc != EOK)
+			return rc;
+		
 		/* Read block address from indirect block */
-		current_block = uint32_t_le2host(((uint32_t*)block->data)[offset_in_block]);
-
+		current_block =
+		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
+		
 		/* Put back indirect block untouched */
 		rc = block_put(block);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		if (rc != EOK)
+			return rc;
+		
 		/* Check for sparse file */
 		if (current_block == 0) {
@@ -1086,20 +1040,20 @@
 			return EOK;
 		}
-
+		
 		/* Jump to the next level */
-		level -= 1;
-
+		level--;
+		
 		/* Termination condition - we have address of data block loaded */
-		if (level == 0) {
+		if (level == 0)
 			break;
-		}
-
+		
 		/* Visit the next level */
 		block_offset_in_level %= fs->inode_blocks_per_level[level];
-		offset_in_block = block_offset_in_level / fs->inode_blocks_per_level[level-1];
-	}
-
+		offset_in_block =
+		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
+	}
+	
 	*fblock = current_block;
-
+	
 	return EOK;
 }
@@ -1107,33 +1061,35 @@
 /** Set physical block address for the block logical address into the i-node.
  *
- * @param inode_ref		i-node to set block address to
- * @param iblock		logical index of block
- * @param fblock		physical block address
- * @return				error code
+ * @param inode_ref I-node to set block address to
+ * @param iblock    Logical index of block
+ * @param fblock    Physical block address
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *inode_ref,
-		aoff64_t iblock, uint32_t fblock)
-{
-	int rc;
-
+    aoff64_t iblock, uint32_t fblock)
+{
 	ext4_filesystem_t *fs = inode_ref->fs;
-
+	
 	/* Handle inode using extents */
-	if (ext4_superblock_has_feature_compatible(fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-			ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) {
-		/* not reachable !!! */
+	if ((ext4_superblock_has_feature_compatible(fs->superblock,
+	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
+		/* Not reachable */
 		return ENOTSUP;
 	}
-
+	
 	/* Handle simple case when we are dealing with direct reference */
 	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
-		ext4_inode_set_direct_block(inode_ref->inode, (uint32_t)iblock, fblock);
+		ext4_inode_set_direct_block(inode_ref->inode, (uint32_t) iblock, fblock);
 		inode_ref->dirty = true;
+		
 		return EOK;
 	}
-
+	
 	/* Determine the indirection level needed to get the desired block */
-	int level = -1;
-	for (int i = 1; i < 4; i++) {
+	unsigned int level = 0;
+	for (unsigned int i = 1; i < 4; i++) {
 		if (iblock < fs->inode_block_limits[i]) {
 			level = i;
@@ -1141,66 +1097,67 @@
 		}
 	}
-
-	if (level == -1) {
+	
+	if (level == 0)
 		return EIO;
-	}
-
+	
 	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-
+	
 	/* Compute offsets for the topmost level */
-	aoff64_t block_offset_in_level = iblock - fs->inode_block_limits[level-1];
-	uint32_t current_block = ext4_inode_get_indirect_block(inode_ref->inode, level-1);
-	uint32_t offset_in_block = block_offset_in_level / fs->inode_blocks_per_level[level-1];
-
+	aoff64_t block_offset_in_level =
+	    iblock - fs->inode_block_limits[level - 1];
+	uint32_t current_block =
+	    ext4_inode_get_indirect_block(inode_ref->inode, level - 1);
+	uint32_t offset_in_block =
+	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
+	
 	uint32_t new_block_addr;
-	block_t *block, *new_block;
-
+	block_t *block;
+	block_t *new_block;
+	
 	/* Is needed to allocate indirect block on the i-node level */
 	if (current_block == 0) {
-
 		/* Allocate new indirect block */
-		rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		int rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
+		if (rc != EOK)
+			return rc;
+		
 		/* Update i-node */
-		ext4_inode_set_indirect_block(inode_ref->inode, level - 1, new_block_addr);
+		ext4_inode_set_indirect_block(inode_ref->inode, level - 1,
+		    new_block_addr);
 		inode_ref->dirty = true;
-
+		
 		/* Load newly allocated block */
-		rc = block_get(&new_block, fs->device, new_block_addr, BLOCK_FLAGS_NOREAD);
+		rc = block_get(&new_block, fs->device, new_block_addr,
+		    BLOCK_FLAGS_NOREAD);
 		if (rc != EOK) {
 			ext4_balloc_free_block(inode_ref, new_block_addr);
 			return rc;
 		}
-
+		
 		/* Initialize new block */
 		memset(new_block->data, 0, block_size);
 		new_block->dirty = true;
-
+		
 		/* Put back the allocated block */
 		rc = block_put(new_block);
-		if (rc != EOK) {
-			return rc;
-		}
-
+		if (rc != EOK)
+			return rc;
+		
 		current_block = new_block_addr;
 	}
-
-	/* Navigate through other levels, until we find the block number
+	
+	/*
+	 * Navigate through other levels, until we find the block number
 	 * or find null reference meaning we are dealing with sparse file
 	 */
 	while (level > 0) {
-
-		rc = block_get(&block, fs->device, current_block, 0);
-		if (rc != EOK) {
-			return rc;
-		}
-
-		current_block = uint32_t_le2host(((uint32_t*)block->data)[offset_in_block]);
-
+		int rc = block_get(&block, fs->device, current_block, 0);
+		if (rc != EOK)
+			return rc;
+		
+		current_block =
+		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
+		
 		if ((level > 1) && (current_block == 0)) {
-
 			/* Allocate new block */
 			rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
@@ -1209,16 +1166,17 @@
 				return rc;
 			}
-
+			
 			/* Load newly allocated block */
-			rc = block_get(&new_block, fs->device, new_block_addr, BLOCK_FLAGS_NOREAD);
+			rc = block_get(&new_block, fs->device, new_block_addr,
+			    BLOCK_FLAGS_NOREAD);
 			if (rc != EOK) {
 				block_put(block);
 				return rc;
 			}
-
+			
 			/* Initialize allocated block */
 			memset(new_block->data, 0, block_size);
 			new_block->dirty = true;
-
+			
 			rc = block_put(new_block);
 			if (rc != EOK) {
@@ -1226,36 +1184,38 @@
 				return rc;
 			}
-
+			
 			/* Write block address to the parent */
-			((uint32_t*)block->data)[offset_in_block] = host2uint32_t_le(new_block_addr);
+			((uint32_t *) block->data)[offset_in_block] =
+			    host2uint32_t_le(new_block_addr);
 			block->dirty = true;
 			current_block = new_block_addr;
 		}
-
+		
 		/* Will be finished, write the fblock address */
 		if (level == 1) {
-			((uint32_t*)block->data)[offset_in_block] = host2uint32_t_le(fblock);
+			((uint32_t *) block->data)[offset_in_block] =
+			    host2uint32_t_le(fblock);
 			block->dirty = true;
 		}
-
+		
 		rc = block_put(block);
-		if (rc != EOK) {
-			return rc;
-		}
-
-		level -= 1;
-
-		/* If we are on the last level, break here as
+		if (rc != EOK)
+			return rc;
+		
+		level--;
+		
+		/*
+		 * If we are on the last level, break here as
 		 * there is no next level to visit
 		 */
-		if (level == 0) {
+		if (level == 0)
 			break;
-		}
-
+		
 		/* Visit the next level */
 		block_offset_in_level %= fs->inode_blocks_per_level[level];
-		offset_in_block = block_offset_in_level / fs->inode_blocks_per_level[level-1];
-	}
-
+		offset_in_block =
+		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
+	}
+	
 	return EOK;
 }
@@ -1263,40 +1223,39 @@
 /** Release data block from i-node
  *
- * @param inode_ref 	i-node to release block from
- * @param iblock		logical block to be released
- * @return				error code
- */
-int ext4_filesystem_release_inode_block(
-		ext4_inode_ref_t *inode_ref, uint32_t iblock)
-{
-	int rc;
-
+ * @param inode_ref I-node to release block from
+ * @param iblock    Logical block to be released
+ *
+ * @return Error code
+ *
+ */
+int ext4_filesystem_release_inode_block(ext4_inode_ref_t *inode_ref,
+    uint32_t iblock)
+{
 	uint32_t fblock;
-
+	
 	ext4_filesystem_t *fs = inode_ref->fs;
-
-	/* EXTENTS are handled otherwise = there is not support in this function */
-	assert(! (ext4_superblock_has_feature_incompatible(fs->superblock,
-			EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-			ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)));
-
+	
+	/* Extents are handled otherwise = there is not support in this function */
+	assert(!(ext4_superblock_has_feature_incompatible(fs->superblock,
+	    EXT4_FEATURE_INCOMPAT_EXTENTS) &&
+	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))));
+	
 	ext4_inode_t *inode = inode_ref->inode;
-
+	
 	/* Handle simple case when we are dealing with direct reference */
 	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
 		fblock = ext4_inode_get_direct_block(inode, iblock);
+		
 		/* Sparse file */
-		if (fblock == 0) {
+		if (fblock == 0)
 			return EOK;
-		}
-
+		
 		ext4_inode_set_direct_block(inode, iblock, 0);
 		return ext4_balloc_free_block(inode_ref, fblock);
 	}
-
-
+	
 	/* Determine the indirection level needed to get the desired block */
-	int level = -1;
-	for (int i = 1; i < 4; i++) {
+	unsigned int level = 0;
+	for (unsigned int i = 1; i < 4; i++) {
 		if (iblock < fs->inode_block_limits[i]) {
 			level = i;
@@ -1304,119 +1263,115 @@
 		}
 	}
-
-	if (level == -1) {
+	
+	if (level == 0)
 		return EIO;
-	}
-
+	
 	/* Compute offsets for the topmost level */
-	aoff64_t block_offset_in_level = iblock - fs->inode_block_limits[level-1];
-	uint32_t current_block = ext4_inode_get_indirect_block(inode, level-1);
-	uint32_t offset_in_block = block_offset_in_level / fs->inode_blocks_per_level[level-1];
-
-	/* Navigate through other levels, until we find the block number
+	aoff64_t block_offset_in_level =
+	    iblock - fs->inode_block_limits[level - 1];
+	uint32_t current_block =
+	    ext4_inode_get_indirect_block(inode, level - 1);
+	uint32_t offset_in_block =
+	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
+	
+	/*
+	 * Navigate through other levels, until we find the block number
 	 * or find null reference meaning we are dealing with sparse file
 	 */
 	block_t *block;
 	while (level > 0) {
-		rc = block_get(&block, fs->device, current_block, 0);
-		if (rc != EOK) {
-			return rc;
-		}
-
-		current_block = uint32_t_le2host(((uint32_t*)block->data)[offset_in_block]);
-
+		int rc = block_get(&block, fs->device, current_block, 0);
+		if (rc != EOK)
+			return rc;
+		
+		current_block =
+		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
+		
 		/* Set zero if physical data block address found */
 		if (level == 1) {
-			((uint32_t*)block->data)[offset_in_block] = host2uint32_t_le(0);
+			((uint32_t *) block->data)[offset_in_block] =
+			    host2uint32_t_le(0);
 			block->dirty = true;
 		}
-
+		
 		rc = block_put(block);
-		if (rc != EOK) {
-			return rc;
-		}
-
-		level -= 1;
-
-		/* If we are on the last level, break here as
+		if (rc != EOK)
+			return rc;
+		
+		level--;
+		
+		/*
+		 * If we are on the last level, break here as
 		 * there is no next level to visit
 		 */
-		if (level == 0) {
+		if (level == 0)
 			break;
-		}
-
+		
 		/* Visit the next level */
 		block_offset_in_level %= fs->inode_blocks_per_level[level];
-		offset_in_block = block_offset_in_level / fs->inode_blocks_per_level[level-1];
-	}
-
+		offset_in_block =
+		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
+	}
+	
 	fblock = current_block;
-
-	if (fblock == 0) {
+	if (fblock == 0)
 		return EOK;
-	}
-
+	
 	/* Physical block is not referenced, it can be released */
-
 	return ext4_balloc_free_block(inode_ref, fblock);
-
 }
 
 /** Append following logical block to the i-node.
  *
- * @param inode_ref			i-node to append block to
- * @param fblock			output physical block address of newly allocated block
- * @param iblock			output logical number of newly allocated block
- * @return					error code
+ * @param inode_ref I-node to append block to
+ * @param fblock    Output physical block address of newly allocated block
+ * @param iblock    Output logical number of newly allocated block
+ *
+ * @return Error code
+ *
  */
 int ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref,
-		uint32_t *fblock, uint32_t *iblock)
-{
-	int rc;
-
+    uint32_t *fblock, uint32_t *iblock)
+{
 	/* Handle extents separately */
-	if (ext4_superblock_has_feature_incompatible(
-			inode_ref->fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-			ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) {
-
+	if ((ext4_superblock_has_feature_incompatible(inode_ref->fs->superblock,
+	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)))
 		return ext4_extent_append_block(inode_ref, iblock, fblock, true);
-
-	}
-
+	
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
+	
 	/* Compute next block index and allocate data block */
 	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
 	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
+	
 	/* Align size i-node size */
-	if ((inode_size % block_size) != 0) {
+	if ((inode_size % block_size) != 0)
 		inode_size += block_size - (inode_size % block_size);
-	}
-
+	
 	/* Logical blocks are numbered from 0 */
 	uint32_t new_block_idx = inode_size / block_size;
-
+	
 	/* Allocate new physical block */
 	uint32_t phys_block;
-	rc =  ext4_balloc_alloc_block(inode_ref, &phys_block);
-	if (rc != EOK) {
+	int rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Add physical block address to the i-node */
-	rc = ext4_filesystem_set_inode_data_block_index(inode_ref, new_block_idx, phys_block);
+	rc = ext4_filesystem_set_inode_data_block_index(inode_ref,
+	    new_block_idx, phys_block);
 	if (rc != EOK) {
 		ext4_balloc_free_block(inode_ref, phys_block);
 		return rc;
 	}
-
+	
 	/* Update i-node */
 	ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
 	inode_ref->dirty = true;
-
+	
 	*fblock = phys_block;
 	*iblock = new_block_idx;
-
+	
 	return EOK;
 }
@@ -1424,3 +1379,3 @@
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_filesystem.h
===================================================================
--- uspace/lib/ext4/libext4_filesystem.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_filesystem.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_FILESYSTEM_H_
@@ -37,31 +37,30 @@
 #include "libext4_types.h"
 
-extern int ext4_filesystem_init(ext4_filesystem_t *,
-		service_id_t, enum cache_mode);
-extern int ext4_filesystem_fini(ext4_filesystem_t *fs);
-extern int ext4_filesystem_check_sanity(ext4_filesystem_t *fs);
+extern int ext4_filesystem_init(ext4_filesystem_t *, service_id_t,
+    enum cache_mode);
+extern int ext4_filesystem_fini(ext4_filesystem_t *);
+extern int ext4_filesystem_check_sanity(ext4_filesystem_t *);
 extern int ext4_filesystem_check_features(ext4_filesystem_t *, bool *);
 extern uint32_t ext4_filesystem_blockaddr2_index_in_group(ext4_superblock_t *,
-		uint32_t);
+    uint32_t);
 extern uint32_t ext4_filesystem_index_in_group2blockaddr(ext4_superblock_t *,
-		uint32_t, uint32_t);
+    uint32_t, uint32_t);
 extern int ext4_filesystem_get_block_group_ref(ext4_filesystem_t *, uint32_t,
     ext4_block_group_ref_t **);
 extern int ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *);
 extern int ext4_filesystem_get_inode_ref(ext4_filesystem_t *, uint32_t,
-		ext4_inode_ref_t **);
+    ext4_inode_ref_t **);
 extern int ext4_filesystem_put_inode_ref(ext4_inode_ref_t *);
-extern int ext4_filesystem_alloc_inode(ext4_filesystem_t *,
-		ext4_inode_ref_t **, int);
+extern int ext4_filesystem_alloc_inode(ext4_filesystem_t *, ext4_inode_ref_t **,
+    int);
 extern int ext4_filesystem_free_inode(ext4_inode_ref_t *);
 extern int ext4_filesystem_truncate_inode(ext4_inode_ref_t *, aoff64_t);
 extern int ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *,
-		aoff64_t iblock, uint32_t *);
+    aoff64_t iblock, uint32_t *);
 extern int ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *,
-		aoff64_t, uint32_t);
-extern int ext4_filesystem_release_inode_block(
-		ext4_inode_ref_t *, uint32_t);
-extern int ext4_filesystem_append_inode_block(ext4_inode_ref_t *,
-		uint32_t *, uint32_t *);
+    aoff64_t, uint32_t);
+extern int ext4_filesystem_release_inode_block(ext4_inode_ref_t *, uint32_t);
+extern int ext4_filesystem_append_inode_block(ext4_inode_ref_t *, uint32_t *,
+    uint32_t *);
 
 #endif
Index: uspace/lib/ext4/libext4_hash.c
===================================================================
--- uspace/lib/ext4/libext4_hash.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_hash.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,24 +29,20 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_hash.c
- * @brief	Hashing algorithms for ext4 HTree.
+ * @file  libext4_hash.c
+ * @brief Hashing algorithms for ext4 HTree.
  */
 
 #include <errno.h>
 #include <mem.h>
-
 #include "libext4.h"
 
-#define TEA_DELTA 0x9E3779B9
-
+#define TEA_DELTA  0x9E3779B9
 
 /* F, G and H are basic MD4 functions: selection, majority, parity */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) (((x) & (y)) + (((x) ^ (y)) & (z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-
+#define F(x, y, z)  ((z) ^ ((x) & ((y) ^ (z))))
+#define G(x, y, z)  (((x) & (y)) + (((x) ^ (y)) & (z)))
+#define H(x, y, z)  ((x) ^ (y) ^ (z))
 
 /*
@@ -56,24 +52,29 @@
  * Rotation is separate from addition to prevent recomputation
  */
-#define ROUND(f, a, b, c, d, x, s)      \
-        (a += f(b, c, d) + x, a = (a << s) | (a >> (32 - s)))
-#define K1 0
-#define K2 013240474631UL
-#define K3 015666365641UL
-
+#define ROUND(f, a, b, c, d, x, s) \
+	(a += f(b, c, d) + x, a = (a << s) | (a >> (32 - s)))
+
+#define K1  0
+#define K2  013240474631UL
+#define K3  015666365641UL
 
 static void tea_transform(uint32_t buf[4], uint32_t const in[])
 {
 	uint32_t sum = 0;
-	uint32_t b0 = buf[0], b1 = buf[1];
-	uint32_t a = in[0], b = in[1], c = in[2], d = in[3];
+	uint32_t b0 = buf[0];
+	uint32_t b1 = buf[1];
+	uint32_t a = in[0];
+	uint32_t b = in[1];
+	uint32_t c = in[2];
+	uint32_t d = in[3];
+	
 	int n = 16;
-
+	
 	do {
 		sum += TEA_DELTA;
-		b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);
-		b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);
+		b0 += ((b1 << 4) + a) ^ (b1 + sum) ^ ((b1 >> 5) + b);
+		b1 += ((b0 << 4) + c) ^ (b0 + sum) ^ ((b0 >> 5) + d);
 	} while (--n);
-
+	
 	buf[0] += b0;
 	buf[1] += b1;
@@ -84,5 +85,5 @@
 {
 	uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3];
-
+	
 	/* Round 1 */
 	ROUND(F, a, b, c, d, in[0] + K1,  3);
@@ -94,5 +95,5 @@
 	ROUND(F, c, d, a, b, in[6] + K1, 11);
 	ROUND(F, b, c, d, a, in[7] + K1, 19);
-
+	
 	/* Round 2 */
 	ROUND(G, a, b, c, d, in[1] + K2,  3);
@@ -104,5 +105,5 @@
 	ROUND(G, c, d, a, b, in[4] + K2,  9);
 	ROUND(G, b, c, d, a, in[6] + K2, 13);
-
+	
 	/* Round 3 */
 	ROUND(H, a, b, c, d, in[3] + K3,  3);
@@ -114,26 +115,28 @@
 	ROUND(H, c, d, a, b, in[0] + K3, 11);
 	ROUND(H, b, c, d, a, in[4] + K3, 15);
-
+	
 	buf[0] += a;
 	buf[1] += b;
 	buf[2] += c;
 	buf[3] += d;
-
 }
 
 static uint32_t hash_unsigned(const char *name, int len)
 {
-	uint32_t hash, hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
+	uint32_t hash;
+	uint32_t hash0 = 0x12a3fe2d;
+	uint32_t hash1 = 0x37abe8f9;
 	const unsigned char *ucp = (const unsigned char *) name;
-
+	
 	while (len--) {
 		hash = hash1 + (hash0 ^ (((int) *ucp++) * 7152373));
-
-		if (hash & 0x80000000) {
+		
+		if (hash & 0x80000000)
 			hash -= 0x7fffffff;
-		}
+		
 		hash1 = hash0;
 		hash0 = hash;
 	}
+	
 	return hash0 << 1;
 }
@@ -141,16 +144,19 @@
 static uint32_t hash_signed(const char *name, int len)
 {
-	uint32_t hash, hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
+	uint32_t hash;
+	uint32_t hash0 = 0x12a3fe2d;
+	uint32_t hash1 = 0x37abe8f9;
 	const signed char *scp = (const signed char *) name;
-
+	
 	while (len--) {
 		hash = hash1 + (hash0 ^ (((int) *scp++) * 7152373));
-
-		if (hash & 0x80000000) {
+		
+		if (hash & 0x80000000)
 			hash -= 0x7fffffff;
-		}
+		
 		hash1 = hash0;
 		hash0 = hash;
 	}
+	
 	return hash0 << 1;
 }
@@ -161,17 +167,16 @@
 	int i;
 	const signed char *scp = (const signed char *) msg;
-
-	pad = (uint32_t)len | ((uint32_t)len << 8);
+	
+	pad = (uint32_t) len | ((uint32_t) len << 8);
 	pad |= pad << 16;
-
+	
 	val = pad;
-	if (len > num*4) {
+	if (len > num * 4)
 		len = num * 4;
-	}
-
+	
 	for (i = 0; i < len; i++) {
-		if ((i % 4) == 0) {
+		if ((i % 4) == 0)
 			val = pad;
-		}
+		
 		val = ((int) scp[i]) + (val << 8);
 		if ((i % 4) == 3) {
@@ -181,33 +186,30 @@
 		}
 	}
-
-	if (--num >= 0) {
+	
+	if (--num >= 0)
 		*buf++ = val;
-	}
-
-	while (--num >= 0) {
+	
+	while (--num >= 0)
 		*buf++ = pad;
-	}
-}
-
-
-static void str2hashbuf_unsigned(const char *msg, int len, uint32_t *buf, int num)
+}
+
+static void str2hashbuf_unsigned(const char *msg, int len, uint32_t *buf,
+    int num)
 {
 	uint32_t pad, val;
 	int i;
 	const unsigned char *ucp = (const unsigned char *) msg;
-
-	pad = (uint32_t)len | ((uint32_t)len << 8);
+	
+	pad = (uint32_t) len | ((uint32_t) len << 8);
 	pad |= pad << 16;
-
+	
 	val = pad;
-	if (len > num*4) {
-        len = num * 4;
-	}
-
+	if (len > num * 4)
+		len = num * 4;
+	
 	for (i = 0; i < len; i++) {
-		if ((i % 4) == 0) {
+		if ((i % 4) == 0)
 			val = pad;
-		}
+		
 		val = ((int) ucp[i]) + (val << 8);
 		if ((i % 4) == 3) {
@@ -217,23 +219,22 @@
 		}
 	}
-
-	if (--num >= 0) {
+	
+	if (--num >= 0)
 		*buf++ = val;
-	}
-
-	while (--num >= 0) {
+	
+	while (--num >= 0)
 		*buf++ = pad;
-	}
-}
-
+}
 
 /** Compute hash value of the string.
  *
- * @param hinfo		hash info structure with information about
- * 					the algorithm, hash seed and with the place
- * 					for the output hash value
- * @param len		length of the name
- * @param name		name to be hashed
- * @return			error code
+ * @param hinfo Hash info structure with information about
+ *              the algorithm, hash seed and with the place
+ *              for the output hash value
+ * @param len  Length of the name
+ * @param name Name to be hashed
+ *
+ * @return Error code
+ *
  */
 int ext4_hash_string(ext4_hash_info_t *hinfo, int len, const char *name)
@@ -242,80 +243,76 @@
 	uint32_t minor_hash = 0;
 	const char *p;
-    int i;
-    uint32_t in[8], buf[4];
-    void (*str2hashbuf)(const char *, int, uint32_t *, int) = str2hashbuf_signed;
-
-    /* Initialize the default seed for the hash checksum functions */
+	int i;
+	uint32_t in[8], buf[4];
+	void (*str2hashbuf)(const char *, int, uint32_t *, int) =
+	    str2hashbuf_signed;
+	
+	/* Initialize the default seed for the hash checksum functions */
 	buf[0] = 0x67452301;
 	buf[1] = 0xefcdab89;
 	buf[2] = 0x98badcfe;
 	buf[3] = 0x10325476;
-
-    /* Check if the seed is all zero's */
+	
+	/* Check if the seed is all zero's */
 	if (hinfo->seed) {
 		for (i = 0; i < 4; i++) {
-			if (hinfo->seed[i] != 0) {
-            	break;
-			}
-		}
-		if (i < 4) {
+			if (hinfo->seed[i] != 0)
+				break;
+			
+		}
+		
+		if (i < 4)
 			memcpy(buf, hinfo->seed, sizeof(buf));
-		}
-    }
-
+	}
+	
 	switch (hinfo->hash_version) {
-		case EXT4_HASH_VERSION_LEGACY_UNSIGNED:
-			hash = hash_unsigned(name, len);
-			break;
-
-		case EXT4_HASH_VERSION_LEGACY:
-			hash = hash_signed(name, len);
-			break;
-
-
-		case EXT4_HASH_VERSION_HALF_MD4_UNSIGNED:
-			str2hashbuf = str2hashbuf_unsigned;
-
-		case EXT4_HASH_VERSION_HALF_MD4:
-			p = name;
-			while (len > 0) {
-				(*str2hashbuf)(p, len, in, 8);
-				half_md4_transform(buf, in);
-				len -= 32;
-				p += 32;
-			}
-			minor_hash = buf[2];
-			hash = buf[1];
-			break;
-
-
-		case EXT4_HASH_VERSION_TEA_UNSIGNED:
-			str2hashbuf = str2hashbuf_unsigned;
-
-		case EXT4_HASH_VERSION_TEA:
-			p = name;
-			while (len > 0) {
-				(*str2hashbuf)(p, len, in, 4);
-				tea_transform(buf, in);
-				len -= 16;
-				p += 16;
-			}
-			hash = buf[0];
-			minor_hash = buf[1];
-			break;
-
-		default:
-			hinfo->hash = 0;
-			return EINVAL;
-	}
-
+	case EXT4_HASH_VERSION_LEGACY_UNSIGNED:
+		hash = hash_unsigned(name, len);
+		break;
+	case EXT4_HASH_VERSION_LEGACY:
+		hash = hash_signed(name, len);
+		break;
+	case EXT4_HASH_VERSION_HALF_MD4_UNSIGNED:
+		str2hashbuf = str2hashbuf_unsigned;
+	case EXT4_HASH_VERSION_HALF_MD4:
+		p = name;
+		
+		while (len > 0) {
+			(*str2hashbuf)(p, len, in, 8);
+			half_md4_transform(buf, in);
+			len -= 32;
+			p += 32;
+		}
+		
+		minor_hash = buf[2];
+		hash = buf[1];
+		break;
+	case EXT4_HASH_VERSION_TEA_UNSIGNED:
+		str2hashbuf = str2hashbuf_unsigned;
+	case EXT4_HASH_VERSION_TEA:
+		p = name;
+		
+		while (len > 0) {
+			(*str2hashbuf)(p, len, in, 4);
+			tea_transform(buf, in);
+			len -= 16;
+			p += 16;
+		}
+		
+		hash = buf[0];
+		minor_hash = buf[1];
+		break;
+	default:
+		hinfo->hash = 0;
+		return EINVAL;
+	}
+	
 	hash = hash & ~1;
-	if (hash == (EXT4_DIRECTORY_HTREE_EOF << 1)) {
-		hash = (EXT4_DIRECTORY_HTREE_EOF-1) << 1;
-	}
-
+	if (hash == (EXT4_DIRECTORY_HTREE_EOF << 1))
+		hash = (EXT4_DIRECTORY_HTREE_EOF - 1) << 1;
+	
 	hinfo->hash = hash;
 	hinfo->minor_hash = minor_hash;
-
+	
 	return EOK;
 }
@@ -323,3 +320,3 @@
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_hash.h
===================================================================
--- uspace/lib/ext4/libext4_hash.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_hash.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_HASH_H_
Index: uspace/lib/ext4/libext4_ialloc.c
===================================================================
--- uspace/lib/ext4/libext4_ialloc.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_ialloc.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_ialloc.c
- * @brief	Inode (de)allocation operations.
+ * @file  libext4_ialloc.c
+ * @brief I-node (de)allocation operations.
  */
 
@@ -43,10 +42,12 @@
 /** Convert i-node number to relative index in block group.
  *
- * @param sb	superblock
- * @param inode	i-node number to be converted
- * @return		index of the i-node in the block group
+ * @param sb    Superblock
+ * @param inode I-node number to be converted
+ *
+ * @return Index of the i-node in the block group
+ *
  */
 static uint32_t ext4_ialloc_inode2index_in_group(ext4_superblock_t *sb,
-		uint32_t inode)
+    uint32_t inode)
 {
 	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
@@ -56,10 +57,12 @@
 /** Convert relative index of i-node to absolute i-node number.
  *
- * @param sb	superblock
- * @param inode	index to be converted
- * @return		absolute number of the i-node
+ * @param sb    Superblock
+ * @param inode Index to be converted
+ *
+ * @return Absolute number of the i-node
+ *
  */
 static uint32_t ext4_ialloc_index_in_group2inode(ext4_superblock_t *sb,
-		uint32_t index, uint32_t bgid)
+    uint32_t index, uint32_t bgid)
 {
 	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
@@ -69,14 +72,15 @@
 /** Compute block group number from the i-node number.
  *
- * @param sb		superblock
- * @param inode		i-node number to be found the block group for
- * @return			block group number computed from i-node number
+ * @param sb    Superblock
+ * @param inode I-node number to be found the block group for
+ *
+ * @return Block group number computed from i-node number
+ *
  */
 static uint32_t ext4_ialloc_get_bgid_of_inode(ext4_superblock_t *sb,
-		uint32_t inode)
+    uint32_t inode)
 {
 	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
 	return (inode - 1) / inodes_per_group;
-
 }
 
@@ -84,37 +88,35 @@
 /** Free i-node number and modify filesystem data structers.
  *
- * @param fs		filesystem, where the i-node is located
- * @param index		index of i-node to be release
- * @param is_dir	flag us for information whether i-node is directory or not
+ * @param fs     Filesystem, where the i-node is located
+ * @param index  Index of i-node to be release
+ * @param is_dir Flag us for information whether i-node is directory or not
+ *
  */
 int ext4_ialloc_free_inode(ext4_filesystem_t *fs, uint32_t index, bool is_dir)
 {
-	int rc;
-
 	ext4_superblock_t *sb = fs->superblock;
-
+	
 	/* Compute index of block group and load it */
 	uint32_t block_group = ext4_ialloc_get_bgid_of_inode(sb, index);
-
+	
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	int rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
+	if (rc != EOK)
+		return rc;
+	
 	/* Load i-node bitmap */
 	uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
-			bg_ref->block_group, sb);
+	    bg_ref->block_group, sb);
 	block_t *bitmap_block;
-	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
+	    BLOCK_FLAGS_NONE);
+	if (rc != EOK)
+		return rc;
+	
 	/* Free i-node in the bitmap */
 	uint32_t index_in_group = ext4_ialloc_inode2index_in_group(sb, index);
 	ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
 	bitmap_block->dirty = true;
-
+	
 	/* Put back the block with bitmap */
 	rc = block_put(bitmap_block);
@@ -124,34 +126,34 @@
 		return rc;
 	}
-
+	
 	/* If released i-node is a directory, decrement used directories count */
 	if (is_dir) {
 		uint32_t bg_used_dirs = ext4_block_group_get_used_dirs_count(
-			bg_ref->block_group, sb);
+		    bg_ref->block_group, sb);
 		bg_used_dirs--;
-		ext4_block_group_set_used_dirs_count(
-				bg_ref->block_group, sb, bg_used_dirs);
+		ext4_block_group_set_used_dirs_count(bg_ref->block_group, sb,
+		    bg_used_dirs);
 	}
-
+	
 	/* Update block group free inodes count */
 	uint32_t free_inodes = ext4_block_group_get_free_inodes_count(
-			bg_ref->block_group, sb);
+	    bg_ref->block_group, sb);
 	free_inodes++;
-	ext4_block_group_set_free_inodes_count(bg_ref->block_group,
-			sb, free_inodes);
-
+	ext4_block_group_set_free_inodes_count(bg_ref->block_group, sb,
+	    free_inodes);
+	
 	bg_ref->dirty = true;
-
+	
 	/* Put back the modified block group */
 	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	if (rc != EOK)
+		return rc;
+	
 	/* Update superblock free inodes count */
-	uint32_t sb_free_inodes = ext4_superblock_get_free_inodes_count(sb);
+	uint32_t sb_free_inodes =
+	    ext4_superblock_get_free_inodes_count(sb);
 	sb_free_inodes++;
 	ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
-
+	
 	return EOK;
 }
@@ -159,59 +161,56 @@
 /** I-node allocation algorithm.
  *
- * This is more simple algorithm, than Orlov allocator used in the Linux kernel
- *
- * @param fs		filesystem to allocate i-node on
- * @param index		output value - allocated i-node number
- * @param is_dir 	flag if allocated i-node will be file or directory
- * @return			error code
+ * This is more simple algorithm, than Orlov allocator used
+ * in the Linux kernel.
+ *
+ * @param fs     Filesystem to allocate i-node on
+ * @param index  Output value - allocated i-node number
+ * @param is_dir Flag if allocated i-node will be file or directory
+ *
+ * @return Error code
+ *
  */
 int ext4_ialloc_alloc_inode(ext4_filesystem_t *fs, uint32_t *index, bool is_dir)
 {
-	int rc;
-
 	ext4_superblock_t *sb = fs->superblock;
-
+	
 	uint32_t bgid = 0;
 	uint32_t bg_count = ext4_superblock_get_block_group_count(sb);
 	uint32_t sb_free_inodes = ext4_superblock_get_free_inodes_count(sb);
 	uint32_t avg_free_inodes = sb_free_inodes / bg_count;
-
+	
 	/* Try to find free i-node in all block groups */
 	while (bgid < bg_count) {
-
 		/* Load block group to check */
 		ext4_block_group_ref_t *bg_ref;
-		rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
-		if (rc != EOK) {
+		int rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
+		if (rc != EOK)
 			return rc;
-		}
-
+		
 		ext4_block_group_t *bg = bg_ref->block_group;
-
+		
 		/* Read necessary values for algorithm */
 		uint32_t free_blocks = ext4_block_group_get_free_blocks_count(bg, sb);
 		uint32_t free_inodes = ext4_block_group_get_free_inodes_count(bg, sb);
 		uint32_t used_dirs = ext4_block_group_get_used_dirs_count(bg, sb);
-
+		
 		/* Check if this block group is good candidate for allocation */
 		if ((free_inodes >= avg_free_inodes) && (free_blocks > 0)) {
-
 			/* Load block with bitmap */
-			uint32_t bitmap_block_addr =  ext4_block_group_get_inode_bitmap(
-					bg_ref->block_group, sb);
-
+			uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
+			    bg_ref->block_group, sb);
+			
 			block_t *bitmap_block;
-			rc = block_get(&bitmap_block, fs->device,
-					bitmap_block_addr, BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
+			rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
+			    BLOCK_FLAGS_NONE);
+			if (rc != EOK)
 				return rc;
-			}
-
+			
 			/* Try to allocate i-node in the bitmap */
 			uint32_t inodes_in_group = ext4_superblock_get_inodes_in_group(sb, bgid);
 			uint32_t index_in_group;
-			rc = ext4_bitmap_find_free_bit_and_set(
-					bitmap_block->data, 0, &index_in_group, inodes_in_group);
-
+			rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
+			    0, &index_in_group, inodes_in_group);
+			
 			/* Block group has not any free i-node */
 			if (rc == ENOSPC) {
@@ -220,17 +219,16 @@
 				continue;
 			}
-
+			
 			/* Free i-node found, save the bitmap */
 			bitmap_block->dirty = true;
-
+			
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
+			
 			/* Modify filesystem counters */
 			free_inodes--;
 			ext4_block_group_set_free_inodes_count(bg, sb, free_inodes);
-
+			
 			/* Increment used directories counter */
 			if (is_dir) {
@@ -238,48 +236,44 @@
 				ext4_block_group_set_used_dirs_count(bg, sb, used_dirs);
 			}
-
+			
 			/* Decrease unused inodes count */
 			if (ext4_block_group_has_flag(bg,
-				EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
-
+			    EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
 				uint32_t unused =
-						ext4_block_group_get_itable_unused(bg, sb);
-
+				    ext4_block_group_get_itable_unused(bg, sb);
+				
 				uint32_t inodes_in_group =
-						ext4_superblock_get_inodes_in_group(sb, bgid);
-
+				    ext4_superblock_get_inodes_in_group(sb, bgid);
+				
 				uint32_t free = inodes_in_group - unused;
-
+				
 				if (index_in_group >= free) {
 					unused = inodes_in_group - (index_in_group + 1);
-
 					ext4_block_group_set_itable_unused(bg, sb, unused);
 				}
 			}
-
+			
 			/* Save modified block group */
 			bg_ref->dirty = true;
-
+			
 			rc = ext4_filesystem_put_block_group_ref(bg_ref);
-			if (rc != EOK) {
+			if (rc != EOK)
 				return rc;
-			}
-
+			
 			/* Update superblock */
 			sb_free_inodes--;
 			ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
-
+			
 			/* Compute the absolute i-nodex number */
 			*index = ext4_ialloc_index_in_group2inode(sb, index_in_group, bgid);
-
+			
 			return EOK;
-
 		}
-
+		
 		/* Block group not modified, put it and jump to the next block group */
 		ext4_filesystem_put_block_group_ref(bg_ref);
 		++bgid;
 	}
-
+	
 	return ENOSPC;
 }
@@ -287,3 +281,3 @@
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_ialloc.h
===================================================================
--- uspace/lib/ext4/libext4_ialloc.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_ialloc.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_IALLOC_H_
@@ -38,4 +38,5 @@
 extern int ext4_ialloc_free_inode(ext4_filesystem_t *, uint32_t, bool);
 extern int ext4_ialloc_alloc_inode(ext4_filesystem_t *, uint32_t *, bool);
+
 #endif
 
Index: uspace/lib/ext4/libext4_inode.c
===================================================================
--- uspace/lib/ext4/libext4_inode.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_inode.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,8 @@
 /** @addtogroup libext4
  * @{
- */ 
-
+ */
 /**
- * @file	libext4_inode.c
- * @brief	Ext4 inode structure operations.
+ * @file  libext4_inode.c
+ * @brief Ext4 i-node structure operations.
  */
 
@@ -43,6 +42,8 @@
 /** Compute number of bits for block count.
  *
- *  @param block_size	filesystem block_size
- *  @return		number of bits
+ *  @param block_size Filesystem block_size
+ *
+ *  @return Number of bits
+ *
  */
 static uint32_t ext4_inode_block_bits_count(uint32_t block_size)
@@ -50,10 +51,10 @@
 	uint32_t bits = 8;
 	uint32_t size = block_size;
-
+	
 	do {
 		bits++;
 		size = size >> 1;
 	} while (size > 256);
-
+	
 	return bits;
 }
@@ -61,14 +62,17 @@
 /** Get mode of the i-node.
  *
- * @param sb		superblock
- * @param inode		i-node to load mode from
- * @return 		mode of the i-node
+ * @param sb    Superblock
+ * @param inode I-node to load mode from
+ *
+ * @return Mode of the i-node
+ *
  */
 uint32_t ext4_inode_get_mode(ext4_superblock_t *sb, ext4_inode_t *inode)
 {
 	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_HURD) {
-		return ((uint32_t)uint16_t_le2host(inode->osd2.hurd2.mode_high)) << 16 |
-		    ((uint32_t)uint16_t_le2host(inode->mode));
+		return ((uint32_t) uint16_t_le2host(inode->osd2.hurd2.mode_high)) << 16 |
+		    ((uint32_t) uint16_t_le2host(inode->mode));
 	}
+	
 	return uint16_t_le2host(inode->mode);
 }
@@ -76,21 +80,23 @@
 /** Set mode of the i-node.
  *
- * @param sb		superblock
- * @param inode		i-node to set mode to
- * @param mode		mode to set to i-node
+ * @param sb    Superblock
+ * @param inode I-node to set mode to
+ * @param mode  Mode to set to i-node
+ *
  */
 void ext4_inode_set_mode(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t mode)
 {
 	inode->mode = host2uint16_t_le((mode << 16) >> 16);
-
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_HURD) {
+	
+	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_HURD)
 		inode->osd2.hurd2.mode_high = host2uint16_t_le(mode >> 16);
-	}
 }
 
 /** Get ID of the i-node owner (user id).
  *
- * @param inode		i-node to load uid from
- * @return		user ID of the i-node owner
+ * @param inode I-node to load uid from
+ *
+ * @return User ID of the i-node owner
+ *
  */
 uint32_t ext4_inode_get_uid(ext4_inode_t *inode)
@@ -101,6 +107,7 @@
 /** Set ID of the i-node owner.
  *
- * @param inode		i-node to set uid to
- * @param uid		ID of the i-node owner
+ * @param inode I-node to set uid to
+ * @param uid   ID of the i-node owner
+ *
  */
 void ext4_inode_set_uid(ext4_inode_t *inode, uint32_t uid)
@@ -111,16 +118,19 @@
 /** Get real i-node size.
  *
- * @param sb		superblock
- * @param inode		i-node to load size from
- * @return		real size of i-node
+ * @param sb    Superblock
+ * @param inode I-node to load size from
+ *
+ * @return Real size of i-node
+ *
  */
 uint64_t ext4_inode_get_size(ext4_superblock_t *sb, ext4_inode_t *inode)
 {
 	uint32_t major_rev = ext4_superblock_get_rev_level(sb);
-
-	if ((major_rev > 0) && ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)) {
+	
+	if ((major_rev > 0) &&
+	    (ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)))
 		return ((uint64_t)uint32_t_le2host(inode->size_hi)) << 32 |
-			    ((uint64_t)uint32_t_le2host(inode->size_lo));
-	}
+		    ((uint64_t)uint32_t_le2host(inode->size_lo));
+	
 	return uint32_t_le2host(inode->size_lo);
 }
@@ -128,8 +138,10 @@
 /** Set real i-node size.
  *
- *  @param inode	inode to set size to
- *  @param size		size of the i-node
- */
-void ext4_inode_set_size(ext4_inode_t *inode, uint64_t size) {
+ * @param inode I-node to set size to
+ * @param size  Size of the i-node
+ *
+ */
+void ext4_inode_set_size(ext4_inode_t *inode, uint64_t size)
+{
 	inode->size_lo = host2uint32_t_le((size << 32) >> 32);
 	inode->size_hi = host2uint32_t_le(size >> 32);
@@ -138,6 +150,8 @@
 /** Get time, when i-node was last accessed.
  *
- * @param inode		i-node
- * @return			time of the last access (POSIX)
+ * @param inode I-node
+ *
+ * @return Time of the last access (POSIX)
+ *
  */
 uint32_t ext4_inode_get_access_time(ext4_inode_t *inode)
@@ -148,6 +162,7 @@
 /** Set time, when i-node was last accessed.
  *
- * @param inode		i-node
- * @param time		time of the last access (POSIX)
+ * @param inode I-node
+ * @param time  Time of the last access (POSIX)
+ *
  */
 void ext4_inode_set_access_time(ext4_inode_t *inode, uint32_t time)
@@ -158,6 +173,8 @@
 /** Get time, when i-node was last changed.
  *
- * @param inode		i-node
- * @return			time of the last change (POSIX)
+ * @param inode I-node
+ *
+ * @return Time of the last change (POSIX)
+ *
  */
 uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *inode)
@@ -168,6 +185,7 @@
 /** Set time, when i-node was last changed.
  *
- * @param inode		i-node
- * @param time		time of the last change (POSIX)
+ * @param inode I-node
+ * @param time  Time of the last change (POSIX)
+ *
  */
 void ext4_inode_set_change_inode_time(ext4_inode_t *inode, uint32_t time)
@@ -178,6 +196,8 @@
 /** Get time, when i-node content was last modified.
  *
- * @param inode		i-node
- * @return			time of the last content modification (POSIX)
+ * @param inode I-node
+ *
+ * @return Time of the last content modification (POSIX)
+ *
  */
 uint32_t ext4_inode_get_modification_time(ext4_inode_t *inode)
@@ -188,6 +208,7 @@
 /** Set time, when i-node content was last modified.
  *
- * @param inode		i-node
- * @param time		time of the last content modification (POSIX)
+ * @param inode I-node
+ * @param time  Time of the last content modification (POSIX)
+ *
  */
 void ext4_inode_set_modification_time(ext4_inode_t *inode, uint32_t time)
@@ -198,6 +219,8 @@
 /** Get time, when i-node was deleted.
  *
- * @param inode		i-node
- * @return			time of the delete action (POSIX)
+ * @param inode I-node
+ *
+ * @return Time of the delete action (POSIX)
+ *
  */
 uint32_t ext4_inode_get_deletion_time(ext4_inode_t *inode)
@@ -208,6 +231,7 @@
 /** Set time, when i-node was deleted.
  *
- * @param inode		i-node
- * @param time		time of the delete action (POSIX)
+ * @param inode I-node
+ * @param time  Time of the delete action (POSIX)
+ *
  */
 void ext4_inode_set_deletion_time(ext4_inode_t *inode, uint32_t time)
@@ -218,6 +242,8 @@
 /** Get ID of the i-node owner's group.
  *
- * @param inode         i-node to load gid from
- * @return              group ID of the i-node owner
+ * @param inode I-node to load gid from
+ *
+ * @return Group ID of the i-node owner
+ *
  */
 uint32_t ext4_inode_get_gid(ext4_inode_t *inode)
@@ -228,6 +254,7 @@
 /** Set ID ot the i-node owner's group.
  *
- * @param inode		i-node to set gid to
- * @param gid		group ID of the i-node owner
+ * @param inode I-node to set gid to
+ * @param gid   Group ID of the i-node owner
+ *
  */
 void ext4_inode_set_gid(ext4_inode_t *inode, uint32_t gid)
@@ -238,6 +265,8 @@
 /** Get number of links to i-node.
  *
- * @param inode 	i-node to load number of links from
- * @return		number of links to i-node
+ * @param inode I-node to load number of links from
+ *
+ * @return Number of links to i-node
+ *
  */
 uint16_t ext4_inode_get_links_count(ext4_inode_t *inode)
@@ -248,6 +277,7 @@
 /** Set number of links to i-node.
  *
- * @param inode 	i-node to set number of links to
- * @param count		number of links to i-node
+ * @param inode I-node to set number of links to
+ * @param count Number of links to i-node
+ *
  */
 void ext4_inode_set_links_count(ext4_inode_t *inode, uint16_t count)
@@ -258,79 +288,87 @@
 /** Get number of 512-bytes blocks used for i-node.
  *
- * @param sb		superblock
- * @param inode		i-node
- * @return			number of 512-bytes blocks
+ * @param sb    Superblock
+ * @param inode I-node
+ *
+ * @return Number of 512-bytes blocks
+ *
  */
 uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode)
 {
-	if (ext4_superblock_has_feature_read_only(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
-
+	if (ext4_superblock_has_feature_read_only(sb,
+	    EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
 		/* 48-bit field */
-		uint64_t count = ((uint64_t)uint16_t_le2host(inode->osd2.linux2.blocks_high)) << 32 |
-				uint32_t_le2host(inode->blocks_count_lo);
-
+		uint64_t count = ((uint64_t)
+		    uint16_t_le2host(inode->osd2.linux2.blocks_high)) << 32 |
+		    uint32_t_le2host(inode->blocks_count_lo);
+		
 		if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_HUGE_FILE)) {
-	    	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	    	uint32_t block_bits = ext4_inode_block_bits_count(block_size);
-			return count  << (block_bits - 9);
-		} else {
+			uint32_t block_size = ext4_superblock_get_block_size(sb);
+			uint32_t block_bits = ext4_inode_block_bits_count(block_size);
+			return count << (block_bits - 9);
+		} else
 			return count;
-		}
+	} else
+		return uint32_t_le2host(inode->blocks_count_lo);
+}
+
+/** Set number of 512-bytes blocks used for i-node.
+ *
+ * @param sb    Superblock
+ * @param inode I-node
+ * @param count Number of 512-bytes blocks
+ *
+ * @return Error code
+ *
+ */
+int ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode,
+    uint64_t count)
+{
+	/* 32-bit maximum */
+	uint64_t max = 0;
+	max = ~max >> 32;
+	
+	if (count <= max) {
+		inode->blocks_count_lo = host2uint32_t_le(count);
+		inode->osd2.linux2.blocks_high = 0;
+		ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
+		
+		return EOK;
+	}
+	
+	/* Check if there can be used huge files (many blocks) */
+	if (!ext4_superblock_has_feature_read_only(sb,
+	    EXT4_FEATURE_RO_COMPAT_HUGE_FILE))
+		return EINVAL;
+	
+	/* 48-bit maximum */
+	max = 0;
+	max = ~max >> 16;
+	
+	if (count <= max) {
+		inode->blocks_count_lo = host2uint32_t_le(count);
+		inode->osd2.linux2.blocks_high = host2uint16_t_le(count >> 32);
+		ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
 	} else {
-		return uint32_t_le2host(inode->blocks_count_lo);
-    }
-}
-
-/** Set number of 512-bytes blocks used for i-node.
- *
- * @param sb		superblock
- * @param inode		i-node
- * @param count		number of 512-bytes blocks
- * @return			error code
- */
-int ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode,
-		uint64_t count)
-{
-    /* 32-bit maximum */
-    uint64_t max = 0;
-    max = ~max >> 32;
-
-    if (count <= max) {
-    	inode->blocks_count_lo = host2uint32_t_le(count);
-    	inode->osd2.linux2.blocks_high = 0;
-    	ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
-    	return EOK;
-    }
-
-    /* Check if there can be used huge files (many blocks) */
-    if (!ext4_superblock_has_feature_read_only(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
-    	return EINVAL;
-    }
-
-    /* 48-bit maximum */
-    max = 0;
-    max = ~max >> 16;
-
-    if (count <= max) {
-    	inode->blocks_count_lo = host2uint32_t_le(count);
-    	inode->osd2.linux2.blocks_high = host2uint16_t_le(count >> 32);
-    	ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
-    } else {
-    	uint32_t block_size = ext4_superblock_get_block_size(sb);
-    	uint32_t block_bits = ext4_inode_block_bits_count(block_size);
-    	ext4_inode_set_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
-    	count = count >> (block_bits - 9);
-    	inode->blocks_count_lo = host2uint32_t_le(count);
-    	inode->osd2.linux2.blocks_high = host2uint16_t_le(count >> 32);
-    }
-    return EOK;
+		uint32_t block_size = ext4_superblock_get_block_size(sb);
+		uint32_t block_bits = ext4_inode_block_bits_count(block_size);
+		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
+		count = count >> (block_bits - 9);
+		inode->blocks_count_lo = host2uint32_t_le(count);
+		inode->osd2.linux2.blocks_high = host2uint16_t_le(count >> 32);
+	}
+	
+	return EOK;
 }
 
 /** Get flags (features) of i-node.
- * 
- * @param inode		i-node to get flags from
- * @return		flags (bitmap)
- */
-uint32_t ext4_inode_get_flags(ext4_inode_t *inode) {
+ *
+ * @param inode I-node to get flags from
+ *
+ * @return Flags (bitmap)
+ *
+ */
+uint32_t ext4_inode_get_flags(ext4_inode_t *inode)
+{
 	return uint32_t_le2host(inode->flags);
 }
@@ -338,8 +376,10 @@
 /** Set flags (features) of i-node.
  *
- * @param inode		i-node to set flags to
- * @param flags		flags to set to i-node
- */
-void ext4_inode_set_flags(ext4_inode_t *inode, uint32_t flags) {
+ * @param inode I-node to set flags to
+ * @param flags Flags to set to i-node
+ *
+ */
+void ext4_inode_set_flags(ext4_inode_t *inode, uint32_t flags)
+{
 	inode->flags = host2uint32_t_le(flags);
 }
@@ -347,6 +387,8 @@
 /** Get file generation (used by NFS).
  *
- * @param inode		i-node
- * @return			file generation
+ * @param inode I-node
+ *
+ * @return File generation
+ *
  */
 uint32_t ext4_inode_get_generation(ext4_inode_t *inode)
@@ -357,6 +399,7 @@
 /** Set file generation (used by NFS).
  *
- * @param inode			i-node
- * @param generation	file generation
+ * @param inode      I-node
+ * @param generation File generation
+ *
  */
 void ext4_inode_set_generation(ext4_inode_t *inode, uint32_t generation)
@@ -367,15 +410,17 @@
 /** Get address of block, where are extended attributes located.
  *
- * @param inode			i-node
- * @param sb			superblock
- * @return				block address
+ * @param inode I-node
+ * @param sb    Superblock
+ *
+ * @return Block address
+ *
  */
 uint64_t ext4_inode_get_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb)
 {
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX) {
-		return ((uint32_t)uint16_t_le2host(inode->osd2.linux2.file_acl_high)) << 16 |
+	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX)
+		return ((uint32_t)
+		    uint16_t_le2host(inode->osd2.linux2.file_acl_high)) << 16 |
 		    (uint32_t_le2host(inode->file_acl_lo));
-	}
-
+	
 	return uint32_t_le2host(inode->file_acl_lo);
 }
@@ -383,29 +428,30 @@
 /** Set address of block, where are extended attributes located.
  *
- * @param inode			i-node
- * @param sb			superblock
- * @param file_acl		block address
+ * @param inode    I-node
+ * @param sb       Superblock
+ * @param file_acl Block address
+ *
  */
 void ext4_inode_set_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb,
-		uint64_t file_acl)
+    uint64_t file_acl)
 {
 	inode->file_acl_lo = host2uint32_t_le((file_acl << 32) >> 32);
-
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX) {
+	
+	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX)
 		inode->osd2.linux2.file_acl_high = host2uint16_t_le(file_acl >> 32);
-	}
-}
-
-/***********************************************************************/
+}
 
 /** Get block address of specified direct block.
  *
- * @param inode		i-node to load block from
- * @param idx		index of logical block
- * @return		physical block address
+ * @param inode I-node to load block from
+ * @param idx   Index of logical block
+ *
+ * @return Physical block address
+ *
  */
 uint32_t ext4_inode_get_direct_block(ext4_inode_t *inode, uint32_t idx)
 {
 	assert(idx < EXT4_INODE_DIRECT_BLOCK_COUNT);
+	
 	return uint32_t_le2host(inode->blocks[idx]);
 }
@@ -413,11 +459,13 @@
 /** Set block address of specified direct block.
  *
- * @param inode		i-node to set block address to
- * @param idx		index of logical block
- * @param fblock	physical block address
+ * @param inode  I-node to set block address to
+ * @param idx    Index of logical block
+ * @param fblock Physical block address
+ *
  */
 void ext4_inode_set_direct_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock)
 {
 	assert(idx < EXT4_INODE_DIRECT_BLOCK_COUNT);
+	
 	inode->blocks[idx] = host2uint32_t_le(fblock);
 }
@@ -425,7 +473,9 @@
 /** Get block address of specified indirect block.
  *
- * @param inode		i-node to get block address from
- * @param idx		index of indirect block 
- * @return		physical block address
+ * @param inode I-node to get block address from
+ * @param idx   Index of indirect block 
+ *
+ * @return Physical block address
+ *
  */
 uint32_t ext4_inode_get_indirect_block(ext4_inode_t *inode, uint32_t idx)
@@ -436,21 +486,27 @@
 /** Set block address of specified indirect block.
  *
- * @param inode		i-node to set block address to
- * @param idx		index of indirect block
- * @param fblock	physical block address
- */
-void ext4_inode_set_indirect_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock)
-{
-	inode->blocks[idx + EXT4_INODE_INDIRECT_BLOCK] = host2uint32_t_le(fblock);
+ * @param inode  I-node to set block address to
+ * @param idx    Index of indirect block
+ * @param fblock Physical block address
+ *
+ */
+void ext4_inode_set_indirect_block(ext4_inode_t *inode, uint32_t idx,
+    uint32_t fblock)
+{
+	inode->blocks[idx + EXT4_INODE_INDIRECT_BLOCK] =
+	    host2uint32_t_le(fblock);
 }
 
 /** Check if i-node has specified type.
  *
- * @param sb		superblock
- * @param inode		i-node to check type of
- * @param type		type to check
- * @return 		result of check operation
- */
-bool ext4_inode_is_type(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t type)
+ * @param sb    Superblock
+ * @param inode I-node to check type of
+ * @param type  Type to check
+ *
+ * @return Result of check operation
+ *
+ */
+bool ext4_inode_is_type(ext4_superblock_t *sb, ext4_inode_t *inode,
+    uint32_t type)
 {
 	uint32_t mode = ext4_inode_get_mode(sb, inode);
@@ -460,23 +516,27 @@
 /** Get extent header from the root of the extent tree.
  *
- * @param inode		i-node to get extent header from
- * @return		pointer to extent header of the root node
+ * @param inode I-node to get extent header from
+ *
+ * @return Pointer to extent header of the root node
+ *
  */
 ext4_extent_header_t * ext4_inode_get_extent_header(ext4_inode_t *inode)
 {
-	return (ext4_extent_header_t *)inode->blocks;
+	return (ext4_extent_header_t *) inode->blocks;
 }
 
 /** Check if i-node has specified flag.
  *
- * @param inode		i-node to check flags of
- * @param flag		flag to check
- * @return		result of check operation
+ * @param inode I-node to check flags of
+ * @param flag  Flag to check
+ *
+ * @return Result of check operation
+ *
  */
 bool ext4_inode_has_flag(ext4_inode_t *inode, uint32_t flag)
 {
-	if (ext4_inode_get_flags(inode) & flag) {
+	if (ext4_inode_get_flags(inode) & flag)
 		return true;
-	}
+	
 	return false;
 }
@@ -484,6 +544,7 @@
 /** Remove specified flag from i-node.
  *
- * @param inode		i-node to clear flag on
- * @param clear_flag	flag to be cleared
+ * @param inode      I-node to clear flag on
+ * @param clear_flag Flag to be cleared
+ *
  */
 void ext4_inode_clear_flag(ext4_inode_t *inode, uint32_t clear_flag)
@@ -496,6 +557,7 @@
 /** Set specified flag to i-node.
  *
- * @param inode		i-node to set flag on
- * @param set_flag	falt to be set
+ * @param inode    I-node to set flag on
+ * @param set_flag Flag to be set
+ *
  */
 void ext4_inode_set_flag(ext4_inode_t *inode, uint32_t set_flag)
@@ -508,24 +570,24 @@
 /** Check if i-node can be truncated.
  *
- * @param sb		superblock
- * @param inode		i-node to check
- * @return 		result of the check operation
+ * @param sb    Superblock
+ * @param inode I-node to check
+ *
+ * @return Result of the check operation
+ *
  */
 bool ext4_inode_can_truncate(ext4_superblock_t *sb, ext4_inode_t *inode)
 {
-	 if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_APPEND)
-			 || ext4_inode_has_flag(inode, EXT4_INODE_FLAG_IMMUTABLE)) {
-		 return false;
-	 }
-
-	 if (ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)
-			 || ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_DIRECTORY)) {
-		 return true;
-	 }
-
-	 return false;
+	if ((ext4_inode_has_flag(inode, EXT4_INODE_FLAG_APPEND)) ||
+	    (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_IMMUTABLE)))
+		return false;
+	
+	if ((ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)) ||
+	    (ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_DIRECTORY)))
+		return true;
+	
+	return false;
 }
 
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_inode.h
===================================================================
--- uspace/lib/ext4/libext4_inode.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_inode.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_INODE_H_
@@ -56,6 +56,8 @@
 extern uint16_t ext4_inode_get_links_count(ext4_inode_t *);
 extern void ext4_inode_set_links_count(ext4_inode_t *, uint16_t);
-extern uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *, ext4_inode_t *);
-extern int ext4_inode_set_blocks_count(ext4_superblock_t *, ext4_inode_t *, uint64_t);
+extern uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *,
+    ext4_inode_t *);
+extern int ext4_inode_set_blocks_count(ext4_superblock_t *, ext4_inode_t *,
+    uint64_t);
 extern uint32_t ext4_inode_get_flags(ext4_inode_t *);
 extern void ext4_inode_set_flags(ext4_inode_t *, uint32_t);
@@ -63,16 +65,6 @@
 extern void ext4_inode_set_generation(ext4_inode_t *, uint32_t);
 extern uint64_t ext4_inode_get_file_acl(ext4_inode_t *, ext4_superblock_t *);
-extern void ext4_inode_set_file_acl(ext4_inode_t *, ext4_superblock_t *, uint64_t);
-/*
-uint16_t extra_isize;
-uint32_t ctime_extra; // Extra change time (nsec << 2 | epoch)
-uint32_t mtime_extra; // Extra Modification time (nsec << 2 | epoch)
-uint32_t atime_extra; // Extra Access time (nsec << 2 | epoch)
-uint32_t crtime; // File creation time
-uint32_t crtime_extra; // Extra file creation time (nsec << 2 | epoch)
-uint32_t version_hi;   // High 32 bits for 64-bit version
-*/
-
-/******************************************/
+extern void ext4_inode_set_file_acl(ext4_inode_t *, ext4_superblock_t *,
+    uint64_t);
 
 extern uint32_t ext4_inode_get_direct_block(ext4_inode_t *, uint32_t);
Index: uspace/lib/ext4/libext4_superblock.c
===================================================================
--- uspace/lib/ext4/libext4_superblock.c	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_superblock.c	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,9 +29,9 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 /**
- * @file	libext4_superblock.c
- * @brief	Ext4 superblock operations.
+ * @file  libext4_superblock.c
+ * @brief Ext4 superblock operations.
  */
 
@@ -44,6 +44,8 @@
 /** Get number of i-nodes in the whole filesystem.
  *
- * @param sb		superblock
- * @return			number of i-nodes
+ * @param sb Superblock
+ *
+ * @return Number of i-nodes
+ *
  */
 uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *sb)
@@ -54,6 +56,7 @@
 /** Set number of i-nodes in the whole filesystem.
  *
- * @param sb		superblock
- * @param count		number of i-nodes
+ * @param sb    Superblock
+ * @param count Number of i-nodes
+ *
  */
 void ext4_superblock_set_inodes_count(ext4_superblock_t *sb, uint32_t count)
@@ -64,17 +67,20 @@
 /** Get number of data blocks in the whole filesystem.
  *
- * @param sb		superblock
- * @return			number of data blocks
+ * @param sb Superblock
+ *
+ * @return Number of data blocks
+ *
  */
 uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *sb)
 {
-	return ((uint64_t)uint32_t_le2host(sb->blocks_count_hi) << 32) |
-			uint32_t_le2host(sb->blocks_count_lo);
+	return ((uint64_t) uint32_t_le2host(sb->blocks_count_hi) << 32) |
+	    uint32_t_le2host(sb->blocks_count_lo);
 }
 
 /** Set number of data blocks in the whole filesystem.
  *
- * @param sb		superblock
- * @param count		number of data blocks
+ * @param sb    Superblock
+ * @param count Number of data blocks
+ *
  */
 void ext4_superblock_set_blocks_count(ext4_superblock_t *sb, uint64_t count)
@@ -86,19 +92,24 @@
 /** Get number of reserved data blocks in the whole filesystem.
  *
- * @param sb		superblock
- * @return			number of reserved data blocks
+ * @param sb Superblock
+ *
+ * @return Number of reserved data blocks
+ *
  */
 uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *sb)
 {
-	return ((uint64_t)uint32_t_le2host(sb->reserved_blocks_count_hi) << 32) |
-			uint32_t_le2host(sb->reserved_blocks_count_lo);
+	return ((uint64_t)
+	    uint32_t_le2host(sb->reserved_blocks_count_hi) << 32) |
+	    uint32_t_le2host(sb->reserved_blocks_count_lo);
 }
 
 /** Set number of reserved data blocks in the whole filesystem.
  *
- * @param sb		superblock
- * @param count		number of reserved data blocks
- */
-void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *sb, uint64_t count)
+ * @param sb    Superblock
+ * @param count Number of reserved data blocks
+ *
+ */
+void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *sb,
+    uint64_t count)
 {
 	sb->reserved_blocks_count_lo = host2uint32_t_le((count << 32) >> 32);
@@ -108,19 +119,24 @@
 /** Get number of free data blocks in the whole filesystem.
  *
- * @param sb		superblock
- * @return			number of free data blocks
+ * @param sb Superblock
+ *
+ * @return Number of free data blocks
+ *
  */
 uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *sb)
 {
-	return ((uint64_t)uint32_t_le2host(sb->free_blocks_count_hi) << 32) |
-			uint32_t_le2host(sb->free_blocks_count_lo);
+	return ((uint64_t)
+	    uint32_t_le2host(sb->free_blocks_count_hi) << 32) |
+	    uint32_t_le2host(sb->free_blocks_count_lo);
 }
 
 /** Set number of free data blocks in the whole filesystem.
  *
- * @param sb		superblock
- * @param count 	number of free data blocks
- */
-void ext4_superblock_set_free_blocks_count(ext4_superblock_t *sb, uint64_t count)
+ * @param sb    Superblock
+ * @param count Number of free data blocks
+ *
+ */
+void ext4_superblock_set_free_blocks_count(ext4_superblock_t *sb,
+    uint64_t count)
 {
 	sb->free_blocks_count_lo = host2uint32_t_le((count << 32) >> 32);
@@ -130,6 +146,8 @@
 /** Get number of free i-nodes in the whole filesystem.
  *
- * @param sb		superblock
- * @return			number of free i-nodes
+ * @param sb Superblock
+ *
+ * @return Number of free i-nodes
+ *
  */
 uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *sb)
@@ -140,16 +158,20 @@
 /** Set number of free i-nodes in the whole filesystem.
  *
- * @param sb		superblock
- * @param count 	number of free i-nodes
- */
-void ext4_superblock_set_free_inodes_count(ext4_superblock_t *sb, uint32_t count)
+ * @param sb    Superblock
+ * @param count Number of free i-nodes
+ *
+ */
+void ext4_superblock_set_free_inodes_count(ext4_superblock_t *sb,
+    uint32_t count)
 {
 	sb->free_inodes_count = host2uint32_t_le(count);
 }
 
-/** Get index of first data block (block, where is located superblock)
- *
- * @param sb		superblock
- * @return			index of the first data block
+/** Get index of first data block (block where the superblock is located)
+ *
+ * @param sb Superblock
+ *
+ * @return Index of the first data block
+ *
  */
 uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *sb)
@@ -158,10 +180,12 @@
 }
 
-/** Set index of first data block (block, where is located superblock)
- *
- * @param sb		superblock
- * @param first 	index of the first data block
- */
-void ext4_superblock_set_first_data_block(ext4_superblock_t *sb, uint32_t first)
+/** Set index of first data block (block where the superblock is located)
+ *
+ * @param sb    Superblock
+ * @param first Index of the first data block
+ *
+ */
+void ext4_superblock_set_first_data_block(ext4_superblock_t *sb,
+    uint32_t first)
 {
 	sb->first_data_block = host2uint32_t_le(first);
@@ -170,6 +194,8 @@
 /** Get logarithmic block size (1024 << size == block_size)
  *
- * @param sb		superblock
- * @return			logarithmic block size
+ * @param sb Superblock
+ *
+ * @return Logarithmic block size
+ *
  */
 uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *sb)
@@ -180,8 +206,11 @@
 /** Set logarithmic block size (1024 << size == block_size)
  *
- * @param sb		superblock
- * @return			logarithmic block size
- */
-void ext4_superblock_set_log_block_size(ext4_superblock_t *sb, uint32_t log_size)
+ * @param sb Superblock
+ *
+ * @return Logarithmic block size
+ *
+ */
+void ext4_superblock_set_log_block_size(ext4_superblock_t *sb,
+    uint32_t log_size)
 {
 	sb->log_block_size = host2uint32_t_le(log_size);
@@ -190,6 +219,8 @@
 /** Get size of data block (in bytes).
  *
- * @param sb		superblock
- * @return			size of data block
+ * @param sb Superblock
+ *
+ * @return Size of data block
+ *
  */
 uint32_t ext4_superblock_get_block_size(ext4_superblock_t *sb)
@@ -200,6 +231,7 @@
 /** Set size of data block (in bytes).
  *
- * @param sb		superblock
- * @param size		size of data block (must be power of 2, at least 1024)
+ * @param sb   Superblock
+ * @param size Size of data block (must be power of 2, at least 1024)
+ *
  */
 void ext4_superblock_set_block_size(ext4_superblock_t *sb, uint32_t size)
@@ -207,5 +239,5 @@
 	uint32_t log = 0;
 	uint32_t tmp = size / EXT4_MIN_BLOCK_SIZE;
-
+	
 	tmp >>= 1;
 	while (tmp) {
@@ -213,5 +245,5 @@
 		tmp >>= 1;
 	}
-
+	
 	ext4_superblock_set_log_block_size(sb, log);
 }
@@ -219,6 +251,8 @@
 /** Get logarithmic fragment size (1024 << size)
  *
- * @param sb		superblock
- * @return			logarithmic fragment size
+ * @param sb Superblock
+ *
+ * @return Logarithmic fragment size
+ *
  */
 uint32_t ext4_superblock_get_log_frag_size(ext4_superblock_t *sb)
@@ -229,9 +263,10 @@
 /** Set logarithmic fragment size (1024 << size)
  *
- * @param sb		superblock
- * @return			logarithmic fragment size
- */
-
-void ext4_superblock_set_log_frag_size(ext4_superblock_t *sb, uint32_t frag_size)
+ * @param sb        Superblock
+ * @param frag_size Logarithmic fragment size
+ *
+ */
+void ext4_superblock_set_log_frag_size(ext4_superblock_t *sb,
+    uint32_t frag_size)
 {
 	sb->log_frag_size = host2uint32_t_le(frag_size);
@@ -240,6 +275,8 @@
 /** Get size of fragment (in bytes).
  *
- * @param sb		superblock
- * @return			size of fragment
+ * @param sb Superblock
+ *
+ * @return Size of fragment
+ *
  */
 uint32_t ext4_superblock_get_frag_size(ext4_superblock_t *sb)
@@ -250,6 +287,7 @@
 /** Set size of fragment (in bytes).
  *
- * @param sb		superblock
- * @param size		size of fragment (must be power of 2, at least 1024)
+ * @param sb   Superblock
+ * @param size Size of fragment (must be power of 2, at least 1024)
+ *
  */
 void ext4_superblock_set_frag_size(ext4_superblock_t *sb, uint32_t size)
@@ -257,5 +295,5 @@
 	uint32_t log = 0;
 	uint32_t tmp = size / EXT4_MIN_BLOCK_SIZE;
-
+	
 	tmp >>= 1;
 	while (tmp) {
@@ -263,5 +301,5 @@
 		tmp >>= 1;
 	}
-
+	
 	ext4_superblock_set_log_frag_size(sb, log);
 }
@@ -269,6 +307,8 @@
 /** Get number of data blocks per block group (except last BG)
  *
- * @param sb		superblock
- * @return			data blocks per block group
+ * @param sb Superblock
+ *
+ * @return Data blocks per block group
+ *
  */
 uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *sb)
@@ -279,8 +319,10 @@
 /** Set number of data blocks per block group (except last BG)
  *
- * @param sb		superblock
- * @param blocks	data blocks per block group
- */
-void ext4_superblock_set_blocks_per_group(ext4_superblock_t *sb, uint32_t blocks)
+ * @param sb     Superblock
+ * @param blocks Data blocks per block group
+ *
+ */
+void ext4_superblock_set_blocks_per_group(ext4_superblock_t *sb,
+    uint32_t blocks)
 {
 	sb->blocks_per_group = host2uint32_t_le(blocks);
@@ -289,6 +331,8 @@
 /** Get number of fragments per block group (except last BG)
  *
- * @param sb		superblock
- * @return			fragments per block group
+ * @param sb Superblock
+ *
+ * @return Fragments per block group
+ *
  */
 uint32_t ext4_superblock_get_frags_per_group(ext4_superblock_t *sb)
@@ -299,6 +343,6 @@
 /** Set number of fragment per block group (except last BG)
  *
- * @param sb		superblock
- * @param frags		fragments per block group
+ * @param sb    Superblock
+ * @param frags Fragments per block group
  */
 void ext4_superblock_set_frags_per_group(ext4_superblock_t *sb, uint32_t frags)
@@ -307,9 +351,10 @@
 }
 
-
 /** Get number of i-nodes per block group (except last BG)
  *
- * @param sb		superblock
- * @return			i-nodes per block group
+ * @param sb Superblock
+ *
+ * @return I-nodes per block group
+ *
  */
 uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *sb)
@@ -320,8 +365,10 @@
 /** Set number of i-nodes per block group (except last BG)
  *
- * @param sb		superblock
- * @param inodes	i-nodes per block group
- */
-void ext4_superblock_set_inodes_per_group(ext4_superblock_t *sb, uint32_t inodes)
+ * @param sb     Superblock
+ * @param inodes I-nodes per block group
+ *
+ */
+void ext4_superblock_set_inodes_per_group(ext4_superblock_t *sb,
+    uint32_t inodes)
 {
 	sb->inodes_per_group = host2uint32_t_le(inodes);
@@ -330,6 +377,8 @@
 /** Get time when filesystem was mounted (POSIX time).
  *
- * @param sb		superblock
- * @return			mount time
+ * @param sb Superblock
+ *
+ * @return Mount time
+ *
  */
 uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *sb)
@@ -340,6 +389,7 @@
 /** Set time when filesystem was mounted (POSIX time).
  *
- * @param sb		superblock
- * @param time		mount time
+ * @param sb   Superblock
+ * @param time Mount time
+ *
  */
 void ext4_superblock_set_mount_time(ext4_superblock_t *sb, uint32_t time)
@@ -350,6 +400,8 @@
 /** Get time when filesystem was last accesed by write operation (POSIX time).
  *
- * @param sb		superblock
- * @return			write time
+ * @param sb Superblock
+ *
+ * @return Write time
+ *
  */
 uint32_t ext4_superblock_get_write_time(ext4_superblock_t *sb)
@@ -360,6 +412,7 @@
 /** Set time when filesystem was last accesed by write operation (POSIX time).
  *
- * @param sb		superblock
- * @param time		write time
+ * @param sb   Superblock
+ * @param time Write time
+ *
  */
 void ext4_superblock_set_write_time(ext4_superblock_t *sb, uint32_t time)
@@ -370,6 +423,8 @@
 /** Get number of mount from last filesystem check.
  *
- * @param sb		superblock
- * @return			number of mounts
+ * @param sb Superblock
+ *
+ * @return Number of mounts
+ *
  */
 uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *sb)
@@ -380,6 +435,7 @@
 /** Set number of mount from last filesystem check.
  *
- * @param sb		superblock
- * @param count		number of mounts
+ * @param sb    Superblock
+ * @param count Number of mounts
+ *
  */
 void ext4_superblock_set_mount_count(ext4_superblock_t *sb, uint16_t count)
@@ -390,6 +446,8 @@
 /** Get maximum number of mount from last filesystem check.
  *
- * @param sb		superblock
- * @return			maximum number of mounts
+ * @param sb Superblock
+ *
+ * @return Maximum number of mounts
+ *
  */
 uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *sb)
@@ -400,6 +458,7 @@
 /** Set maximum number of mount from last filesystem check.
  *
- * @param sb		superblock
- * @param count		maximum number of mounts
+ * @param sb    Superblock
+ * @param count Maximum number of mounts
+ *
  */
 void ext4_superblock_set_max_mount_count(ext4_superblock_t *sb, uint16_t count)
@@ -410,6 +469,8 @@
 /** Get superblock magic value.
  *
- * @param sb		superblock
- * @return			magic value
+ * @param sb Superblock
+ *
+ * @return Magic value
+ *
  */
 uint16_t ext4_superblock_get_magic(ext4_superblock_t *sb)
@@ -420,6 +481,7 @@
 /** Set superblock magic value.
  *
- * @param sb		superblock
- * @param			magic value
+ * @param sb    Superblock
+ * @param magic Magic value
+ *
  */
 void ext4_superblock_set_magic(ext4_superblock_t *sb, uint16_t magic)
@@ -430,6 +492,8 @@
 /** Get filesystem state.
  *
- * @param sb		superblock
- * @return			filesystem state
+ * @param sb Superblock
+ *
+ * @return Filesystem state
+ *
  */
 uint16_t ext4_superblock_get_state(ext4_superblock_t *sb)
@@ -440,6 +504,7 @@
 /** Set filesystem state.
  *
- * @param sb		superblock
- * @param state		filesystem state
+ * @param sb    Superblock
+ * @param state Filesystem state
+ *
  */
 void ext4_superblock_set_state(ext4_superblock_t *sb, uint16_t state)
@@ -450,6 +515,8 @@
 /** Get behavior code when errors detected.
  *
- * @param sb		superblock
- * @return			behavior code
+ * @param sb Superblock
+ *
+ * @return Behavior code
+ *
  */
 uint16_t ext4_superblock_get_errors(ext4_superblock_t *sb)
@@ -460,6 +527,7 @@
 /** Set behavior code when errors detected.
  *
- * @param sb		superblock
- * @param errors 	behavior code
+ * @param sb     Superblock
+ * @param errors Behavior code
+ *
  */
 void ext4_superblock_set_errors(ext4_superblock_t *sb, uint16_t errors)
@@ -470,6 +538,8 @@
 /** Get minor revision level of the filesystem.
  *
- * @param sb		superblock
- * @return			minor revision level
+ * @param sb Superblock
+ *
+ * @return Minor revision level
+ *
  */
 uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *sb)
@@ -480,6 +550,7 @@
 /** Set minor revision level of the filesystem.
  *
- * @param sb		superblock
- * @param level 	minor revision level
+ * @param sb    Superblock
+ * @param level Minor revision level
+ *
  */
 void ext4_superblock_set_minor_rev_level(ext4_superblock_t *sb, uint16_t level)
@@ -490,6 +561,8 @@
 /** Get time of the last filesystem check.
  *
- * @param sb		superblock
- * @return			time of the last check (POSIX)
+ * @param sb Superblock
+ *
+ * @return Time of the last check (POSIX)
+ *
  */
 uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *sb)
@@ -500,6 +573,7 @@
 /** Set time of the last filesystem check.
  *
- * @param sb		superblock
- * @param time		time of the last check (POSIX)
+ * @param sb   Superblock
+ * @param time Time of the last check (POSIX)
+ *
  */
 void ext4_superblock_set_last_check_time(ext4_superblock_t *sb, uint32_t time)
@@ -510,8 +584,11 @@
 /** Get maximum time interval between two filesystem checks.
  *
- * @param sb		superblock
- * @return			time interval between two check (POSIX)
- */
-uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *sb){
+ * @param sb Superblock
+ *
+ * @return Time interval between two check (POSIX)
+ *
+ */
+uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *sb)
+{
 	return uint32_t_le2host(sb->check_interval);
 }
@@ -519,6 +596,7 @@
 /** Set maximum time interval between two filesystem checks.
  *
- * @param sb			superblock
- * @param interval		time interval between two check (POSIX)
+ * @param sb       Superblock
+ * @param interval Time interval between two check (POSIX)
+ *
  */
 void ext4_superblock_set_check_interval(ext4_superblock_t *sb, uint32_t interval)
@@ -529,6 +607,8 @@
 /** Get operation system identifier, on which the filesystem was created.
  *
- * @param sb		superblock
- * @return			operation system identifier
+ * @param sb Superblock
+ *
+ * @return Operation system identifier
+ *
  */
 uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *sb)
@@ -539,6 +619,7 @@
 /** Set operation system identifier, on which the filesystem was created.
  *
- * @param sb		superblock
- * @param os		operation system identifier
+ * @param sb Superblock
+ * @param os Operation system identifier
+ *
  */
 void ext4_superblock_set_creator_os(ext4_superblock_t *sb, uint32_t os)
@@ -549,6 +630,8 @@
 /** Get revision level of the filesystem.
  *
- * @param sb		superblock
- * @return			revision level
+ * @param sb Superblock
+ *
+ * @return Revision level
+ *
  */
 uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *sb)
@@ -559,6 +642,7 @@
 /** Set revision level of the filesystem.
  *
- * @param sb		superblock
- * @param level 	revision level
+ * @param sb    Superblock
+ * @param level Revision level
+ *
  */
 void ext4_superblock_set_rev_level(ext4_superblock_t *sb, uint32_t level)
@@ -569,6 +653,8 @@
 /** Get default user id for reserved blocks.
  *
- * @param sb		superblock
- * @return			default user id for reserved blocks.
+ * @param sb Superblock
+ *
+ * @return Default user id for reserved blocks.
+ *
  */
 uint16_t ext4_superblock_get_def_resuid(ext4_superblock_t *sb)
@@ -579,6 +665,7 @@
 /** Set default user id for reserved blocks.
  *
- * @param sb		superblock
- * @param uid		default user id for reserved blocks.
+ * @param sb  Superblock
+ * @param uid Default user id for reserved blocks.
+ *
  */
 void ext4_superblock_set_def_resuid(ext4_superblock_t *sb, uint16_t uid)
@@ -589,6 +676,8 @@
 /** Get default group id for reserved blocks.
  *
- * @param sb		superblock
- * @return			default group id for reserved blocks.
+ * @param sb Superblock
+ *
+ * @return Default group id for reserved blocks.
+ *
  */
 uint16_t ext4_superblock_get_def_resgid(ext4_superblock_t *sb)
@@ -599,6 +688,7 @@
 /** Set default group id for reserved blocks.
  *
- * @param sb		superblock
- * @param gid		default group id for reserved blocks.
+ * @param sb  Superblock
+ * @param gid Default group id for reserved blocks.
+ *
  */
 void ext4_superblock_set_def_resgid(ext4_superblock_t *sb, uint16_t gid)
@@ -609,6 +699,8 @@
 /** Get index of the first i-node, which can be used for allocation.
  *
- * @param sb		superblock
- * @return			i-node index
+ * @param sb Superblock
+ *
+ * @return I-node index
+ *
  */
 uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *sb)
@@ -619,8 +711,10 @@
 /** Set index of the first i-node, which can be used for allocation.
  *
- * @param sb			superblock
- * @param first_inode	i-node index
- */
-void ext4_superblock_set_first_inode(ext4_superblock_t *sb, uint32_t first_inode)
+ * @param sb          Superblock
+ * @param first_inode I-node index
+ *
+ */
+void ext4_superblock_set_first_inode(ext4_superblock_t *sb,
+    uint32_t first_inode)
 {
 	sb->first_inode = host2uint32_t_le(first_inode);
@@ -631,12 +725,14 @@
  * For the oldest revision return constant number.
  *
- * @param sb			superblock
- * @return				size of i-node structure
+ * @param sb Superblock
+ *
+ * @return Size of i-node structure
+ *
  */
 uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *sb)
 {
-	if (ext4_superblock_get_rev_level(sb) == 0) {
+	if (ext4_superblock_get_rev_level(sb) == 0)
 		return EXT4_REV0_INODE_SIZE;
-	}
+	
 	return uint16_t_le2host(sb->inode_size);
 }
@@ -644,6 +740,7 @@
 /** Set size of i-node structure.
  *
- * @param sb			superblock
- * @param size			size of i-node structure
+ * @param sb   Superblock
+ * @param size Size of i-node structure
+ *
  */
 void ext4_superblock_set_inode_size(ext4_superblock_t *sb, uint16_t size)
@@ -654,6 +751,8 @@
 /** Get index of block group, where superblock copy is located.
  *
- * @param sb			superblock
- * @return				block group index
+ * @param sb Superblock
+ *
+ * @return Block group index
+ *
  */
 uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *sb)
@@ -664,6 +763,7 @@
 /** Set index of block group, where superblock copy is located.
  *
- * @param sb			superblock
- * @param bgid			block group index
+ * @param sb   Superblock
+ * @param bgid Block group index
+ *
  */
 void ext4_superblock_set_block_group_index(ext4_superblock_t *sb, uint16_t bgid)
@@ -674,6 +774,8 @@
 /** Get compatible features supported by the filesystem.
  *
- * @param sb		superblock
- * @return			compatible features bitmap
+ * @param sb Superblock
+ *
+ * @return Compatible features bitmap
+ *
  */
 uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *sb)
@@ -684,8 +786,10 @@
 /** Set compatible features supported by the filesystem.
  *
- * @param sb			superblock
- * @param features		compatible features bitmap
- */
-void ext4_superblock_set_features_compatible(ext4_superblock_t *sb, uint32_t features)
+ * @param sb       Superblock
+ * @param features Compatible features bitmap
+ *
+ */
+void ext4_superblock_set_features_compatible(ext4_superblock_t *sb,
+    uint32_t features)
 {
 	sb->features_compatible = host2uint32_t_le(features);
@@ -694,6 +798,8 @@
 /** Get incompatible features supported by the filesystem.
  *
- * @param sb		superblock
- * @return			incompatible features bitmap
+ * @param sb Superblock
+ *
+ * @return Incompatible features bitmap
+ *
  */
 uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *sb)
@@ -704,8 +810,10 @@
 /** Set incompatible features supported by the filesystem.
  *
- * @param sb			superblock
- * @param features		incompatible features bitmap
- */
-void ext4_superblock_set_features_incompatible(ext4_superblock_t *sb, uint32_t features)
+ * @param sb       Superblock
+ * @param features Incompatible features bitmap
+ *
+ */
+void ext4_superblock_set_features_incompatible(ext4_superblock_t *sb,
+    uint32_t features)
 {
 	sb->features_incompatible = host2uint32_t_le(features);
@@ -714,6 +822,8 @@
 /** Get compatible features supported by the filesystem.
  *
- * @param sb		superblock
- * @return			read-only compatible features bitmap
+ * @param sb Superblock
+ *
+ * @return Read-only compatible features bitmap
+ *
  */
 uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *sb)
@@ -724,8 +834,10 @@
 /** Set compatible features supported by the filesystem.
  *
- * @param sb			superblock
- * @param feature		read-only compatible features bitmap
- */
-void ext4_superblock_set_features_read_only(ext4_superblock_t *sb, uint32_t features)
+ * @param sb      Superblock
+ * @param feature Read-only compatible features bitmap
+ *
+ */
+void ext4_superblock_set_features_read_only(ext4_superblock_t *sb,
+    uint32_t features)
 {
 	sb->features_read_only = host2uint32_t_le(features);
@@ -734,8 +846,10 @@
 /** Get UUID of the filesystem.
  *
- * @param sb		superblock
- * @return 			pointer to UUID array
- */
-const uint8_t * ext4_superblock_get_uuid(ext4_superblock_t *sb)
+ * @param sb superblock
+ *
+ * @return Pointer to UUID array
+ *
+ */
+const uint8_t *ext4_superblock_get_uuid(ext4_superblock_t *sb)
 {
 	return sb->uuid;
@@ -744,6 +858,7 @@
 /** Set UUID of the filesystem.
  *
- * @param sb		superblock
- * @param uuid		pointer to UUID array
+ * @param sb   Superblock
+ * @param uuid Pointer to UUID array
+ *
  */
 void ext4_superblock_set_uuid(ext4_superblock_t *sb, const uint8_t *uuid)
@@ -754,8 +869,10 @@
 /** Get name of the filesystem volume.
  *
- * @param sb		superblock
- * @return			name of the volume
- */
-const char * ext4_superblock_get_volume_name(ext4_superblock_t *sb)
+ * @param sb Superblock
+ *
+ * @return Name of the volume
+ *
+ */
+const char *ext4_superblock_get_volume_name(ext4_superblock_t *sb)
 {
 	return sb->volume_name;
@@ -764,6 +881,6 @@
 /** Set name of the filesystem volume.
  *
- * @param sb		superblock
- * @param name		new name of the volume
+ * @param sb   Superblock
+ * @param name New name of the volume
  */
 void ext4_superblock_set_volume_name(ext4_superblock_t *sb, const char *name)
@@ -774,8 +891,10 @@
 /** Get name of the directory, where this filesystem was mounted at last.
  *
- * @param sb		superblock
- * @return 			directory name
- */
-const char * ext4_superblock_get_last_mounted(ext4_superblock_t *sb)
+ * @param sb Superblock
+ *
+ * @return Directory name
+ *
+ */
+const char *ext4_superblock_get_last_mounted(ext4_superblock_t *sb)
 {
 	return sb->last_mounted;
@@ -784,6 +903,7 @@
 /** Set name of the directory, where this filesystem was mounted at last.
  *
- * @param sb		superblock
- * @param last		directory name
+ * @param sb   Superblock
+ * @param last Directory name
+ *
  */
 void ext4_superblock_set_last_mounted(ext4_superblock_t *sb, const char *last)
@@ -796,6 +916,8 @@
  * Orphans are stored in linked list.
  *
- * @param sb		superblock
- * @return			last orphaned i-node index
+ * @param sb Superblock
+ *
+ * @return Last orphaned i-node index
+ *
  */
 uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *sb)
@@ -808,8 +930,10 @@
  * Orphans are stored in linked list.
  *
- * @param sb			superblock
- * @param last_orphan	last orphaned i-node index
- */
-void ext4_superblock_set_last_orphan(ext4_superblock_t *sb, uint32_t last_orphan)
+ * @param sb          Superblock
+ * @param last_orphan Last orphaned i-node index
+ *
+ */
+void ext4_superblock_set_last_orphan(ext4_superblock_t *sb,
+    uint32_t last_orphan)
 {
 	sb->last_orphan = host2uint32_t_le(last_orphan);
@@ -818,8 +942,10 @@
 /** Get hash seed for directory index hash function.
  *
- * @param sb		superblock
- * @return			hash seed pointer
- */
-const uint32_t * ext4_superblock_get_hash_seed(ext4_superblock_t *sb)
+ * @param sb Superblock
+ *
+ * @return Hash seed pointer
+ *
+ */
+const uint32_t *ext4_superblock_get_hash_seed(ext4_superblock_t *sb)
 {
 	return sb->hash_seed;
@@ -828,6 +954,7 @@
 /** Set hash seed for directory index hash function.
  *
- * @param sb		superblock
- * @param seed		hash seed pointer
+ * @param sb   Superblock
+ * @param seed Hash seed pointer
+ *
  */
 void ext4_superblock_set_hash_seed(ext4_superblock_t *sb, const uint32_t *seed)
@@ -838,6 +965,8 @@
 /** Get default version of the hash algorithm version for directory index.
  *
- * @param sb		superblock
- * @return			default hash version
+ * @param sb Superblock
+ *
+ * @return Default hash version
+ *
  */
 uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *sb)
@@ -848,8 +977,10 @@
 /** Set default version of the hash algorithm version for directory index.
  *
- * @param sb		superblock
- * @param version	default hash version
- */
-void ext4_superblock_set_default_hash_version(ext4_superblock_t *sb, uint8_t version)
+ * @param sb      Superblock
+ * @param version Default hash version
+ *
+ */
+void ext4_superblock_set_default_hash_version(ext4_superblock_t *sb,
+    uint8_t version)
 {
 	sb->default_hash_version = version;
@@ -860,15 +991,16 @@
  * Output value is checked for minimal size.
  *
- * @param sb		superblock
- * @return			size of block group descriptor
+ * @param sb Superblock
+ *
+ * @return Size of block group descriptor
+ *
  */
 uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *sb)
 {
 	uint16_t size = uint16_t_le2host(sb->desc_size);
-
-	if (size < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	
+	if (size < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		size = EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE;
-	}
-
+	
 	return size;
 }
@@ -878,13 +1010,14 @@
  * Input value is checked for minimal size.
  *
- * @param sb		superblock
- * @param size 		size of block group descriptor
+ * @param sb   Superblock
+ * @param size Size of block group descriptor
+ *
  */
 void ext4_superblock_set_desc_size(ext4_superblock_t *sb, uint16_t size)
 {
-	if (size < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
-		sb->desc_size = host2uint16_t_le(EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE);
-	}
-
+	if (size < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+		sb->desc_size =
+		    host2uint16_t_le(EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE);
+	
 	sb->desc_size = host2uint16_t_le(size);
 }
@@ -892,6 +1025,8 @@
 /** Get superblock flags.
  *
- * @param sb		superblock
- * @return 			flags from the superblock
+ * @param sb Superblock
+ *
+ * @return Flags from the superblock
+ *
  */
 uint32_t ext4_superblock_get_flags(ext4_superblock_t *sb)
@@ -902,6 +1037,7 @@
 /** Set superblock flags.
  *
- * @param sb		superblock
- * @param flags		flags for the superblock
+ * @param sb    Superblock
+ * @param flags Flags for the superblock
+ *
  */
 void ext4_superblock_set_flags(ext4_superblock_t *sb, uint32_t flags)
@@ -916,13 +1052,15 @@
 /** Check if superblock has specified flag.
  *
- * @param sb			superblock
- * @param flag			flag to be checked
- * @return				true, if superblock has the flag
+ * @param sb   Superblock
+ * @param flag Flag to be checked
+ *
+ * @return True, if superblock has the flag
+ *
  */
 bool ext4_superblock_has_flag(ext4_superblock_t *sb, uint32_t flag)
 {
-	if (ext4_superblock_get_flags(sb) & flag) {
+	if (ext4_superblock_get_flags(sb) & flag)
 		return true;
-	}
+	
 	return false;
 }
@@ -930,13 +1068,16 @@
 /** Check if filesystem supports compatible feature.
  *
- * @param sb			superblock
- * @param feature		feature to be checked
- * @return				true, if filesystem supports the feature
- */
-bool ext4_superblock_has_feature_compatible(ext4_superblock_t *sb, uint32_t feature)
-{
-	if (ext4_superblock_get_features_compatible(sb) & feature) {
+ * @param sb      Superblock
+ * @param feature Feature to be checked
+ *
+ * @return True, if filesystem supports the feature
+ *
+ */
+bool ext4_superblock_has_feature_compatible(ext4_superblock_t *sb,
+    uint32_t feature)
+{
+	if (ext4_superblock_get_features_compatible(sb) & feature)
 		return true;
-	}
+	
 	return false;
 }
@@ -944,13 +1085,16 @@
 /** Check if filesystem supports incompatible feature.
  *
- * @param sb			superblock
- * @param feature		feature to be checked
- * @return				true, if filesystem supports the feature
- */
-bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *sb, uint32_t feature)
-{
-	if (ext4_superblock_get_features_incompatible(sb) & feature) {
+ * @param sb      Superblock
+ * @param feature Feature to be checked
+ *
+ * @return True, if filesystem supports the feature
+ *
+ */
+bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *sb,
+    uint32_t feature)
+{
+	if (ext4_superblock_get_features_incompatible(sb) & feature)
 		return true;
-	}
+	
 	return false;
 }
@@ -958,13 +1102,16 @@
 /** Check if filesystem supports read-only compatible feature.
  *
- * @param sb			superblock
- * @param feature		feature to be checked
- * @return				true, if filesystem supports the feature
- */
-bool ext4_superblock_has_feature_read_only(ext4_superblock_t *sb, uint32_t feature)
-{
-	if (ext4_superblock_get_features_read_only(sb) & feature) {
+ * @param sb      Superblock
+ * @param feature Feature to be checked
+ *
+ * @return True, if filesystem supports the feature
+ *
+ */
+bool ext4_superblock_has_feature_read_only(ext4_superblock_t *sb,
+    uint32_t feature)
+{
+	if (ext4_superblock_get_features_read_only(sb) & feature)
 		return true;
-	}
+	
 	return false;
 }
@@ -972,31 +1119,29 @@
 /** Read superblock directly from block device.
  *
- * @param service_id		block device identifier
- * @param sb				output pointer to memory structure
- * @return					error code.
- */
-int ext4_superblock_read_direct(service_id_t service_id,
-    ext4_superblock_t **sb)
-{
-	int rc;
-
+ * @param service_id Block device identifier
+ * @param sb         Output pointer to memory structure
+ *
+ * @return Eerror code.
+ *
+ */
+int ext4_superblock_read_direct(service_id_t service_id, ext4_superblock_t **sb)
+{
 	/* Allocated memory for superblock structure */
 	void *data = malloc(EXT4_SUPERBLOCK_SIZE);
-	if (data == NULL) {
+	if (data == NULL)
 		return ENOMEM;
-	}
-
+	
 	/* Read data from block device */
-	rc = block_read_bytes_direct(service_id, EXT4_SUPERBLOCK_OFFSET,
+	int rc = block_read_bytes_direct(service_id, EXT4_SUPERBLOCK_OFFSET,
 	    EXT4_SUPERBLOCK_SIZE, data);
-
+	
 	if (rc != EOK) {
 		free(data);
 		return rc;
 	}
-
+	
 	/* Set output value */
 	(*sb) = data;
-
+	
 	return EOK;
 }
@@ -1004,33 +1149,30 @@
 /** Write superblock structure directly to block device.
  *
- * @param service_id		block device identifier
- * @param sb				superblock to be written
- * @return					error code
- */
-int ext4_superblock_write_direct(service_id_t service_id,
-		ext4_superblock_t *sb)
-{
-	int rc;
+ * @param service_id Block device identifier
+ * @param sb         Superblock to be written
+ *
+ * @return Error code
+ *
+ */
+int ext4_superblock_write_direct(service_id_t service_id, ext4_superblock_t *sb)
+{
+	/* Load physical block size from block device */
 	size_t phys_block_size;
-
-	/* Load physical block size from block device */
-	rc = block_get_bsize(service_id, &phys_block_size);
-	if (rc != EOK) {
+	int rc = block_get_bsize(service_id, &phys_block_size);
+	if (rc != EOK)
 		return rc;
-	}
-
+	
 	/* Compute address of the first block */
 	uint64_t first_block = EXT4_SUPERBLOCK_OFFSET / phys_block_size;
+	
 	/* Compute number of block to write */
 	size_t block_count = EXT4_SUPERBLOCK_SIZE / phys_block_size;
-
+	
 	/* Check alignment */
-	if (EXT4_SUPERBLOCK_SIZE % phys_block_size) {
+	if (EXT4_SUPERBLOCK_SIZE % phys_block_size)
 		block_count++;
-	}
-
+	
 	/* Write data */
 	return block_write_direct(service_id, first_block, block_count, sb);
-
 }
 
@@ -1040,45 +1182,40 @@
  * Checks are described by one-line comments in the code.
  *
- * @param sb		superblock to check
- * @return			error code
+ * @param sb Superblock to check
+ *
+ * @return Error code
+ *
  */
 int ext4_superblock_check_sanity(ext4_superblock_t *sb)
 {
-	if (ext4_superblock_get_magic(sb) != EXT4_SUPERBLOCK_MAGIC) {
+	if (ext4_superblock_get_magic(sb) != EXT4_SUPERBLOCK_MAGIC)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_inodes_count(sb) == 0) {
+	
+	if (ext4_superblock_get_inodes_count(sb) == 0)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_blocks_count(sb) == 0) {
+	
+	if (ext4_superblock_get_blocks_count(sb) == 0)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_blocks_per_group(sb) == 0) {
+	
+	if (ext4_superblock_get_blocks_per_group(sb) == 0)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_inodes_per_group(sb) == 0) {
+	
+	if (ext4_superblock_get_inodes_per_group(sb) == 0)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_inode_size(sb) < 128) {
+	
+	if (ext4_superblock_get_inode_size(sb) < 128)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_first_inode(sb) < 11) {
+	
+	if (ext4_superblock_get_first_inode(sb) < 11)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_desc_size(sb) < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	
+	if (ext4_superblock_get_desc_size(sb) <
+	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		return ENOTSUP;
-	}
-
-	if (ext4_superblock_get_desc_size(sb) > EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE) {
+	
+	if (ext4_superblock_get_desc_size(sb) >
+	    EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE)
 		return ENOTSUP;
-	}
-
+	
 	return EOK;
 }
@@ -1086,6 +1223,8 @@
 /** Compute number of block groups in the filesystem.
  *
- * @param sb		superblock
- * @return			number of block groups
+ * @param sb Superblock
+ *
+ * @return Number of block groups
+ *
  */
 uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *sb)
@@ -1093,56 +1232,60 @@
 	uint64_t blocks_count = ext4_superblock_get_blocks_count(sb);
 	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-
+	
 	uint32_t block_groups_count = blocks_count / blocks_per_group;
-
-	if (blocks_count % blocks_per_group) {
+	
+	if (blocks_count % blocks_per_group)
 		block_groups_count++;
-	}
-
+	
 	return block_groups_count;
-
 }
 
 /** Compute number of blocks in specified block group.
  *
- * @param sb			superblock
- * @param bgid			block group index
- * @return				number of blocks
+ * @param sb   Superblock
+ * @param bgid Block group index
+ *
+ * @return Number of blocks
+ *
  */
 uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *sb, uint32_t bgid)
 {
-	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-	uint64_t total_blocks = ext4_superblock_get_blocks_count(sb);
-
-	if (bgid < block_group_count - 1) {
+	uint32_t block_group_count =
+	    ext4_superblock_get_block_group_count(sb);
+	uint32_t blocks_per_group =
+	    ext4_superblock_get_blocks_per_group(sb);
+	uint64_t total_blocks =
+	    ext4_superblock_get_blocks_count(sb);
+	
+	if (bgid < block_group_count - 1)
 		return blocks_per_group;
-	} else {
+	else
 		return (total_blocks - ((block_group_count - 1) * blocks_per_group));
-	}
-
 }
 
 /** Compute number of i-nodes in specified block group.
  *
- * @param sb		superblock
- * @param bgid		block group index
- * @return			number of i-nodes
+ * @param sb   Superblock
+ * @param bgid Block group index
+ *
+ * @return Number of i-nodes
+ *
  */
 uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *sb, uint32_t bgid)
 {
-	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
-	uint32_t total_inodes = ext4_superblock_get_inodes_count(sb);
-
-	if (bgid < block_group_count - 1) {
+	uint32_t block_group_count =
+	    ext4_superblock_get_block_group_count(sb);
+	uint32_t inodes_per_group =
+	    ext4_superblock_get_inodes_per_group(sb);
+	uint32_t total_inodes =
+	    ext4_superblock_get_inodes_count(sb);
+	
+	if (bgid < block_group_count - 1)
 		return inodes_per_group;
-	} else {
+	else
 		return (total_inodes - ((block_group_count - 1) * inodes_per_group));
-	}
-
 }
 
 /**
  * @}
- */ 
+ */
Index: uspace/lib/ext4/libext4_superblock.h
===================================================================
--- uspace/lib/ext4/libext4_superblock.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_superblock.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -36,5 +36,4 @@
 #include <libblock.h>
 #include <sys/types.h>
-
 #include "libext4_types.h"
 
@@ -44,9 +43,12 @@
 extern void ext4_superblock_set_blocks_count(ext4_superblock_t *, uint64_t);
 extern uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *);
-extern void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *, uint64_t);
+extern void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *,
+    uint64_t);
 extern uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *);
-extern void ext4_superblock_set_free_blocks_count(ext4_superblock_t *, uint64_t);
+extern void ext4_superblock_set_free_blocks_count(ext4_superblock_t *,
+    uint64_t);
 extern uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *);
-extern void ext4_superblock_set_free_inodes_count(ext4_superblock_t *, uint32_t);
+extern void ext4_superblock_set_free_inodes_count(ext4_superblock_t *,
+    uint32_t);
 extern uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *);
 extern void ext4_superblock_set_first_data_block(ext4_superblock_t *, uint32_t);
@@ -98,11 +100,15 @@
 extern void ext4_superblock_set_inode_size(ext4_superblock_t *, uint16_t);
 extern uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *);
-extern void ext4_superblock_set_block_group_index(ext4_superblock_t *, uint16_t);
-extern uint32_t	ext4_superblock_get_features_compatible(ext4_superblock_t *);
-extern void	ext4_superblock_set_features_compatible(ext4_superblock_t *, uint32_t);
-extern uint32_t	ext4_superblock_get_features_incompatible(ext4_superblock_t *);
-extern void	ext4_superblock_set_features_incompatible(ext4_superblock_t *, uint32_t);
-extern uint32_t	ext4_superblock_get_features_read_only(ext4_superblock_t *);
-extern void	ext4_superblock_set_features_read_only(ext4_superblock_t *, uint32_t);
+extern void ext4_superblock_set_block_group_index(ext4_superblock_t *,
+    uint16_t);
+extern uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *);
+extern void ext4_superblock_set_features_compatible(ext4_superblock_t *,
+    uint32_t);
+extern uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *);
+extern void ext4_superblock_set_features_incompatible(ext4_superblock_t *,
+    uint32_t);
+extern uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *);
+extern void ext4_superblock_set_features_read_only(ext4_superblock_t *,
+    uint32_t);
 
 extern const uint8_t * ext4_superblock_get_uuid(ext4_superblock_t *);
@@ -113,68 +119,27 @@
 extern void ext4_superblock_set_last_mounted(ext4_superblock_t *, const char *);
 
-/*
-uint32_t s_algorithm_usage_bitmap; // For compression
-uint8_t s_prealloc_blocks; // Number of blocks to try to preallocate
-uint8_t s_prealloc_dir_blocks; // Number to preallocate for dirs
-uint16_t s_reserved_gdt_blocks; // Per group desc for online growth
-uint8_t s_journal_uuid[16]; // UUID of journal superblock
-uint32_t s_journal_inum; // Inode number of journal file
-uint32_t s_journal_dev; // Device number of journal file
-*/
 extern uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *);
 extern void ext4_superblock_set_last_orphan(ext4_superblock_t *, uint32_t);
 extern const uint32_t * ext4_superblock_get_hash_seed(ext4_superblock_t *);
-extern void ext4_superblock_set_hash_seed(ext4_superblock_t *, const uint32_t *);
+extern void ext4_superblock_set_hash_seed(ext4_superblock_t *,
+    const uint32_t *);
 extern uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *);
-extern void ext4_superblock_set_default_hash_version(ext4_superblock_t *, uint8_t);
-/*
-uint8_t s_jnl_backup_type;
-*/
+extern void ext4_superblock_set_default_hash_version(ext4_superblock_t *,
+    uint8_t);
 
 extern uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *);
 extern void ext4_superblock_set_desc_size(ext4_superblock_t *, uint16_t);
 
-/*
-uint32_t s_default_mount_opts; // Default mount options
-uint32_t s_first_meta_bg; // First metablock block group
-uint32_t s_mkfs_time; // When the filesystem was created
-uint32_t s_jnl_blocks[17]; // Backup of the journal inode
-uint16_t s_min_extra_isize; // All inodes have at least # bytes
-uint16_t s_want_extra_isize; // New inodes should reserve # bytes
-*/
 extern uint32_t ext4_superblock_get_flags(ext4_superblock_t *);
 extern void ext4_superblock_set_flags(ext4_superblock_t *, uint32_t);
-/*
-uint16_t s_raid_stride; // RAID stride
-uint16_t s_mmp_interval; // # seconds to wait in MMP checking
-uint64_t s_mmp_block; // Block for multi-mount protection
-uint32_t s_raid_stripe_width; // blocks on all data disks (N*stride)
-uint8_t s_log_groups_per_flex; // FLEX_BG group size
-uint8_t s_reserved_char_pad;
-uint16_t s_reserved_pad;
-uint64_t s_kbytes_written; // Number of lifetime kilobytes written
-uint32_t s_snapshot_inum; // Inode number of active snapshot
-uint32_t s_snapshot_id; // Sequential ID of active snapshot
-uint64_t s_snapshot_r_blocks_count; // reserved blocks for active snapshot's future use
-uint32_t s_snapshot_list; // inode number of the head of the on-disk snapshot list
-uint32_t s_error_count; // number of fs errors
-uint32_t s_first_error_time; // First time an error happened
-uint32_t s_first_error_ino; // Inode involved in first error
-uint64_t s_first_error_block; // block involved of first error
-uint8_t s_first_error_func[32]; // Function where the error happened
-uint32_t s_first_error_line; // Line number where error happened
-uint32_t s_last_error_time; // Most recent time of an error
-uint32_t s_last_error_ino; // Inode involved in last error
-uint32_t s_last_error_line; // Line number where error happened
-uint64_t s_last_error_block;     // block involved of last error
-uint8_t s_last_error_func[32];  // function where the error happened
-uint8_t s_mount_opts[64];
-*/
 
 /* More complex superblock functions */
 extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t);
-extern bool ext4_superblock_has_feature_compatible(ext4_superblock_t *, uint32_t);
-extern bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *, uint32_t);
-extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *, uint32_t);
+extern bool ext4_superblock_has_feature_compatible(ext4_superblock_t *,
+    uint32_t);
+extern bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *,
+    uint32_t);
+extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *,
+    uint32_t);
 extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
 extern int ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
@@ -182,6 +147,8 @@
 
 extern uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *);
-extern uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *, uint32_t);
+extern uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *,
+    uint32_t);
+extern uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *,
+    uint32_t);
 
 #endif
Index: uspace/lib/ext4/libext4_types.h
===================================================================
--- uspace/lib/ext4/libext4_types.h	(revision c15849c8a44b459b927cd059efde5825ceb0a3a6)
+++ uspace/lib/ext4/libext4_types.h	(revision 49505feb1808cab8f01eddb660a78c858685ec5c)
@@ -29,5 +29,5 @@
 /** @addtogroup libext4
  * @{
- */ 
+ */
 
 #ifndef LIBEXT4_LIBEXT4_TYPES_H_
@@ -40,185 +40,184 @@
  */
 typedef struct ext4_superblock {
-	uint32_t inodes_count; // Inodes count
-	uint32_t blocks_count_lo; // Blocks count
-	uint32_t reserved_blocks_count_lo; // Reserved blocks count
-	uint32_t free_blocks_count_lo; // Free blocks count
-	uint32_t free_inodes_count; // Free inodes count
-	uint32_t first_data_block; // First Data Block
-	uint32_t log_block_size; // Block size
-	uint32_t log_frag_size; // Obsoleted fragment size
-	uint32_t blocks_per_group; // Number of blocks per group
-	uint32_t frags_per_group; // Obsoleted fragments per group
-	uint32_t inodes_per_group; // Number of inodes per group
-	uint32_t mount_time; // Mount time
-	uint32_t write_time; // Write time
-	uint16_t mount_count; // Mount count
-	uint16_t max_mount_count; // Maximal mount count
-	uint16_t magic; // Magic signature
-	uint16_t state; // Filesystem state
-	uint16_t errors; // Behaviour when detecting errors
-	uint16_t minor_rev_level; // Minor revision level
-	uint32_t last_check_time; // Time of last check
-	uint32_t check_interval; // Maximum time between checks
-	uint32_t creator_os; // Creator OS
-	uint32_t rev_level; // Revision level
-	uint16_t def_resuid; // Default uid for reserved blocks
-	uint16_t def_resgid; // Default gid for reserved blocks
-
-	// Fields for EXT4_DYNAMIC_REV superblocks only.
-	uint32_t first_inode; // First non-reserved inode
-	uint16_t inode_size; // Size of inode structure
-	uint16_t block_group_index; // Block group index of this superblock
-	uint32_t features_compatible; // Compatible feature set
-	uint32_t features_incompatible; // Incompatible feature set
-	uint32_t features_read_only; // Readonly-compatible feature set
-	uint8_t uuid[16]; // 128-bit uuid for volume
-	char volume_name[16]; // Volume name
-	char last_mounted[64]; // Directory where last mounted
-	uint32_t algorithm_usage_bitmap; // For compression
-
+	uint32_t inodes_count;              /* I-nodes count */
+	uint32_t blocks_count_lo;           /* Blocks count */
+	uint32_t reserved_blocks_count_lo;  /* Reserved blocks count */
+	uint32_t free_blocks_count_lo;      /* Free blocks count */
+	uint32_t free_inodes_count;         /* Free inodes count */
+	uint32_t first_data_block;          /* First Data Block */
+	uint32_t log_block_size;            /* Block size */
+	uint32_t log_frag_size;             /* Obsoleted fragment size */
+	uint32_t blocks_per_group;          /* Number of blocks per group */
+	uint32_t frags_per_group;           /* Obsoleted fragments per group */
+	uint32_t inodes_per_group;          /* Number of inodes per group */
+	uint32_t mount_time;                /* Mount time */
+	uint32_t write_time;                /* Write time */
+	uint16_t mount_count;               /* Mount count */
+	uint16_t max_mount_count;           /* Maximal mount count */
+	uint16_t magic;                     /* Magic signature */
+	uint16_t state;                     /* File system state */
+	uint16_t errors;                    /* Behaviour when detecting errors */
+	uint16_t minor_rev_level;           /* Minor revision level */
+	uint32_t last_check_time;           /* Time of last check */
+	uint32_t check_interval;            /* Maximum time between checks */
+	uint32_t creator_os;                /* Creator OS */
+	uint32_t rev_level;                 /* Revision level */
+	uint16_t def_resuid;                /* Default uid for reserved blocks */
+	uint16_t def_resgid;                /* Default gid for reserved blocks */
+	
+	/* Fields for EXT4_DYNAMIC_REV superblocks only. */
+	uint32_t first_inode;             /* First non-reserved inode */
+	uint16_t inode_size;              /* Size of inode structure */
+	uint16_t block_group_index;       /* Block group index of this superblock */
+	uint32_t features_compatible;     /* Compatible feature set */
+	uint32_t features_incompatible;   /* Incompatible feature set */
+	uint32_t features_read_only;      /* Readonly-compatible feature set */
+	uint8_t uuid[16];                 /* 128-bit uuid for volume */
+	char volume_name[16];             /* Volume name */
+	char last_mounted[64];            /* Directory where last mounted */
+	uint32_t algorithm_usage_bitmap;  /* For compression */
+	
 	/*
 	 * Performance hints. Directory preallocation should only
 	 * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
 	 */
-	uint8_t s_prealloc_blocks; // Number of blocks to try to preallocate
-	uint8_t s_prealloc_dir_blocks; // Number to preallocate for dirs
-	uint16_t s_reserved_gdt_blocks; // Per group desc for online growth
-
+	uint8_t s_prealloc_blocks;       /* Number of blocks to try to preallocate */
+	uint8_t s_prealloc_dir_blocks;   /* Number to preallocate for dirs */
+	uint16_t s_reserved_gdt_blocks;  /* Per group desc for online growth */
+	
 	/*
 	 * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
 	 */
-	uint8_t journal_uuid[16]; // UUID of journal superblock
-	uint32_t journal_inode_number; // Inode number of journal file
-	uint32_t journal_dev; // Device number of journal file
-	uint32_t last_orphan; // Head of list of inodes to delete
-	uint32_t hash_seed[4]; // HTREE hash seed
-	uint8_t default_hash_version; // Default hash version to use
+	uint8_t journal_uuid[16];       /* UUID of journal superblock */
+	uint32_t journal_inode_number;  /* Inode number of journal file */
+	uint32_t journal_dev;           /* Device number of journal file */
+	uint32_t last_orphan;           /* Head of list of inodes to delete */
+	uint32_t hash_seed[4];          /* HTREE hash seed */
+	uint8_t default_hash_version;   /* Default hash version to use */
 	uint8_t journal_backup_type;
-	uint16_t desc_size; // Size of group descriptor
-	uint32_t default_mount_opts; // Default mount options
-	uint32_t first_meta_bg; // First metablock block group
-	uint32_t mkfs_time; // When the filesystem was created
-	uint32_t journal_blocks[17]; // Backup of the journal inode
+	uint16_t desc_size;             /* Size of group descriptor */
+	uint32_t default_mount_opts;    /* Default mount options */
+	uint32_t first_meta_bg;         /* First metablock block group */
+	uint32_t mkfs_time;             /* When the filesystem was created */
+	uint32_t journal_blocks[17];    /* Backup of the journal inode */
 
 	/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
-	uint32_t blocks_count_hi; // Blocks count
-	uint32_t reserved_blocks_count_hi; // Reserved blocks count
-	uint32_t free_blocks_count_hi; // Free blocks count
-	uint16_t min_extra_isize; // All inodes have at least # bytes
-	uint16_t want_extra_isize; // New inodes should reserve # bytes
-	uint32_t flags; // Miscellaneous flags
-	uint16_t raid_stride; // RAID stride
-	uint16_t mmp_interval; // # seconds to wait in MMP checking
-	uint64_t mmp_block; // Block for multi-mount protection
-	uint32_t raid_stripe_width; // blocks on all data disks (N*stride)
-	uint8_t log_groups_per_flex; // FLEX_BG group size
+	uint32_t blocks_count_hi;           /* Blocks count */
+	uint32_t reserved_blocks_count_hi;  /* Reserved blocks count */
+	uint32_t free_blocks_count_hi;      /* Free blocks count */
+	uint16_t min_extra_isize;           /* All inodes have at least # bytes */
+	uint16_t want_extra_isize;          /* New inodes should reserve # bytes */
+	uint32_t flags;                     /* Miscellaneous flags */
+	uint16_t raid_stride;               /* RAID stride */
+	uint16_t mmp_interval;              /* # seconds to wait in MMP checking */
+	uint64_t mmp_block;                 /* Block for multi-mount protection */
+	uint32_t raid_stripe_width;         /* Blocks on all data disks (N * stride) */
+	uint8_t log_groups_per_flex;        /* FLEX_BG group size */
 	uint8_t reserved_char_pad;
 	uint16_t reserved_pad;
-	uint64_t kbytes_written; // Number of lifetime kilobytes written
-	uint32_t snapshot_inum; // Inode number of active snapshot
-	uint32_t snapshot_id; // Sequential ID of active snapshot
-	uint64_t snapshot_r_blocks_count; /* reserved blocks for active snapshot's future use */
-	uint32_t snapshot_list; // inode number of the head of the on-disk snapshot list
-	uint32_t error_count; // number of fs errors
-	uint32_t first_error_time; // First time an error happened
-	uint32_t first_error_ino; // Inode involved in first error
-	uint64_t first_error_block; // block involved of first error
-	uint8_t first_error_func[32]; // Function where the error happened
-	uint32_t first_error_line; // Line number where error happened
-	uint32_t last_error_time; // Most recent time of an error
-	uint32_t last_error_ino; // Inode involved in last error
-	uint32_t last_error_line; // Line number where error happened
-	uint64_t last_error_block;     // Block involved of last error
-	uint8_t last_error_func[32];  // Function where the error happened
+	uint64_t kbytes_written;            /* Number of lifetime kilobytes written */
+	uint32_t snapshot_inum;             /* I-node number of active snapshot */
+	uint32_t snapshot_id;               /* Sequential ID of active snapshot */
+	uint64_t snapshot_r_blocks_count;   /* Reserved blocks for active snapshot's future use */
+	uint32_t snapshot_list;             /* I-node number of the head of the on-disk snapshot list */
+	uint32_t error_count;               /* Number of file system errors */
+	uint32_t first_error_time;          /* First time an error happened */
+	uint32_t first_error_ino;           /* I-node involved in first error */
+	uint64_t first_error_block;         /* Block involved of first error */
+	uint8_t first_error_func[32];       /* Function where the error happened */
+	uint32_t first_error_line;          /* Line number where error happened */
+	uint32_t last_error_time;           /* Most recent time of an error */
+	uint32_t last_error_ino;            /* I-node involved in last error */
+	uint32_t last_error_line;           /* Line number where error happened */
+	uint64_t last_error_block;          /* Block involved of last error */
+	uint8_t last_error_func[32];        /* Function where the error happened */
 	uint8_t mount_opts[64];
-	uint32_t padding[112]; // Padding to the end of the block
+	uint32_t padding[112];              /* Padding to the end of the block */
 } __attribute__((packed)) ext4_superblock_t;
 
 
-#define EXT4_SUPERBLOCK_MAGIC		0xEF53
-#define EXT4_SUPERBLOCK_SIZE		1024
-#define EXT4_SUPERBLOCK_OFFSET		1024
-
-#define EXT4_SUPERBLOCK_OS_LINUX	0
-#define EXT4_SUPERBLOCK_OS_HURD		1
+#define EXT4_SUPERBLOCK_MAGIC   0xEF53
+#define EXT4_SUPERBLOCK_SIZE    1024
+#define EXT4_SUPERBLOCK_OFFSET  1024
+
+#define EXT4_SUPERBLOCK_OS_LINUX  0
+#define EXT4_SUPERBLOCK_OS_HURD   1
 
 /*
  * Misc. filesystem flags
  */
-#define EXT4_SUPERBLOCK_FLAGS_SIGNED_HASH	0x0001  // Signed dirhash in use
-#define EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH	0x0002  // Unsigned dirhash in use
-#define EXT4_SUPERBLOCK_FLAGS_TEST_FILESYS	0x0004  // to test development code
+#define EXT4_SUPERBLOCK_FLAGS_SIGNED_HASH    0x0001  /* Signed dirhash in use */
+#define EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH  0x0002  /* Unsigned dirhash in use */
+#define EXT4_SUPERBLOCK_FLAGS_TEST_FILESYS   0x0004  /* to test development code */
 
 /*
  * Filesystem states
  */
-#define EXT4_SUPERBLOCK_STATE_VALID_FS		0x0001  // Unmounted cleanly
-#define EXT4_SUPERBLOCK_STATE_ERROR_FS		0x0002  // Errors detected
-#define EXT4_SUPERBLOCK_STATE_ORPHAN_FS		0x0004  // Orphans being recovered
+#define EXT4_SUPERBLOCK_STATE_VALID_FS   0x0001  /* Unmounted cleanly */
+#define EXT4_SUPERBLOCK_STATE_ERROR_FS   0x0002  /* Errors detected */
+#define EXT4_SUPERBLOCK_STATE_ORPHAN_FS  0x0004  /* Orphans being recovered */
 
 /*
  * Behaviour when errors detected
  */
-#define EXT4_SUPERBLOCK_ERRORS_CONTINUE		1 // Continue execution
-#define EXT4_SUPERBLOCK_ERRORS_RO			2 // Remount fs read-only
-#define EXT4_SUPERBLOCK_ERRORS_PANIC		3 // Panic
-#define EXT4_SUPERBLOCK_ERRORS_DEFAULT		EXT4_ERRORS_CONTINUE
+#define EXT4_SUPERBLOCK_ERRORS_CONTINUE  1  /* Continue execution */
+#define EXT4_SUPERBLOCK_ERRORS_RO        2  /* Remount fs read-only */
+#define EXT4_SUPERBLOCK_ERRORS_PANIC     3  /* Panic */
+#define EXT4_SUPERBLOCK_ERRORS_DEFAULT   EXT4_ERRORS_CONTINUE
 
 /*
  * Compatible features
  */
-#define EXT4_FEATURE_COMPAT_DIR_PREALLOC        0x0001
-#define EXT4_FEATURE_COMPAT_IMAGIC_INODES       0x0002
-#define EXT4_FEATURE_COMPAT_HAS_JOURNAL         0x0004
-#define EXT4_FEATURE_COMPAT_EXT_ATTR            0x0008
-#define EXT4_FEATURE_COMPAT_RESIZE_INODE        0x0010
-#define EXT4_FEATURE_COMPAT_DIR_INDEX           0x0020
+#define EXT4_FEATURE_COMPAT_DIR_PREALLOC   0x0001
+#define EXT4_FEATURE_COMPAT_IMAGIC_INODES  0x0002
+#define EXT4_FEATURE_COMPAT_HAS_JOURNAL    0x0004
+#define EXT4_FEATURE_COMPAT_EXT_ATTR       0x0008
+#define EXT4_FEATURE_COMPAT_RESIZE_INODE   0x0010
+#define EXT4_FEATURE_COMPAT_DIR_INDEX      0x0020
 
 /*
  * Read-only compatible features
  */
-#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER     0x0001
-#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE       0x0002
-#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR        0x0004
-#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE        0x0008
-#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM         0x0010
-#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK        0x0020
-#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE      0x0040
+#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER  0x0001
+#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE    0x0002
+#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR     0x0004
+#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE     0x0008
+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM      0x0010
+#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK     0x0020
+#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE   0x0040
 
 /*
  * Incompatible features
  */
-#define EXT4_FEATURE_INCOMPAT_COMPRESSION       0x0001
-#define EXT4_FEATURE_INCOMPAT_FILETYPE          0x0002
-#define EXT4_FEATURE_INCOMPAT_RECOVER           0x0004 /* Needs recovery */
-#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV       0x0008 /* Journal device */
-#define EXT4_FEATURE_INCOMPAT_META_BG           0x0010
-#define EXT4_FEATURE_INCOMPAT_EXTENTS           0x0040 /* extents support */
-#define EXT4_FEATURE_INCOMPAT_64BIT             0x0080
-#define EXT4_FEATURE_INCOMPAT_MMP               0x0100
-#define EXT4_FEATURE_INCOMPAT_FLEX_BG           0x0200
-#define EXT4_FEATURE_INCOMPAT_EA_INODE          0x0400 /* EA in inode */
-#define EXT4_FEATURE_INCOMPAT_DIRDATA           0x1000 /* data in dirent */
-
-#define EXT4_FEATURE_COMPAT_SUPP		(EXT4_FEATURE_COMPAT_DIR_INDEX)
-
-#define EXT4_FEATURE_INCOMPAT_SUPP      (EXT4_FEATURE_INCOMPAT_FILETYPE | \
-                                         EXT4_FEATURE_INCOMPAT_EXTENTS | \
-                                         EXT4_FEATURE_INCOMPAT_64BIT)
-
-#define EXT4_FEATURE_RO_COMPAT_SUPP     (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
-										 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
-										 EXT4_FEATURE_RO_COMPAT_HUGE_FILE | \
-										 EXT4_FEATURE_RO_COMPAT_LARGE_FILE | \
-										 EXT4_FEATURE_RO_COMPAT_GDT_CSUM | \
-										 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
-
-
-/*****************************************************************************/
+#define EXT4_FEATURE_INCOMPAT_COMPRESSION  0x0001
+#define EXT4_FEATURE_INCOMPAT_FILETYPE     0x0002
+#define EXT4_FEATURE_INCOMPAT_RECOVER      0x0004  /* Needs recovery */
+#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV  0x0008  /* Journal device */
+#define EXT4_FEATURE_INCOMPAT_META_BG      0x0010
+#define EXT4_FEATURE_INCOMPAT_EXTENTS      0x0040  /* extents support */
+#define EXT4_FEATURE_INCOMPAT_64BIT        0x0080
+#define EXT4_FEATURE_INCOMPAT_MMP          0x0100
+#define EXT4_FEATURE_INCOMPAT_FLEX_BG      0x0200
+#define EXT4_FEATURE_INCOMPAT_EA_INODE     0x0400  /* EA in inode */
+#define EXT4_FEATURE_INCOMPAT_DIRDATA      0x1000  /* data in dirent */
+
+#define EXT4_FEATURE_COMPAT_SUPP  (EXT4_FEATURE_COMPAT_DIR_INDEX)
+
+#define EXT4_FEATURE_INCOMPAT_SUPP \
+	(EXT4_FEATURE_INCOMPAT_FILETYPE | \
+	EXT4_FEATURE_INCOMPAT_EXTENTS | \
+	EXT4_FEATURE_INCOMPAT_64BIT)
+
+#define EXT4_FEATURE_RO_COMPAT_SUPP \
+	(EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
+	EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
+	EXT4_FEATURE_RO_COMPAT_HUGE_FILE | \
+	EXT4_FEATURE_RO_COMPAT_LARGE_FILE | \
+	EXT4_FEATURE_RO_COMPAT_GDT_CSUM | \
+	EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
 
 typedef struct ext4_filesystem {
 	service_id_t device;
-	ext4_superblock_t *	superblock;
+	ext4_superblock_t *superblock;
 	aoff64_t inode_block_limits[4];
 	aoff64_t inode_blocks_per_level[4];
@@ -226,9 +225,7 @@
 
 
-/*****************************************************************************/
-
-#define EXT4_BLOCK_GROUP_INODE_UNINIT	0x0001 /* Inode table/bitmap not in use */
-#define EXT4_BLOCK_GROUP_BLOCK_UNINIT	0x0002 /* Block bitmap not in use */
-#define EXT4_BLOCK_GROUP_ITABLE_ZEROED	0x0004 /* On-disk itable initialized to zero */
+#define EXT4_BLOCK_GROUP_INODE_UNINIT   0x0001  /* Inode table/bitmap not in use */
+#define EXT4_BLOCK_GROUP_BLOCK_UNINIT   0x0002  /* Block bitmap not in use */
+#define EXT4_BLOCK_GROUP_ITABLE_ZEROED  0x0004  /* On-disk itable initialized to zero */
 
 /*
@@ -236,27 +233,27 @@
  */
 typedef struct ext4_block_group {
-	uint32_t block_bitmap_lo; // Blocks bitmap block
-	uint32_t inode_bitmap_lo; // Inodes bitmap block
-	uint32_t inode_table_first_block_lo; // Inodes table block
-	uint16_t free_blocks_count_lo; // Free blocks count
-	uint16_t free_inodes_count_lo; // Free inodes count
-	uint16_t used_dirs_count_lo; // Directories count
-	uint16_t flags; // EXT4_BG_flags (INODE_UNINIT, etc)
-	uint32_t reserved[2]; // Likely block/inode bitmap checksum
-	uint16_t itable_unused_lo; // Unused inodes count
-	uint16_t checksum; // crc16(sb_uuid+group+desc)
-	/* -------------- */
-	uint32_t block_bitmap_hi; // Blocks bitmap block MSB
-	uint32_t inode_bitmap_hi; // Inodes bitmap block MSB
-	uint32_t inode_table_first_block_hi; // Inodes table block MSB
-	uint16_t free_blocks_count_hi; // Free blocks count MSB
-	uint16_t free_inodes_count_hi; // Free inodes count MSB
-	uint16_t used_dirs_count_hi; // Directories count MSB
-	uint16_t itable_unused_hi;  // Unused inodes count MSB
-	uint32_t reserved2[3]; // Padding
+	uint32_t block_bitmap_lo;             /* Blocks bitmap block */
+	uint32_t inode_bitmap_lo;             /* Inodes bitmap block */
+	uint32_t inode_table_first_block_lo;  /* Inodes table block */
+	uint16_t free_blocks_count_lo;        /* Free blocks count */
+	uint16_t free_inodes_count_lo;        /* Free inodes count */
+	uint16_t used_dirs_count_lo;          /* Directories count */
+	uint16_t flags;                       /* EXT4_BG_flags (INODE_UNINIT, etc) */
+	uint32_t reserved[2];                 /* Likely block/inode bitmap checksum */
+	uint16_t itable_unused_lo;            /* Unused inodes count */
+	uint16_t checksum;                    /* crc16(sb_uuid+group+desc) */
+	
+	uint32_t block_bitmap_hi;             /* Blocks bitmap block MSB */
+	uint32_t inode_bitmap_hi;             /* I-nodes bitmap block MSB */
+	uint32_t inode_table_first_block_hi;  /* I-nodes table block MSB */
+	uint16_t free_blocks_count_hi;        /* Free blocks count MSB */
+	uint16_t free_inodes_count_hi;        /* Free i-nodes count MSB */
+	uint16_t used_dirs_count_hi;          /* Directories count MSB */
+	uint16_t itable_unused_hi;            /* Unused inodes count MSB */
+	uint32_t reserved2[3];                /* Padding */
 } ext4_block_group_t;
 
 typedef struct ext4_block_group_ref {
-	block_t *block; // Reference to a block containing this block group descr
+	block_t *block;                   /* Reference to a block containing this block group descr */
 	ext4_block_group_t *block_group;
 	ext4_filesystem_t *fs;
@@ -265,23 +262,19 @@
 } ext4_block_group_ref_t;
 
-
-#define EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE 32
-#define EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE 64
-
-/*****************************************************************************/
-
-
-#define EXT4_MIN_BLOCK_SIZE		1024  //1 KiB
-#define EXT4_MAX_BLOCK_SIZE 	65536 //64 KiB
-#define EXT4_REV0_INODE_SIZE	128
-
-#define EXT4_INODE_BLOCK_SIZE				512
-
-#define EXT4_INODE_DIRECT_BLOCK_COUNT		12
-#define EXT4_INODE_INDIRECT_BLOCK 			EXT4_INODE_DIRECT_BLOCK_COUNT
-#define EXT4_INODE_DOUBLE_INDIRECT_BLOCK	(EXT4_INODE_INDIRECT_BLOCK + 1)
-#define EXT4_INODE_TRIPPLE_INDIRECT_BLOCK	(EXT4_INODE_DOUBLE_INDIRECT_BLOCK + 1)
-#define EXT4_INODE_BLOCKS					(EXT4_INODE_TRIPPLE_INDIRECT_BLOCK + 1)
-#define EXT4_INODE_INDIRECT_BLOCK_COUNT		(EXT4_INODE_BLOCKS - EXT4_INODE_DIRECT_BLOCK_COUNT)
+#define EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE  32
+#define EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE  64
+
+#define EXT4_MIN_BLOCK_SIZE   1024   /* 1 KiB */
+#define EXT4_MAX_BLOCK_SIZE   65536  /* 64 KiB */
+#define EXT4_REV0_INODE_SIZE  128
+
+#define EXT4_INODE_BLOCK_SIZE  512
+
+#define EXT4_INODE_DIRECT_BLOCK_COUNT      12
+#define EXT4_INODE_INDIRECT_BLOCK          EXT4_INODE_DIRECT_BLOCK_COUNT
+#define EXT4_INODE_DOUBLE_INDIRECT_BLOCK   (EXT4_INODE_INDIRECT_BLOCK + 1)
+#define EXT4_INODE_TRIPPLE_INDIRECT_BLOCK  (EXT4_INODE_DOUBLE_INDIRECT_BLOCK + 1)
+#define EXT4_INODE_BLOCKS                  (EXT4_INODE_TRIPPLE_INDIRECT_BLOCK + 1)
+#define EXT4_INODE_INDIRECT_BLOCK_COUNT    (EXT4_INODE_BLOCKS - EXT4_INODE_DIRECT_BLOCK_COUNT)
 
 /*
@@ -289,108 +282,109 @@
  */
 typedef struct ext4_inode {
-	uint16_t mode; // File mode
-	uint16_t uid; // Low 16 bits of owner uid
-	uint32_t size_lo; // Size in bytes
-	uint32_t access_time; // Access time
-	uint32_t change_inode_time; // Inode change time
-	uint32_t modification_time; // Modification time
-	uint32_t deletion_time; // Deletion time
-	uint16_t gid; // Low 16 bits of group id
-	uint16_t links_count; // Links count
-	uint32_t blocks_count_lo; // Blocks count
-	uint32_t flags; // File flags
-	uint32_t unused_osd1; // OS dependent - not used in HelenOS
-    uint32_t blocks[EXT4_INODE_BLOCKS]; // Pointers to blocks
-    uint32_t generation; // File version (for NFS)
-    uint32_t file_acl_lo; // File ACL
-    uint32_t size_hi;
-    uint32_t obso_faddr; // Obsoleted fragment address
-    union {
-    	struct {
-    		uint16_t blocks_high; /* were l_i_reserved1 */
-    		uint16_t file_acl_high;
-    		uint16_t uid_high;   /* these 2 fields */
-    		uint16_t gid_high;   /* were reserved2[0] */
-    		uint32_t reserved2;
-    	} linux2;
-    	struct {
-    		uint16_t reserved1;  /* Obsoleted fragment number/size which are removed in ext4 */
-    		uint16_t mode_high;
-    		uint16_t uid_high;
-    		uint16_t gid_high;
-    		uint32_t author;
-    	} hurd2;
-    } __attribute__ ((packed)) osd2;
-
-    uint16_t extra_isize;
-    uint16_t pad1;
-    uint32_t ctime_extra; // Extra change time (nsec << 2 | epoch)
-    uint32_t mtime_extra; // Extra Modification time (nsec << 2 | epoch)
-    uint32_t atime_extra; // Extra Access time (nsec << 2 | epoch)
-    uint32_t crtime; // File creation time
-    uint32_t crtime_extra; // Extra file creation time (nsec << 2 | epoch)
-    uint32_t version_hi;   // High 32 bits for 64-bit version
+	uint16_t mode;                       /* File mode */
+	uint16_t uid;                        /* Low 16 bits of owner uid */
+	uint32_t size_lo;                    /* Size in bytes */
+	uint32_t access_time;                /* Access time */
+	uint32_t change_inode_time;          /* I-node change time */
+	uint32_t modification_time;          /* Modification time */
+	uint32_t deletion_time;              /* Deletion time */
+	uint16_t gid;                        /* Low 16 bits of group id */
+	uint16_t links_count;                /* Links count */
+	uint32_t blocks_count_lo;            /* Blocks count */
+	uint32_t flags;                      /* File flags */
+	uint32_t unused_osd1;                /* OS dependent - not used in HelenOS */
+	uint32_t blocks[EXT4_INODE_BLOCKS];  /* Pointers to blocks */
+	uint32_t generation;                 /* File version (for NFS) */
+	uint32_t file_acl_lo;                /* File ACL */
+	uint32_t size_hi;
+	uint32_t obso_faddr;                 /* Obsoleted fragment address */
+	
+	union {
+		struct {
+			uint16_t blocks_high;
+			uint16_t file_acl_high;
+			uint16_t uid_high;
+			uint16_t gid_high;
+			uint32_t reserved2;
+		} linux2;
+		struct {
+			uint16_t reserved1;
+			uint16_t mode_high;
+			uint16_t uid_high;
+			uint16_t gid_high;
+			uint32_t author;
+		} hurd2;
+	} __attribute__ ((packed)) osd2;
+	
+	uint16_t extra_isize;
+	uint16_t pad1;
+	uint32_t ctime_extra;   /* Extra change time (nsec << 2 | epoch) */
+	uint32_t mtime_extra;   /* Extra Modification time (nsec << 2 | epoch) */
+	uint32_t atime_extra;   /* Extra Access time (nsec << 2 | epoch) */
+	uint32_t crtime;        /* File creation time */
+	uint32_t crtime_extra;  /* Extra file creation time (nsec << 2 | epoch) */
+	uint32_t version_hi;    /* High 32 bits for 64-bit version */
 } __attribute__ ((packed)) ext4_inode_t;
 
-#define EXT4_INODE_MODE_FIFO		0x1000
-#define EXT4_INODE_MODE_CHARDEV		0x2000
-#define EXT4_INODE_MODE_DIRECTORY	0x4000
-#define EXT4_INODE_MODE_BLOCKDEV	0x6000
-#define EXT4_INODE_MODE_FILE		0x8000
-#define EXT4_INODE_MODE_SOFTLINK	0xA000
-#define EXT4_INODE_MODE_SOCKET		0xC000
-#define EXT4_INODE_MODE_TYPE_MASK	0xF000
+#define EXT4_INODE_MODE_FIFO       0x1000
+#define EXT4_INODE_MODE_CHARDEV    0x2000
+#define EXT4_INODE_MODE_DIRECTORY  0x4000
+#define EXT4_INODE_MODE_BLOCKDEV   0x6000
+#define EXT4_INODE_MODE_FILE       0x8000
+#define EXT4_INODE_MODE_SOFTLINK   0xA000
+#define EXT4_INODE_MODE_SOCKET     0xC000
+#define EXT4_INODE_MODE_TYPE_MASK  0xF000
 
 /*
  * Inode flags
  */
-#define EXT4_INODE_FLAG_SECRM		0x00000001 // Secure deletion
-#define EXT4_INODE_FLAG_UNRM		0x00000002 // Undelete
-#define EXT4_INODE_FLAG_COMPR		0x00000004 // Compress file
-#define EXT4_INODE_FLAG_SYNC		0x00000008 // Synchronous updates
-#define EXT4_INODE_FLAG_IMMUTABLE   0x00000010 // Immutable file
-#define EXT4_INODE_FLAG_APPEND		0x00000020 // writes to file may only append
-#define EXT4_INODE_FLAG_NODUMP		0x00000040 // do not dump file
-#define EXT4_INODE_FLAG_NOATIME		0x00000080 // do not update atime
+#define EXT4_INODE_FLAG_SECRM      0x00000001  /* Secure deletion */
+#define EXT4_INODE_FLAG_UNRM       0x00000002  /* Undelete */
+#define EXT4_INODE_FLAG_COMPR      0x00000004  /* Compress file */
+#define EXT4_INODE_FLAG_SYNC       0x00000008  /* Synchronous updates */
+#define EXT4_INODE_FLAG_IMMUTABLE  0x00000010  /* Immutable file */
+#define EXT4_INODE_FLAG_APPEND     0x00000020  /* writes to file may only append */
+#define EXT4_INODE_FLAG_NODUMP     0x00000040  /* do not dump file */
+#define EXT4_INODE_FLAG_NOATIME    0x00000080  /* do not update atime */
+
 /* Compression flags */
-#define EXT4_INODE_FLAG_DIRTY		0x00000100
-#define EXT4_INODE_FLAG_COMPRBLK	0x00000200 // One or more compressed clusters
-#define EXT4_INODE_FLAG_NOCOMPR		0x00000400 // Don't compress
-#define EXT4_INODE_FLAG_ECOMPR		0x00000800 // Compression error
-/* End compression flags --- maybe not all used */
-#define EXT4_INODE_FLAG_INDEX		0x00001000 // hash-indexed directory
-#define EXT4_INODE_FLAG_IMAGIC		0x00002000 // AFS directory */
-#define EXT4_INODE_FLAG_JOURNAL_DATA	0x00004000 // File data should be journaled
-#define EXT4_INODE_FLAG_NOTAIL		0x00008000 // File tail should not be merged
-#define EXT4_INODE_FLAG_DIRSYNC		0x00010000 // Dirsync behaviour (directories only)
-#define EXT4_INODE_FLAG_TOPDIR		0x00020000 // Top of directory hierarchies
-#define EXT4_INODE_FLAG_HUGE_FILE	0x00040000 // Set to each huge file
-#define EXT4_INODE_FLAG_EXTENTS		0x00080000 // Inode uses extents
-#define EXT4_INODE_FLAG_EA_INODE	0x00200000 // Inode used for large EA
-#define EXT4_INODE_FLAG_EOFBLOCKS	0x00400000 // Blocks allocated beyond EOF
-#define EXT4_INODE_FLAG_RESERVED	0x80000000 // reserved for ext4 lib
-
-#define EXT4_INODE_ROOT_INDEX	2
+#define EXT4_INODE_FLAG_DIRTY     0x00000100
+#define EXT4_INODE_FLAG_COMPRBLK  0x00000200  /* One or more compressed clusters */
+#define EXT4_INODE_FLAG_NOCOMPR   0x00000400  /* Don't compress */
+#define EXT4_INODE_FLAG_ECOMPR    0x00000800  /* Compression error */
+
+#define EXT4_INODE_FLAG_INDEX         0x00001000  /* hash-indexed directory */
+#define EXT4_INODE_FLAG_IMAGIC        0x00002000  /* AFS directory */
+#define EXT4_INODE_FLAG_JOURNAL_DATA  0x00004000  /* File data should be journaled */
+#define EXT4_INODE_FLAG_NOTAIL        0x00008000  /* File tail should not be merged */
+#define EXT4_INODE_FLAG_DIRSYNC       0x00010000  /* Dirsync behaviour (directories only) */
+#define EXT4_INODE_FLAG_TOPDIR        0x00020000  /* Top of directory hierarchies */
+#define EXT4_INODE_FLAG_HUGE_FILE     0x00040000  /* Set to each huge file */
+#define EXT4_INODE_FLAG_EXTENTS       0x00080000  /* Inode uses extents */
+#define EXT4_INODE_FLAG_EA_INODE      0x00200000  /* Inode used for large EA */
+#define EXT4_INODE_FLAG_EOFBLOCKS     0x00400000  /* Blocks allocated beyond EOF */
+#define EXT4_INODE_FLAG_RESERVED      0x80000000  /* reserved for ext4 lib */
+
+#define EXT4_INODE_ROOT_INDEX  2
 
 typedef struct ext4_inode_ref {
-	block_t *block; // Reference to a block containing this inode
+	block_t *block;         /* Reference to a block containing this inode */
 	ext4_inode_t *inode;
 	ext4_filesystem_t *fs;
-	uint32_t index; // Index number of this inode
+	uint32_t index;         /* Index number of this inode */
 	bool dirty;
 } ext4_inode_ref_t;
 
-/*****************************************************************************/
-
-#define EXT4_DIRECTORY_FILENAME_LEN	255
-
-#define EXT4_DIRECTORY_FILETYPE_UNKNOWN         0
-#define EXT4_DIRECTORY_FILETYPE_REG_FILE        1
-#define EXT4_DIRECTORY_FILETYPE_DIR             2
-#define EXT4_DIRECTORY_FILETYPE_CHRDEV          3
-#define EXT4_DIRECTORY_FILETYPE_BLKDEV          4
-#define EXT4_DIRECTORY_FILETYPE_FIFO            5
-#define EXT4_DIRECTORY_FILETYPE_SOCK            6
-#define EXT4_DIRECTORY_FILETYPE_SYMLINK         7
+
+#define EXT4_DIRECTORY_FILENAME_LEN  255
+
+#define EXT4_DIRECTORY_FILETYPE_UNKNOWN   0
+#define EXT4_DIRECTORY_FILETYPE_REG_FILE  1
+#define EXT4_DIRECTORY_FILETYPE_DIR       2
+#define EXT4_DIRECTORY_FILETYPE_CHRDEV    3
+#define EXT4_DIRECTORY_FILETYPE_BLKDEV    4
+#define EXT4_DIRECTORY_FILETYPE_FIFO      5
+#define EXT4_DIRECTORY_FILETYPE_SOCK      6
+#define EXT4_DIRECTORY_FILETYPE_SYMLINK   7
 
 /**
@@ -398,13 +392,15 @@
  */
 typedef struct ext4_directory_entry_ll {
-	uint32_t inode; // Inode for the entry
-	uint16_t entry_length; // Distance to the next directory entry
-	uint8_t name_length; // Lower 8 bits of name length
+	uint32_t inode;         /* I-node for the entry */
+	uint16_t entry_length;  /* Distance to the next directory entry */
+	uint8_t name_length;    /* Lower 8 bits of name length */
+	
 	union {
-		uint8_t name_length_high; // Higher 8 bits of name length
-		uint8_t inode_type; // Type of referenced inode (in rev >= 0.5)
+		uint8_t name_length_high;  /* Higher 8 bits of name length */
+		uint8_t inode_type;        /* Type of referenced inode (in rev >= 0.5) */
 	} __attribute__ ((packed));
-	uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; // Entry name
-} __attribute__ ((packed)) ext4_directory_entry_ll_t;
+	
+	uint8_t name[EXT4_DIRECTORY_FILENAME_LEN];  /* Entry name */
+} __attribute__((packed)) ext4_directory_entry_ll_t;
 
 typedef struct ext4_directory_iterator {
@@ -420,12 +416,9 @@
 } ext4_directory_search_result_t;
 
-
-/*****************************************************************************/
-
 /* Structures for indexed directory */
 
 typedef struct ext4_directory_dx_countlimit {
 	uint16_t limit;
-    uint16_t count;
+	uint16_t count;
 } ext4_directory_dx_countlimit_t;
 
@@ -433,7 +426,7 @@
 	uint32_t inode;
 	uint16_t entry_length;
-    uint8_t name_length;
-    uint8_t inode_type;
-    uint8_t name[4];
+	uint8_t name_length;
+	uint8_t inode_type;
+	uint8_t name[4];
 } ext4_directory_dx_dot_entry_t;
 
@@ -452,7 +445,7 @@
 
 typedef struct ext4_directory_dx_root {
-		ext4_directory_dx_dot_entry_t dots[2];
-		ext4_directory_dx_root_info_t info;
-		ext4_directory_dx_entry_t entries[0];
+	ext4_directory_dx_dot_entry_t dots[2];
+	ext4_directory_dx_root_info_t info;
+	ext4_directory_dx_entry_t entries[0];
 } ext4_directory_dx_root_t;
 
@@ -469,5 +462,4 @@
 } ext4_directory_dx_node_t;
 
-
 typedef struct ext4_directory_dx_block {
 	block_t *block;
@@ -476,10 +468,6 @@
 } ext4_directory_dx_block_t;
 
-
-
-#define EXT4_ERR_BAD_DX_DIR			(-75000)
-#define EXT4_DIRECTORY_HTREE_EOF	(uint32_t)0x7fffffff
-
-/*****************************************************************************/
+#define EXT4_ERR_BAD_DX_DIR       (-75000)
+#define EXT4_DIRECTORY_HTREE_EOF  UINT32_C(0x7fffffff)
 
 /*
@@ -488,8 +476,8 @@
  */
 typedef struct ext4_extent {
-	uint32_t first_block; // First logical block extent covers
-	uint16_t block_count; // Number of blocks covered by extent
-	uint16_t start_hi;    // High 16 bits of physical block
-	uint32_t start_lo;    // Low 32 bits of physical block
+	uint32_t first_block;  /* First logical block extent covers */
+	uint16_t block_count;  /* Number of blocks covered by extent */
+	uint16_t start_hi;     /* High 16 bits of physical block */
+	uint32_t start_lo;     /* Low 32 bits of physical block */
 } ext4_extent_t;
 
@@ -499,8 +487,13 @@
  */
 typedef struct ext4_extent_index {
-	uint32_t first_block; // Index covers logical blocks from 'block'
-	uint32_t leaf_lo; /* Pointer to the physical block of the next
-	 	 	 	 	   * level. leaf or next index could be there */
-	uint16_t leaf_hi;     /* high 16 bits of physical block */
+	uint32_t first_block;  /* Index covers logical blocks from 'block' */
+	
+	/**
+	 * Pointer to the physical block of the next
+	 * level. leaf or next index could be there
+	 * high 16 bits of physical block
+	 */
+	uint32_t leaf_lo;
+	uint16_t leaf_hi;
 	uint16_t padding;
 } ext4_extent_index_t;
@@ -511,8 +504,8 @@
 typedef struct ext4_extent_header {
 	uint16_t magic;
-	uint16_t entries_count; // Number of valid entries
-	uint16_t max_entries_count; // Capacity of store in entries
-	uint16_t depth; // Has tree real underlying blocks?
-	uint32_t generation; // generation of the tree
+	uint16_t entries_count;      /* Number of valid entries */
+	uint16_t max_entries_count;  /* Capacity of store in entries */
+	uint16_t depth;              /* Has tree real underlying blocks? */
+	uint32_t generation;         /* generation of the tree */
 } ext4_extent_header_t;
 
@@ -525,18 +518,18 @@
 } ext4_extent_path_t;
 
-#define EXT4_EXTENT_MAGIC	0xF30A
-#define	EXT4_EXTENT_FIRST(header)	\
-		((ext4_extent_t *) (((void *) (header)) + sizeof(ext4_extent_header_t)))
-#define	EXT4_EXTENT_FIRST_INDEX(header)	\
-		((ext4_extent_index_t *) (((void *) (header)) + sizeof(ext4_extent_header_t)))
-
-/*****************************************************************************/
-
-#define EXT4_HASH_VERSION_LEGACY			0
-#define EXT4_HASH_VERSION_HALF_MD4			1
-#define EXT4_HASH_VERSION_TEA				2
-#define EXT4_HASH_VERSION_LEGACY_UNSIGNED	3
-#define EXT4_HASH_VERSION_HALF_MD4_UNSIGNED	4
-#define EXT4_HASH_VERSION_TEA_UNSIGNED		5
+#define EXT4_EXTENT_MAGIC  0xF30A
+
+#define	EXT4_EXTENT_FIRST(header) \
+	((ext4_extent_t *) (((void *) (header)) + sizeof(ext4_extent_header_t)))
+
+#define	EXT4_EXTENT_FIRST_INDEX(header) \
+	((ext4_extent_index_t *) (((void *) (header)) + sizeof(ext4_extent_header_t)))
+
+#define EXT4_HASH_VERSION_LEGACY             0
+#define EXT4_HASH_VERSION_HALF_MD4           1
+#define EXT4_HASH_VERSION_TEA                2
+#define EXT4_HASH_VERSION_LEGACY_UNSIGNED    3
+#define EXT4_HASH_VERSION_HALF_MD4_UNSIGNED  4
+#define EXT4_HASH_VERSION_TEA_UNSIGNED       5
 
 typedef struct ext4_hash_info {
