shithub: lwext4

Download patch

ref: ead60f17e6fe9c651e2c954cd2f3eba796fa9ff5
parent: 14dd317f2a50e0ef02aa811f5d3311e879b8e19a
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Oct 27 19:50:36 EDT 2013

Removed nasty tabs.

--- a/blockdev/filedev/ext4_filedev.c
+++ b/blockdev/filedev/ext4_filedev.c
@@ -33,14 +33,14 @@
 #include <string.h>
 #include <fcntl.h>
 
-/**@brief	Default filename.*/
+/**@brief   Default filename.*/
 static const char *fname = "ext2";
 
-/**@brief	Image block size.*/
-#define EXT4_FILEDEV_BSIZE		512
+/**@brief   Image block size.*/
+#define EXT4_FILEDEV_BSIZE      512
 
-/**@brief	Image file descriptor.*/
-static FILE	*dev_file;
+/**@brief   Image file descriptor.*/
+static FILE *dev_file;
 
 #define DROP_LINUXCACHE_BUFFERS 1
 
@@ -48,21 +48,21 @@
 /**********************BLOCKDEV INTERFACE**************************************/
 static int filedev_open(struct ext4_blockdev *bdev);
 static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
-		uint32_t blk_cnt);
+    uint32_t blk_cnt);
 static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf,
-		uint64_t blk_id, uint32_t blk_cnt);
+    uint64_t blk_id, uint32_t blk_cnt);
 static int filedev_close(struct  ext4_blockdev *bdev);
 
 
 /******************************************************************************/
 EXT4_BLOCKDEV_STATIC_INSTANCE(
-		_filedev,
-		EXT4_FILEDEV_BSIZE,
-		0,
-		filedev_open,
-		filedev_bread,
-		filedev_bwrite,
-		filedev_close
+    _filedev,
+    EXT4_FILEDEV_BSIZE,
+    0,
+    filedev_open,
+    filedev_bread,
+    filedev_bwrite,
+    filedev_close
 );
 
 /******************************************************************************/
@@ -71,34 +71,34 @@
 /******************************************************************************/
 static int filedev_open(struct ext4_blockdev *bdev)
 {
-	dev_file = fopen(fname, "r+b");
+    dev_file = fopen(fname, "r+b");
 
-	if(!dev_file)
-		return EIO;
+    if(!dev_file)
+        return EIO;
 
-	/*No buffering at file.*/
-	setbuf(dev_file, 0);
+    /*No buffering at file.*/
+    setbuf(dev_file, 0);
 
-	if(fseek(dev_file, 0, SEEK_END))
-		return EFAULT;
+    if(fseek(dev_file, 0, SEEK_END))
+        return EFAULT;
 
-	_filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
+    _filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
 
-	return EOK;
+    return EOK;
 }
 
 /******************************************************************************/
 
 static int filedev_bread(struct  ext4_blockdev *bdev, void *buf, uint64_t blk_id,
-		uint32_t blk_cnt)
+    uint32_t blk_cnt)
 {
-	if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
-		return EIO;
+    if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
+        return EIO;
 
-	if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
-		return EIO;
+    if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
+        return EIO;
 
-	return EOK;
+    return EOK;
 }
 
 static void drop_cache(void)
@@ -130,26 +130,26 @@
 /******************************************************************************/
 static int filedev_close(struct  ext4_blockdev *bdev)
 {
-	fclose(dev_file);
-	return EOK;
+    fclose(dev_file);
+    return EOK;
 }
 
 
 /******************************************************************************/
 
-struct	ext4_bcache* ext4_filecache_get(void)
+struct ext4_bcache* ext4_filecache_get(void)
 {
-	return &__cache;
+    return &__cache;
 }
 /******************************************************************************/
-struct	ext4_blockdev* ext4_filedev_get(void)
+struct ext4_blockdev* ext4_filedev_get(void)
 {
-	return &_filedev;
+    return &_filedev;
 }
 /******************************************************************************/
 void ext4_filedev_filename(const char *n)
 {
-	fname = n;
+    fname = n;
 }
 
 /******************************************************************************/
--- a/blockdev/filedev/ext4_filedev.h
+++ b/blockdev/filedev/ext4_filedev.h
@@ -34,12 +34,12 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-/**@brief	Filecache get.*/
-struct	ext4_bcache*   ext4_filecache_get(void);
+/**@brief   Filecache get.*/
+struct ext4_bcache*   ext4_filecache_get(void);
 
-/**@brief	File blockdev get.*/
-struct	ext4_blockdev* ext4_filedev_get(void);
+/**@brief   File blockdev get.*/
+struct ext4_blockdev* ext4_filedev_get(void);
 
-void 	ext4_filedev_filename(const char *n);
+void ext4_filedev_filename(const char *n);
 
 #endif /* EXT4_FILEDEV_H_ */
--- a/demos/generic/main.c
+++ b/demos/generic/main.c
@@ -46,10 +46,10 @@
 /**@brief   Input stream name.*/
 char input_name[128] = "ext2";
 
-/**@brief	Read-write size*/
+/**@brief   Read-write size*/
 static int rw_szie  = 1024 * 1024;
 
-/**@brief	Read-write size*/
+/**@brief   Read-write size*/
 static int rw_count = 10;
 
 /**@brief   Directory test count*/
@@ -70,16 +70,16 @@
 /**@brief   Indicates that input is windows partition.*/
 static bool winpart = false;
 
-/**@brief	File write buffer*/
-static uint8_t	*wr_buff;
+/**@brief   File write buffer*/
+static uint8_t *wr_buff;
 
-/**@brief	File read buffer.*/
-static uint8_t	*rd_buff;
+/**@brief   File read buffer.*/
+static uint8_t *rd_buff;
 
-/**@brief	Block device handle.*/
+/**@brief   Block device handle.*/
 static struct ext4_blockdev *bd;
 
-/**@brief	Block cache handle.*/
+/**@brief   Block cache handle.*/
 static struct ext4_bcache   *bc;
 
 static const char *usage = "                                    \n\
@@ -99,52 +99,52 @@
 
 static char* entry_to_str(uint8_t type)
 {
-	switch(type){
-	case EXT4_DIRENTRY_UNKNOWN:
-		return "[UNK] ";
-	case EXT4_DIRENTRY_REG_FILE:
-		return "[FIL] ";
-	case EXT4_DIRENTRY_DIR:
-		return "[DIR] ";
-	case EXT4_DIRENTRY_CHRDEV:
-		return "[CHA] ";
-	case EXT4_DIRENTRY_BLKDEV:
-		return "[BLK] ";
-	case EXT4_DIRENTRY_FIFO:
-		return "[FIF] ";
-	case EXT4_DIRENTRY_SOCK:
-		return "[SOC] ";
-	case EXT4_DIRENTRY_SYMLINK:
-		return "[SYM] ";
-	default:
-		break;
-	}
-	return "[???]";
+    switch(type){
+    case EXT4_DIRENTRY_UNKNOWN:
+        return "[UNK] ";
+    case EXT4_DIRENTRY_REG_FILE:
+        return "[FIL] ";
+    case EXT4_DIRENTRY_DIR:
+        return "[DIR] ";
+    case EXT4_DIRENTRY_CHRDEV:
+        return "[CHA] ";
+    case EXT4_DIRENTRY_BLKDEV:
+        return "[BLK] ";
+    case EXT4_DIRENTRY_FIFO:
+        return "[FIF] ";
+    case EXT4_DIRENTRY_SOCK:
+        return "[SOC] ";
+    case EXT4_DIRENTRY_SYMLINK:
+        return "[SYM] ";
+    default:
+        break;
+    }
+    return "[???]";
 }
 
 static void dir_ls(const char *path)
 {
-	int j = 0;
-	char sss[255];
-	ext4_dir d;
-	ext4_direntry *de;
+    int j = 0;
+    char sss[255];
+    ext4_dir d;
+    ext4_direntry *de;
 
-	printf("**********************************************\n");
+    printf("**********************************************\n");
 
-	ext4_dir_open(&d, path);
-	de = ext4_dir_entry_get(&d, j++);
-	printf("ls %s\n", path);
+    ext4_dir_open(&d, path);
+    de = ext4_dir_entry_get(&d, j++);
+    printf("ls %s\n", path);
 
-	while(de){
-		memcpy(sss, de->name, de->name_length);
-		sss[de->name_length] = 0;
-		printf("%s", entry_to_str(de->inode_type));
-		printf("%s", sss);
-		printf("\n");
-		de = ext4_dir_entry_get(&d, j++);
-	}
-	printf("**********************************************\n");
-	ext4_dir_close(&d);
+    while(de){
+        memcpy(sss, de->name, de->name_length);
+        sss[de->name_length] = 0;
+        printf("%s", entry_to_str(de->inode_type));
+        printf("%s", sss);
+        printf("\n");
+        de = ext4_dir_entry_get(&d, j++);
+    }
+    printf("**********************************************\n");
+    ext4_dir_close(&d);
 }
 
 static void mp_stats(void)
@@ -397,8 +397,8 @@
 {
     int r;
     if(winpart){
-         if(!open_winpartition())
-             return false;
+        if(!open_winpartition())
+            return false;
     }else{
         if(!open_filedev())
             return false;
@@ -445,52 +445,52 @@
     int c;
 
     static struct option long_options[] =
-      {
-        {"in",      required_argument, 0, 'a'},
-        {"rws",     required_argument, 0, 'b'},
-        {"rwc",     required_argument, 0, 'c'},
-        {"cache",   required_argument, 0, 'd'},
-        {"dirs",    required_argument, 0, 'e'},
-        {"clean",   no_argument,       0, 'f'},
-        {"bstat",   no_argument,       0, 'g'},
-        {"sbstat",  no_argument,       0, 'h'},
-        {"wpart",   no_argument,       0, 'i'},
-        {0, 0, 0, 0}
-      };
+    {
+            {"in",      required_argument, 0, 'a'},
+            {"rws",     required_argument, 0, 'b'},
+            {"rwc",     required_argument, 0, 'c'},
+            {"cache",   required_argument, 0, 'd'},
+            {"dirs",    required_argument, 0, 'e'},
+            {"clean",   no_argument,       0, 'f'},
+            {"bstat",   no_argument,       0, 'g'},
+            {"sbstat",  no_argument,       0, 'h'},
+            {"wpart",   no_argument,       0, 'i'},
+            {0, 0, 0, 0}
+    };
 
     while(-1 != (c = getopt_long (argc, argv, "a:b:c:d:e:fghi", long_options, &option_index))) {
 
         switch(c){
-            case 'a':
-                strcpy(input_name, optarg);
-                break;
-            case 'b':
-                rw_szie = atoi(optarg);
-                break;
-            case 'c':
-                rw_count = atoi(optarg);
-                break;
-            case 'd':
-                cache_mode = atoi(optarg);
-                break;
-            case 'e':
-                dir_cnt = atoi(optarg);
-                break;
-            case 'f':
-                cleanup_flag = true;
-                break;
-            case 'g':
-                bstat = true;
-                break;
-            case 'h':
-                sbstat = true;
-                break;
-            case 'i':
-                winpart = true;
-                break;
-            default:
-                printf("%s", usage);
-                return false;
+        case 'a':
+            strcpy(input_name, optarg);
+            break;
+        case 'b':
+            rw_szie = atoi(optarg);
+            break;
+        case 'c':
+            rw_count = atoi(optarg);
+            break;
+        case 'd':
+            cache_mode = atoi(optarg);
+            break;
+        case 'e':
+            dir_cnt = atoi(optarg);
+            break;
+        case 'f':
+            cleanup_flag = true;
+            break;
+        case 'g':
+            bstat = true;
+            break;
+        case 'h':
+            sbstat = true;
+            break;
+        case 'i':
+            winpart = true;
+            break;
+        default:
+            printf("%s", usage);
+            return false;
 
         }
     }
@@ -520,20 +520,20 @@
     dir_ls("/mp/");
     fflush(stdout);
     if(!dir_test(dir_cnt))
-	    return EXIT_FAILURE;
+        return EXIT_FAILURE;
 
     fflush(stdout);
-	if(!file_test())
-	    return EXIT_FAILURE;
+    if(!file_test())
+        return EXIT_FAILURE;
 
-	fflush(stdout);
-	dir_ls("/mp/");
+    fflush(stdout);
+    dir_ls("/mp/");
 
-	if(sbstat)
-	    mp_stats();
+    if(sbstat)
+        mp_stats();
 
-	if(cleanup_flag)
-	    cleanup();
+    if(cleanup_flag)
+        cleanup();
 
     if(bstat)
         block_stats();
--- a/ext4.h
+++ b/ext4.h
@@ -32,7 +32,7 @@
 /**
  * @file  ext4.h
  * @brief Ext4 high level operations (files, directories, mountpoints...).
- * 		  Client has to include only this file.
+ *        Client has to include only this file.
  */
 
 #ifndef EXT4_H_
@@ -75,26 +75,26 @@
 /********************************FILE SEEK FLAGS*****************************/
 
 #ifndef SEEK_SET
-#define SEEK_SET	0
+#define SEEK_SET    0
 #endif
 
 #ifndef SEEK_CUR
-#define SEEK_CUR	1
+#define SEEK_CUR    1
 #endif
 
 #ifndef SEEK_END
-#define SEEK_END	2
+#define SEEK_END    2
 #endif
 
 /********************************OS LOCK INFERFACE***************************/
 
-/**@brief	OS dependent lock interface.*/
+/**@brief   OS dependent lock interface.*/
 struct ext4_lock {
 
-    /**@brief	Lock access to mountpoint*/
+    /**@brief   Lock access to mountpoint*/
     void (*lock)(void);
 
-    /**@brief	Unlock access to mountpoint*/
+    /**@brief   Unlock access to mountpoint*/
     void (*unlock)(void);
 };
 
@@ -101,27 +101,27 @@
 
 /********************************FILE DESCRIPTOR*****************************/
 
-/**@brief	File descriptor*/
+/**@brief   File descriptor*/
 typedef struct ext4_file {
 
-    /**@brief	Pountpoint handle.*/
+    /**@brief   Pountpoint handle.*/
     struct ext4_mountpoint *mp;
 
-    /**@brief	File inode id*/
+    /**@brief   File inode id*/
     uint32_t inode;
 
-    /**@brief	Open flags.*/
+    /**@brief   Open flags.*/
     uint32_t flags;
 
-    /**@brief	File size.*/
+    /**@brief   File size.*/
     uint64_t fsize;
 
-    /**@brief	File position*/
+    /**@brief   File position*/
     uint64_t fpos;
 }ext4_file;
 
 /*****************************DIRECTORY DESCRIPTOR***************************/
-/**@brief	Directory entry types. Copy from ext4_types.h*/
+/**@brief   Directory entry types. Copy from ext4_types.h*/
 enum  {
     EXT4_DIRENTRY_UNKNOWN = 0,
     EXT4_DIRENTRY_REG_FILE,
@@ -146,10 +146,10 @@
 }ext4_direntry;
 
 typedef struct  {
-    /**@brief 	File descriptor*/
-    ext4_file		f;
-    /**@brief	Current direntry.*/
-    ext4_direntry	de;
+    /**@brief   File descriptor*/
+    ext4_file f;
+    /**@brief   Current direntry.*/
+    ext4_direntry de;
 }ext4_dir;
 
 /********************************MOUNT OPERATIONS****************************/
@@ -167,8 +167,8 @@
         const char *dev_name);
 
 /**@brief   Mount a block device with EXT4 partition to the mountpoint.
- * @param	dev_name block device name (@ref ext4_device_register)
- * @param	mount_point pount point, for example
+ * @param   dev_name block device name (@ref ext4_device_register)
+ * @param   mount_point pount point, for example
  *          -   /
  *          -   /my_partition/
  *          -   /my_second_partition/
@@ -177,7 +177,7 @@
 int ext4_mount(const char * dev_name,  char *mount_point);
 
 /**@brief   Umount operation.
- * @param	mount_point mount name
+ * @param   mount_point mount name
  * @return  standard error code */
 int ext4_umount(char *mount_point);
 
@@ -212,9 +212,9 @@
 int ext4_fremove(const char *path);
 
 /**@brief   File open function.
- * @param	filename, (has to start from mountpoint)
- * 			/my_partition/my_file
- * @param	flags open file flags
+ * @param   filename, (has to start from mountpoint)
+ *          /my_partition/my_file
+ * @param   flags open file flags
  *  |---------------------------------------------------------------|
  *  |   r or rb                 O_RDONLY                            |
  *  |---------------------------------------------------------------|
@@ -229,7 +229,7 @@
  *  |   a+ or ab+ or a+b        O_RDWR|O_CREAT|O_APPEND             |
  *  |---------------------------------------------------------------|
  *
- * @return	standard error code*/
+ * @return  standard error code*/
 int ext4_fopen (ext4_file *f, const char *path, const char *flags);
 
 /**@brief   File close function.
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -61,21 +61,21 @@
 /**@brief   Mount point descrpitor.*/
 struct ext4_mountpoint {
 
-    /**@brief	Mount point name (@ref ext4_mount)*/
+    /**@brief   Mount point name (@ref ext4_mount)*/
     const char *name;
 
-    /**@brief	Os dependent lock/unlock functions.*/
+    /**@brief   Os dependent lock/unlock functions.*/
     struct ext4_lock *os_locks;
 
-    /**@brief	Ext4 filesystem internals.*/
+    /**@brief   Ext4 filesystem internals.*/
     struct ext4_fs fs;
 
-    /**@brief	Dynamic alocation cache flag.*/
+    /**@brief   Dynamic alocation cache flag.*/
     bool cache_dynamic;
 };
 
 /**@brief   Block devices descriptor.*/
-struct	_ext4_devices {
+struct _ext4_devices {
 
     /**@brief   Block device name (@ref ext4_device_register)*/
     const char *name;
@@ -87,11 +87,11 @@
     struct ext4_bcache *bc;
 };
 
-/**@brief	Block devices.*/
-struct	_ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];
+/**@brief   Block devices.*/
+struct _ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];
 
 
-/**@brief	Mountpoints.*/
+/**@brief   Mountpoints.*/
 struct ext4_mountpoint _mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];
 
 
@@ -105,8 +105,8 @@
     for (i = 0; i < CONFIG_EXT4_BLOCKDEVS_COUNT; ++i) {
         if(!_bdevices[i].name){
             _bdevices[i].name   = dev_name;
-            _bdevices[i].bd 	= bd;
-            _bdevices[i].bc 	= bc;
+            _bdevices[i].bd = bd;
+            _bdevices[i].bc = bc;
             return EOK;
         }
     }
@@ -388,11 +388,11 @@
 }
 
 
-int	ext4_umount(char *mount_point)
+int ext4_umount(char *mount_point)
 {
-    int	i;
-    int	r = EOK;
-    struct ext4_mountpoint	*mp = 0;
+    int i;
+    int r = EOK;
+    struct ext4_mountpoint *mp = 0;
 
     for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
         if(_mp[i].name){
@@ -502,7 +502,7 @@
     }
 
     if(!strcmp(flags, "a") || !strcmp(flags, "ab")){
-        *file_flags = O_WRONLY | O_CREAT | O_APPEND	;
+        *file_flags = O_WRONLY | O_CREAT | O_APPEND;
         return true;
     }
 
@@ -531,10 +531,10 @@
 {
     struct ext4_mountpoint *mp = ext4_get_mount(path);
     struct ext4_directory_search_result result;
-    struct ext4_inode_ref	ref;
-    bool	is_goal = false;
-    uint8_t	inode_type = EXT4_DIRECTORY_FILETYPE_DIR;
-    int		r = ENOENT;
+    struct ext4_inode_ref ref;
+    bool is_goal = false;
+    uint8_t inode_type = EXT4_DIRECTORY_FILETYPE_DIR;
+    int r = ENOENT;
     uint32_t next_inode;
 
     f->mp = 0;
@@ -585,7 +585,7 @@
                 break;
 
             /*O_CREAT allows create new entry*/
-            struct ext4_inode_ref	child_ref;
+            struct ext4_inode_ref child_ref;
             r = ext4_fs_alloc_inode(&mp->fs, &child_ref, is_goal ? !file_expect : true);
             if(r != EOK)
                 break;
@@ -790,7 +790,7 @@
     uint32_t fblock_start;
     uint32_t fblock_cnt;
     struct ext4_block b;
-    uint8_t	*u8_buf = buf;
+    uint8_t *u8_buf = buf;
     struct ext4_inode_ref ref;
     uint32_t sblock;
     uint32_t sblock_end;
@@ -821,7 +821,7 @@
 
     block_size = ext4_sb_get_block_size(&f->mp->fs.sb);
     size = size > (f->fsize - f->fpos) ? (f->fsize - f->fpos) : size;
-    sblock 	= (f->fpos) / block_size;
+    sblock = (f->fpos) / block_size;
     sblock_end = (f->fpos + size) / block_size;
     u = (f->fpos) % block_size;
 
@@ -916,13 +916,13 @@
     return r;
 }
 
-int	ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
+int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
 {
     int r = EOK;
     uint32_t u;
     uint32_t fblock;
     struct ext4_block b;
-    uint8_t	*u8_buf = buf;
+    uint8_t *u8_buf = buf;
     struct ext4_inode_ref ref;
     uint32_t sblock;
     uint32_t sblock_end;
@@ -962,7 +962,7 @@
     if(f->fsize % block_size)
         file_blocks++;
 
-    sblock 	= (f->fpos) / block_size;
+    sblock = (f->fpos) / block_size;
 
     u = (f->fpos) % block_size;
 
--- a/lwext4/ext4_balloc.c
+++ b/lwext4/ext4_balloc.c
@@ -62,12 +62,12 @@
 uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
     struct ext4_block_group_ref * bg_ref)
 {
-    uint32_t block_group_count 		 = ext4_block_group_cnt(s);
+    uint32_t block_group_count = ext4_block_group_cnt(s);
     uint32_t inode_table_first_block =
             ext4_bg_get_inode_table_first_block(bg_ref->block_group, s);
-    uint32_t block_size 			 = ext4_sb_get_block_size(s);
+    uint32_t block_size  = ext4_sb_get_block_size(s);
 
-    uint16_t inode_size 	  = ext4_get16(s, inode_size);
+    uint16_t inode_size = ext4_get16(s, inode_size);
     uint32_t inodes_per_group = ext4_get32(s, inodes_per_group);
 
     uint32_t inode_table_bytes;
@@ -77,7 +77,7 @@
         inode_table_bytes = inodes_per_group * inode_size;
     } else {
         /* Last block group could be smaller */
-        uint32_t inodes_count_total =	ext4_get32(s, inodes_count);
+        uint32_t inodes_count_total = ext4_get32(s, inodes_count);
         inode_table_bytes =
                 (inodes_count_total - ((block_group_count - 1) *
                         inodes_per_group)) * inode_size;
@@ -93,12 +93,12 @@
 
 int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref, uint32_t baddr)
 {
-    struct ext4_fs 	     *fs   = inode_ref->fs;
-    struct ext4_sblock   *sb   = &fs->sb;
+    struct ext4_fs *fs = inode_ref->fs;
+    struct ext4_sblock *sb = &fs->sb;
 
 
     uint32_t block_group    = ext4_balloc_get_bgid_of_block(sb, baddr);
-    uint32_t index_in_group	= ext4_fs_baddr2_index_in_group(sb, baddr);
+    uint32_t index_in_group = ext4_fs_baddr2_index_in_group(sb, baddr);
 
     /* Load block group reference */
     struct ext4_block_group_ref bg_ref;
@@ -110,7 +110,7 @@
     uint32_t bitmap_block_addr =
             ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
-    struct	ext4_block bitmap_block;
+    struct ext4_block bitmap_block;
 
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
     if (rc != EOK)
@@ -187,7 +187,7 @@
     uint32_t bitmap_block_addr =
             ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
-    struct	ext4_block bitmap_block;
+    struct ext4_block bitmap_block;
 
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
     if (rc != EOK)
@@ -315,7 +315,7 @@
     uint32_t bitmap_block_addr;
     uint32_t rel_block_idx = 0;
 
-    struct	ext4_block bitmap_block;
+    struct ext4_block bitmap_block;
 
     /* Find GOAL */
     uint32_t goal = ext4_balloc_find_goal(inode_ref);
@@ -550,7 +550,7 @@
             ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
 
 
-    struct	ext4_block bitmap_block;
+    struct ext4_block bitmap_block;
 
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
     if (rc != EOK)
--- a/lwext4/ext4_balloc.h
+++ b/lwext4/ext4_balloc.h
@@ -49,39 +49,39 @@
 #include <stdbool.h>
 
 
-/**@brief	Get first datablock in block group
- * @param	s superblock descriptor
- * @param	bg_ref block group reference
- * @return	block id of the first datablock in block group*/
+/**@brief   Get first datablock in block group
+ * @param   s superblock descriptor
+ * @param   bg_ref block group reference
+ * @return  block id of the first datablock in block group*/
 uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
     struct ext4_block_group_ref * bg_ref);
 
-/**@brief	Free block from inode.
- * @param	inode_ref inode reference
- * @param	baddr block address
- * @return 	standard error code*/
+/**@brief   Free block from inode.
+ * @param   inode_ref inode reference
+ * @param   baddr block address
+ * @return  standard error code*/
 int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref,
     uint32_t baddr);
 
-/**@brief	Free blocks from inode.
- * @param	inode_ref inode reference
- * @param	baddr block address
- * @return 	standard error code*/
+/**@brief   Free blocks from inode.
+ * @param   inode_ref inode reference
+ * @param   baddr block address
+ * @return  standard error code*/
 int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
     uint32_t first, uint32_t count);
 
-/**@brief	Allocate block procedure.
- * @param	inode_ref inode reference
- * @param	baddr allocated block address
- * @return 	standard error code*/
+/**@brief   Allocate block procedure.
+ * @param   inode_ref inode reference
+ * @param   baddr allocated block address
+ * @return  standard error code*/
 int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
     uint32_t *baddr);
 
-/**@brief	Try allocate selected block.
- * @param	inode_ref inode reference
- * @param	baddr block address to allocate
- * @param	free if baddr is not allocated
- * @return 	standard error code*/
+/**@brief   Try allocate selected block.
+ * @param   inode_ref inode reference
+ * @param   baddr block address to allocate
+ * @param   free if baddr is not allocated
+ * @return  standard error code*/
 int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
     uint32_t baddr, bool *free);
 
--- a/lwext4/ext4_bcache.c
+++ b/lwext4/ext4_bcache.c
@@ -43,7 +43,7 @@
 #include <stdlib.h>
 
 
-int ext4_bcache_init_dynamic(struct	ext4_bcache *bc, uint32_t cnt,
+int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
     uint32_t itemsize)
 {
     ext4_assert(bc && cnt && itemsize);
@@ -104,7 +104,7 @@
     return ENOMEM;
 }
 
-int ext4_bcache_fini_dynamic(struct	ext4_bcache *bc)
+int ext4_bcache_fini_dynamic(struct ext4_bcache *bc)
 {
     if(bc->refctr)
         free(bc->refctr);
@@ -195,8 +195,8 @@
 
     if(cache_id != bc->cnt){
         /*There was unreferenced block*/
-        bc->lba[cache_id] 	   = b->lb_id;
-        bc->refctr[cache_id]   = 1;
+        bc->lba[cache_id] = b->lb_id;
+        bc->refctr[cache_id] = 1;
         bc->lru_id[cache_id] = ++bc->lru_ctr;
 
         /*Set valid cache data and id*/
@@ -245,8 +245,8 @@
     if(!bc->refctr[b->cache_id] && !bc->free_delay[b->cache_id])
         bc->ref_blocks--;
 
-    b->lb_id    = 0;
-    b->data     = 0;
+    b->lb_id = 0;
+    b->data = 0;
     b->cache_id = 0;
 
     return EOK;
--- a/lwext4/ext4_bcache.h
+++ b/lwext4/ext4_bcache.h
@@ -42,110 +42,110 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-/**@brief	Single block descriptor.*/
-struct	ext4_block {
-    /**@brief	Dirty flag.*/
-    bool		dirty;
+/**@brief   Single block descriptor.*/
+struct ext4_block {
+    /**@brief   Dirty flag.*/
+    bool dirty;
 
-    /**@brief	Logical block ID*/
-    uint64_t	lb_id;
+    /**@brief   Logical block ID*/
+    uint64_t lb_id;
 
     /**@brief   Cache id*/
-    uint32_t    cache_id;
+    uint32_t cache_id;
 
-    /**@brief	Data buffer.*/
-    uint8_t		*data;
+    /**@brief   Data buffer.*/
+    uint8_t *data;
 };
 
 
-/**@brief	Block cache descriptor.*/
-struct	ext4_bcache {
+/**@brief   Block cache descriptor.*/
+struct ext4_bcache {
 
-    /**@brief	Item count in block cache*/
-    uint32_t	cnt;
+    /**@brief   Item count in block cache*/
+    uint32_t cnt;
 
-    /**@brief	Item size in block cache*/
-    uint32_t	itemsize;
+    /**@brief   Item size in block cache*/
+    uint32_t itemsize;
 
-    /**@brief	Last recently used counter.*/
-    uint32_t	lru_ctr;
+    /**@brief   Last recently used counter.*/
+    uint32_t lru_ctr;
 
-    /**@brief	Reference count table (cnt).*/
-    uint32_t	*refctr;
+    /**@brief   Reference count table (cnt).*/
+    uint32_t *refctr;
 
-    /**@brief	Last recently used ID table (cnt)*/
-    uint32_t 	*lru_id;
+    /**@brief   Last recently used ID table (cnt)*/
+    uint32_t *lru_id;
 
-    /**@brief	Free delay mode table (cnt)*/
-    uint8_t 	*free_delay;
+    /**@brief   Free delay mode table (cnt)*/
+    uint8_t *free_delay;
 
-    /**@brief	Logical block table (cnt).*/
-    uint64_t	*lba;
+    /**@brief   Logical block table (cnt).*/
+    uint64_t *lba;
 
-    /**@brief	Cache data buffers (cnt * itemsize)*/
-    uint8_t		*data;
+    /**@brief   Cache data buffers (cnt * itemsize)*/
+    uint8_t *data;
 
-    /**@brief	Currently referenced datablocks*/
-    uint32_t	ref_blocks;
+    /**@brief   Currently referenced datablocks*/
+    uint32_t ref_blocks;
 
-    /**@brief	Maximum referenced datablocks*/
-    uint32_t	max_ref_blocks;
+    /**@brief   Maximum referenced datablocks*/
+    uint32_t max_ref_blocks;
 
 };
 
-/**@brief	Static initializer of block cache structure.*/
+/**@brief   Static initializer of block cache structure.*/
 #define EXT4_BCACHE_STATIC_INSTANCE(__name, __cnt, __itemsize)      \
-        static uint32_t	__name##_refctr[(__cnt)];                   \
-        static uint32_t	__name##_lru_id[(__cnt)];                   \
-        static uint8_t		__name##_free_delay[(__cnt)];           \
-        static uint64_t	__name##_lba[(__cnt)];                      \
-        static uint8_t 	__name##_data[(__cnt) * (__itemsize)];      \
-        static struct ext4_bcache	__name = {                      \
-                .cnt 	   = __cnt,                                 \
+        static uint32_t __name##_refctr[(__cnt)];                   \
+        static uint32_t __name##_lru_id[(__cnt)];                   \
+        static uint8_t  __name##_free_delay[(__cnt)];               \
+        static uint64_t __name##_lba[(__cnt)];                      \
+        static uint8_t  __name##_data[(__cnt) * (__itemsize)];      \
+        static struct ext4_bcache __name = {                        \
+                .cnt     = __cnt,                                   \
                 .itemsize  = __itemsize,                            \
                 .lru_ctr   = 0,                                     \
-                .refctr	   = __name##_refctr,                       \
+                .refctr    = __name##_refctr,                       \
                 .lru_id    = __name##_lru_id,                       \
-                .lba	   = __name##_lba,                          \
+                .lba    = __name##_lba,                             \
                 .free_delay= __name##_free_delay,                   \
-                .data	   = __name##_data,                         \
+                .data    = __name##_data,                           \
         }
 
 
-/**@brief	Dynamic initialization of block cache.
- * @param	bc block cache descriptor
- * @param	cnt items count in block cache
- * @param	itemsize single item size (in bytes)
- * @return	standard error code*/
-int	ext4_bcache_init_dynamic(struct	ext4_bcache *bc, uint32_t cnt,
+/**@brief   Dynamic initialization of block cache.
+ * @param   bc block cache descriptor
+ * @param   cnt items count in block cache
+ * @param   itemsize single item size (in bytes)
+ * @return  standard error code*/
+int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
     uint32_t itemsize);
 
-/**@brief	Dynamic de-initialization of block cache.
- * @param	bc block cache descriptor
- * @return	standard error code*/
-int ext4_bcache_fini_dynamic(struct	ext4_bcache *bc);
+/**@brief   Dynamic de-initialization of block cache.
+ * @param   bc block cache descriptor
+ * @return  standard error code*/
+int ext4_bcache_fini_dynamic(struct ext4_bcache *bc);
 
-/**@brief	Allocate block from block cache memory.
+/**@brief   Allocate block from block cache memory.
  *          Unreferenced block allocation is based on LRU
  *          (Last Recently Used) algorithm.
- * @param 	bc	block cache descriptor
- * @param	b block to alloc
- * @param	is_new block is new (needs to be read)
+ * @param   bc block cache descriptor
+ * @param   b block to alloc
+ * @param   is_new block is new (needs to be read)
  * @return  standard error code*/
 int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,
     bool *is_new);
 
-/**@brief	Free block from cache memory (decrement reference counter).
- * @param 	bc	block cache descriptor
- * @param	b block to free
+/**@brief   Free block from cache memory (decrement reference counter).
+ * @param   bc block cache descriptor
+ * @param   b block to free
  * @return  standard error code*/
 int ext4_bcache_free (struct ext4_bcache *bc, struct ext4_block *b,
     uint8_t free_delay);
 
 
-/**@brief	Return a full status of block cache.
- * @param 	bc	block cache descriptor
- * @return	full status*/
+/**@brief   Return a full status of block cache.
+ * @param   bc block cache descriptor
+ * @return  full status*/
 bool ext4_bcache_is_full(struct ext4_bcache *bc);
 
 #endif /* EXT4_BCACHE_H_ */
--- a/lwext4/ext4_bitmap.h
+++ b/lwext4/ext4_bitmap.h
@@ -42,17 +42,17 @@
 #include <stdint.h>
 #include <stdbool.h>
 
-/**@brief	Set bitmap bit.
- * @param	bmap bitmap
- * @param	bit	 bit to set*/
+/**@brief   Set bitmap bit.
+ * @param   bmap bitmap
+ * @param   bit bit to set*/
 static inline void ext4_bmap_bit_set(uint8_t *bmap, uint32_t bit)
 {
     *(bmap + (bit >> 3)) |= (1 << (bit & 7));
 }
 
-/**@brief	Clear bitmap bit.
- * @param	bmap bitmap buffer
- * @param	bit	 bit to clear*/
+/**@brief   Clear bitmap bit.
+ * @param   bmap bitmap buffer
+ * @param   bit bit to clear*/
 static inline void ext4_bmap_bit_clr(uint8_t *bmap, uint32_t bit)
 {
     *(bmap + (bit >> 3)) &= ~(1 << (bit & 7));
@@ -59,33 +59,33 @@
 }
 
 
-/**@brief	Check if the bitmap bit is set.
- * @param	bmap bitmap buffer
- * @param	bit	 bit to check*/
+/**@brief   Check if the bitmap bit is set.
+ * @param   bmap bitmap buffer
+ * @param   bit bit to check*/
 static inline bool ext4_bmap_is_bit_set(uint8_t *bmap, uint32_t bit)
 {
     return (*(bmap + (bit >> 3)) & (1 << (bit & 7)));
 }
 
-/**@brief	Check if the bitmap bit is clear.
- * @param	bmap bitmap buffer
- * @param	bit	 bit to check*/
+/**@brief   Check if the bitmap bit is clear.
+ * @param   bmap bitmap buffer
+ * @param   bit bit to check*/
 static inline bool ext4_bmap_is_bit_clr(uint8_t *bmap, uint32_t bit)
 {
     return !ext4_bmap_is_bit_set(bmap, bit);
 }
 
-/**@brief	Free range of bits in bitmap.
- * @param	bmap bitmap buffer
- * @param	sbit start bit
- * @param	bcnt bit count*/
+/**@brief   Free range of bits in bitmap.
+ * @param   bmap bitmap buffer
+ * @param   sbit start bit
+ * @param   bcnt bit count*/
 void ext4_bmap_bits_free(uint8_t *bmap, uint32_t sbit, uint32_t bcnt);
 
-/**@brief	Find first clear bit in bitmap.
- * @param	sbit start bit of search
- * @param	ebit end bit of search
- * @param	bit_id output parameter (first free bit)
- * @return	standard error code*/
+/**@brief   Find first clear bit in bitmap.
+ * @param   sbit start bit of search
+ * @param   ebit end bit of search
+ * @param   bit_id output parameter (first free bit)
+ * @return  standard error code*/
 int ext4_bmap_bit_find_clr(uint8_t *bmap, uint32_t sbit, uint32_t ebit,
     uint32_t *bit_id);
 
--- a/lwext4/ext4_blockdev.c
+++ b/lwext4/ext4_blockdev.c
@@ -44,7 +44,7 @@
 
 
 
-int	ext4_block_init(struct	ext4_blockdev *bdev)
+int ext4_block_init(struct ext4_blockdev *bdev)
 {
     int rc;
     ext4_assert(bdev);
@@ -58,7 +58,7 @@
 
     bdev->flags |= EXT4_BDEV_INITIALIZED;
 
-    return	EOK;
+    return EOK;
 }
 
 int ext4_block_bind_bcache(struct ext4_blockdev *bdev, struct ext4_bcache *bc)
@@ -68,7 +68,7 @@
     return EOK;
 }
 
-void ext4_block_set_lb_size(struct	ext4_blockdev *bdev, uint64_t	lb_bsize)
+void ext4_block_set_lb_size(struct ext4_blockdev *bdev, uint64_t lb_bsize)
 {
     /*Logical block size has to be multiply of physical */
     ext4_assert(!(lb_bsize % bdev->ph_bsize));
@@ -78,7 +78,7 @@
 
 }
 
-int ext4_block_fini(struct	ext4_blockdev *bdev)
+int ext4_block_fini(struct ext4_blockdev *bdev)
 {
     ext4_assert(bdev);
 
@@ -89,7 +89,7 @@
 }
 
 
-int ext4_block_get(struct	ext4_blockdev *bdev, struct	ext4_block *b,
+int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
     uint64_t lba)
 {
     uint64_t pba;
@@ -164,7 +164,7 @@
     return EOK;
 }
 
-int ext4_block_set(struct	ext4_blockdev *bdev, struct	ext4_block *b)
+int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b)
 {
     uint64_t pba;
     uint32_t pb_cnt;
@@ -206,7 +206,7 @@
     return EOK;
 }
 
-int ext4_blocks_get_direct(struct	ext4_blockdev *bdev, void *buf,
+int ext4_blocks_get_direct(struct ext4_blockdev *bdev, void *buf,
     uint64_t lba, uint32_t cnt)
 {
     uint64_t pba;
@@ -221,7 +221,7 @@
     return bdev->bread(bdev, buf, pba, pb_cnt * cnt);
 }
 
-int ext4_blocks_set_direct(struct	ext4_blockdev *bdev, const void *buf,
+int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf,
     uint64_t lba, uint32_t cnt)
 {
     uint64_t pba;
@@ -238,7 +238,7 @@
 }
 
 
-int	ext4_block_writebytes(struct	ext4_blockdev *bdev, uint64_t off,
+int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off,
     const void *buf, uint32_t len)
 {
     uint64_t block_idx;
@@ -247,7 +247,7 @@
     uint32_t unalg;
     int r = EOK;
 
-    const uint8_t	*p = (void *)buf;
+    const uint8_t *p = (void *)buf;
 
     ext4_assert(bdev && buf);
 
@@ -258,7 +258,7 @@
     block_end   =  block_idx + len / bdev->ph_bsize;
 
     if(!(block_end < bdev->ph_bcnt))
-        return EINVAL;				/*Ups. Out of range operation*/
+        return EINVAL;  /*Ups. Out of range operation*/
 
     /*OK lets deal with the first possible unaligned block*/
     unalg = (off & (bdev->ph_bsize - 1));
@@ -317,7 +317,7 @@
 
 
 
-int ext4_block_readbytes(struct	ext4_blockdev *bdev, uint64_t off, void *buf,
+int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf,
     uint32_t len)
 {
     uint64_t block_idx;
@@ -326,7 +326,7 @@
     uint32_t unalg;
     int r = EOK;
 
-    uint8_t	*p = (void *)buf;
+    uint8_t *p = (void *)buf;
 
     ext4_assert(bdev && buf);
 
@@ -337,7 +337,7 @@
     block_end = block_idx + len / bdev->ph_bsize;
 
     if(!(block_end < bdev->ph_bcnt))
-        return EINVAL;				/*Ups. Out of range operation*/
+        return EINVAL;      /*Ups. Out of range operation*/
 
     /*OK lets deal with the first possible unaligned block*/
     unalg = (off & (bdev->ph_bsize - 1));
@@ -365,7 +365,7 @@
     if(r != EOK)
         return r;
 
-    p 	+= bdev->ph_bsize * blen;
+    p += bdev->ph_bsize * blen;
     len -= bdev->ph_bsize * blen;
 
     block_idx += blen;
@@ -383,7 +383,7 @@
     return r;
 }
 
-int 	ext4_block_delay_cache_flush(struct	ext4_blockdev *bdev,
+int ext4_block_delay_cache_flush(struct ext4_blockdev *bdev,
     uint8_t on_off)
 {
     int r;
--- a/lwext4/ext4_blockdev.h
+++ b/lwext4/ext4_blockdev.h
@@ -44,73 +44,73 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-/**@brief	Initialization status flag*/
-#define EXT4_BDEV_INITIALIZED			(1 << 0)
+/**@brief   Initialization status flag*/
+#define EXT4_BDEV_INITIALIZED   (1 << 0)
 
 
-/**@brief	Definiton of the simple block device.*/
-struct	ext4_blockdev  {
+/**@brief   Definiton of the simple block device.*/
+struct ext4_blockdev  {
 
-    /**@brief	Open device function
-     * @param	bdev block device.*/
-    int			(*open)(struct	ext4_blockdev *bdev);
+    /**@brief   Open device function
+     * @param   bdev block device.*/
+    int         (*open)(struct ext4_blockdev *bdev);
 
-    /**@brief	Block read function.
-     * @param	bdev block device
-     * @param	buf	output buffer
-     * @param	blk_id	block id
-     * @param	blk_cnt block count*/
-    int			(*bread)(struct	ext4_blockdev *bdev, void *buf,
+    /**@brief   Block read function.
+     * @param   bdev block device
+     * @param   buf output buffer
+     * @param   blk_id block id
+     * @param   blk_cnt block count*/
+    int         (*bread)(struct ext4_blockdev *bdev, void *buf,
             uint64_t blk_id, uint32_t blk_cnt);
 
-    /**@brief	Block write function.
-     * @param	buf input buffer
-     * @param	blk_id block id
-     * @param	blk_cnt block count*/
-    int			(*bwrite)(struct	ext4_blockdev *bdev, const void *buf,
+    /**@brief   Block write function.
+     * @param   buf input buffer
+     * @param   blk_id block id
+     * @param   blk_cnt block count*/
+    int         (*bwrite)(struct ext4_blockdev *bdev, const void *buf,
             uint64_t blk_id, uint32_t blk_cnt);
 
-    /**@brief	Close device function.
-     * @param	bdev block device.*/
-    int			(*close)(struct	ext4_blockdev *bdev);
+    /**@brief   Close device function.
+     * @param   bdev block device.*/
+    int         (*close)(struct ext4_blockdev *bdev);
 
     /**@brief   Block cache.*/
     struct  ext4_bcache *bc;
 
-    /**@brief	Block size (bytes): physical*/
-    uint32_t	ph_bsize;
+    /**@brief   Block size (bytes): physical*/
+    uint32_t    ph_bsize;
 
-    /**@brief	Block count: physical.*/
-    uint64_t	ph_bcnt;
+    /**@brief   Block count: physical.*/
+    uint64_t    ph_bcnt;
 
-    /**@brief	Block size buffer: physical.*/
-    uint8_t		*ph_bbuf;
+    /**@brief   Block size buffer: physical.*/
+    uint8_t     *ph_bbuf;
 
-    /**@brief	Block size (bytes) logical*/
-    uint32_t	lg_bsize;
+    /**@brief   Block size (bytes) logical*/
+    uint32_t    lg_bsize;
 
-    /**@brief	Block count: phisical.*/
-    uint64_t	lg_bcnt;
+    /**@brief   Block count: phisical.*/
+    uint64_t    lg_bcnt;
 
-    /**@brief	Flags of te block device.*/
-    uint8_t		flags;
+    /**@brief   Flags of te block device.*/
+    uint8_t     flags;
 
     /**@brief   Cache flush delay mode flag.*/
-    uint8_t		cache_flush_delay;
+    uint8_t     cache_flush_delay;
 
     /**@brief   Physical read counter*/
-    uint32_t	bread_ctr;
+    uint32_t    bread_ctr;
 
     /**@brief   Physical write counter*/
-    uint32_t	bwrite_ctr;
+    uint32_t    bwrite_ctr;
 };
 
 
-/**@brief	Static initialization fo the block device.*/
+/**@brief   Static initialization fo the block device.*/
 #define EXT4_BLOCKDEV_STATIC_INSTANCE(__name, __bsize, __bcnt, __open,  \
-        __bread, __bwrite, __close)	\
-        static uint8_t	__name##_ph_bbuf[(__bsize)];                    \
-        static struct	ext4_blockdev __name = {                        \
+        __bread, __bwrite, __close)                                     \
+        static uint8_t  __name##_ph_bbuf[(__bsize)];                    \
+        static struct   ext4_blockdev __name = {                        \
                 .open   = __open,                                       \
                 .bread  = __bread,                                      \
                 .bwrite = __bwrite,                                     \
@@ -120,93 +120,93 @@
                 .ph_bbuf   = __name##_ph_bbuf,                          \
         }
 
-/**@brief	Block device initialization.
- * @param	bdev block device descriptor
- * @param	bg_bsize logical block size
- * @param	bdev block device descriptor
- * @return 	standard error code*/
-int	ext4_block_init(struct	ext4_blockdev *bdev);
+/**@brief   Block device initialization.
+ * @param   bdev block device descriptor
+ * @param   bg_bsize logical block size
+ * @param   bdev block device descriptor
+ * @return  standard error code*/
+int ext4_block_init(struct ext4_blockdev *bdev);
 
 
-/**@brief	Binds a bcache to block device.
- * @param	bdev block device descriptor
- * @param	bc block cache descriptor
- * @return 	standard error code*/
+/**@brief   Binds a bcache to block device.
+ * @param   bdev block device descriptor
+ * @param   bc block cache descriptor
+ * @return  standard error code*/
 int ext4_block_bind_bcache(struct ext4_blockdev *bdev,
     struct ext4_bcache *bc);
 
-/**@brief	Close block device
- * @param	bdev block device descriptor
- * @return 	standard error code*/
-int ext4_block_fini(struct	ext4_blockdev *bdev);
+/**@brief   Close block device
+ * @param   bdev block device descriptor
+ * @return  standard error code*/
+int ext4_block_fini(struct ext4_blockdev *bdev);
 
 
-/**@brief	Set logical block size in block device.
- * @param	bdev block device descriptor
- * @param	lb_size ligical block size (in bytes)
- * @return 	standard error code*/
-void ext4_block_set_lb_size(struct	ext4_blockdev *bdev,
+/**@brief   Set logical block size in block device.
+ * @param   bdev block device descriptor
+ * @param   lb_size ligical block size (in bytes)
+ * @return  standard error code*/
+void ext4_block_set_lb_size(struct ext4_blockdev *bdev,
     uint64_t lb_bsize);
 
-/**@brief	Block get function (through cache).
- * @param	bdev block device descriptor
- * @param	b block descriptor
- * @param	lba logical block address
- * @return 	standard error code*/
-int ext4_block_get(struct	ext4_blockdev *bdev, struct	ext4_block *b,
+/**@brief   Block get function (through cache).
+ * @param   bdev block device descriptor
+ * @param   b block descriptor
+ * @param   lba logical block address
+ * @return  standard error code*/
+int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
     uint64_t lba);
 
-/**@brief	Block set procedure (through cache).
- * @param	bdev block device descriptor
- * @param	b block descriptor
- * @return 	standard error code*/
-int ext4_block_set(struct	ext4_blockdev *bdev, struct	ext4_block *b);
+/**@brief   Block set procedure (through cache).
+ * @param   bdev block device descriptor
+ * @param   b block descriptor
+ * @return  standard error code*/
+int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b);
 
 
-/**@brief	Block read procedure (without cache)
- * @param	bdev block device descriptor
- * @param	buf output buffer
- * @param	lba logical block adderss
- * @return 	standard error code*/
+/**@brief   Block read procedure (without cache)
+ * @param   bdev block device descriptor
+ * @param   buf output buffer
+ * @param   lba logical block adderss
+ * @return  standard error code*/
 int ext4_blocks_get_direct(struct   ext4_blockdev *bdev, void *buf,
     uint64_t lba, uint32_t cnt);
 
 
-/**@brief	Block write procedure (without cache)
- * @param	bdev block device descriptor
- * @param	buf output buffer
- * @param	lba logical block address
- * @return 	standard error code*/
-int ext4_blocks_set_direct(struct	ext4_blockdev *bdev, const void *buf,
+/**@brief   Block write procedure (without cache)
+ * @param   bdev block device descriptor
+ * @param   buf output buffer
+ * @param   lba logical block address
+ * @return  standard error code*/
+int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf,
     uint64_t lba, uint32_t cnt);
 
-/**@brief	Write to block device (by direct adress).
- * @param	bdev block device descriptor
- * @param	off byte offset in block device
- * @param	buf input buffer
- * @param	len length of the write nuffer
- * @return 	EOK when sucess*/
-int	ext4_block_writebytes(struct	ext4_blockdev *bdev, uint64_t off,
+/**@brief   Write to block device (by direct adress).
+ * @param   bdev block device descriptor
+ * @param   off byte offset in block device
+ * @param   buf input buffer
+ * @param   len length of the write nuffer
+ * @return  EOK when sucess*/
+int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off,
     const void *buf, uint32_t len);
 
 
 
-/**@brief	Read freom block device (by direct adress).
- * @param	bdev block device descriptor
- * @param	off byte offset in block device
- * @param	buf input buffer
- * @param	len length of the write nuffer
- * @return 	EOK when sucess*/
-int ext4_block_readbytes(struct	ext4_blockdev *bdev, uint64_t off,
+/**@brief   Read freom block device (by direct adress).
+ * @param   bdev block device descriptor
+ * @param   off byte offset in block device
+ * @param   buf input buffer
+ * @param   len length of the write nuffer
+ * @return  EOK when sucess*/
+int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off,
     void *buf, uint32_t len);
 
-/**@brief	Enable/disable delayed cache flush mode.
- * @param	bdev block device descriptor
- * @param	on_off
- * 				!0 	- ENABLE
- * 				 0	- DISABLE (all delayed cache buffers will be flushed)
- * @return	standard error code*/
-int ext4_block_delay_cache_flush(struct	ext4_blockdev *bdev, uint8_t on_off);
+/**@brief   Enable/disable delayed cache flush mode.
+ * @param   bdev block device descriptor
+ * @param   on_off
+ *              !0 - ENABLE
+ *               0 - DISABLE (all delayed cache buffers will be flushed)
+ * @return  standard error code*/
+int ext4_block_delay_cache_flush(struct ext4_blockdev *bdev, uint8_t on_off);
 
 #endif /* EXT4_BLOCKDEV_H_ */
 
--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -42,12 +42,12 @@
 #endif
 
 
-/**@brief	Enable directory indexing feature (EXT3 feature)*/
+/**@brief   Enable directory indexing feature (EXT3 feature)*/
 #ifndef CONFIG_DIR_INDEX_ENABLE
 #define CONFIG_DIR_INDEX_ENABLE     1
 #endif
 
-/**@brief	Enable extents feature (EXT4 feature)*/
+/**@brief   Enable extents feature (EXT4 feature)*/
 #ifndef CONFIG_EXTENT_ENABLE
 #define CONFIG_EXTENT_ENABLE        1
 #endif
@@ -54,39 +54,39 @@
 
 
 
-/**@brief	Include error codes from ext4_errno or sandard library.*/
+/**@brief   Include error codes from ext4_errno or sandard library.*/
 #ifndef CONFIG_HAVE_OWN_ERRNO
 #define CONFIG_HAVE_OWN_ERRNO       1
 #endif
 
 
-/**@brief	Debug printf enable (stdout)*/
+/**@brief   Debug printf enable (stdout)*/
 #ifndef CONFIG_DEBUG_PRINTF
 #define CONFIG_DEBUG_PRINTF         1
 #endif
 
-/**@brief	Assert printf enable (stdout)*/
+/**@brief   Assert printf enable (stdout)*/
 #ifndef CONFIG_DEBUG_ASSERT
 #define CONFIG_DEBUG_ASSERT         1
 #endif
 
-/**@brief	Statistics of block device*/
+/**@brief   Statistics of block device*/
 #ifndef CONFIG_BLOCK_DEV_ENABLE_STATS
 #define CONFIG_BLOCK_DEV_ENABLE_STATS   1
 #endif
 
-/**@brief	Cache size of block device.*/
+/**@brief   Cache size of block device.*/
 #ifndef CONFIG_BLOCK_DEV_CACHE_SIZE
 #define CONFIG_BLOCK_DEV_CACHE_SIZE     8
 #endif
 
 
-/**@brief	Ilosc urzadzen blokowych.*/
+/**@brief   Ilosc urzadzen blokowych.*/
 #ifndef CONFIG_EXT4_BLOCKDEVS_COUNT
 #define CONFIG_EXT4_BLOCKDEVS_COUNT     2
 #endif
 
-/**@brief	Ilosc punktow montowania systemu plikow*/
+/**@brief   Ilosc punktow montowania systemu plikow*/
 #ifndef CONFIG_EXT4_MOUNTPOINTS_COUNT
 #define CONFIG_EXT4_MOUNTPOINTS_COUNT   2
 #endif
--- a/lwext4/ext4_debug.h
+++ b/lwext4/ext4_debug.h
@@ -43,34 +43,34 @@
 #include <stdio.h>
 
 /**@brief   Debug mask: ext4_blockdev.c*/
-#define EXT4_DEBUG_BLOCKDEV			(1 << 0)
+#define EXT4_DEBUG_BLOCKDEV         (1 << 0)
 
 /**@brief   Debug mask: ext4_fs.c*/
-#define EXT4_DEBUG_FS				(1 << 1)
+#define EXT4_DEBUG_FS               (1 << 1)
 
 /**@brief   Debug mask: ext4_balloc.c*/
-#define EXT4_DEBUG_BALLOC			(1 << 2)
+#define EXT4_DEBUG_BALLOC           (1 << 2)
 
 /**@brief   Debug mask: ext4_bitmap.c*/
-#define EXT4_DEBUG_BITMAP			(1 << 3)
+#define EXT4_DEBUG_BITMAP           (1 << 3)
 
 /**@brief   Debug mask: ext4_dir_idx.c*/
-#define EXT4_DEBUG_DIR_IDX			(1 << 4)
+#define EXT4_DEBUG_DIR_IDX          (1 << 4)
 
 /**@brief   Debug mask: ext4_dir.c*/
-#define EXT4_DEBUG_DIR				(1 << 5)
+#define EXT4_DEBUG_DIR              (1 << 5)
 
 /**@brief   Debug mask: ext4_ialloc.c*/
-#define EXT4_DEBUG_IALLOC			(1 << 6)
+#define EXT4_DEBUG_IALLOC           (1 << 6)
 
 /**@brief   Debug mask: ext4_inode.c*/
-#define EXT4_DEBUG_INODE			(1 << 7)
+#define EXT4_DEBUG_INODE            (1 << 7)
 
 /**@brief   Debug mask: ext4_super.c*/
-#define EXT4_DEBUG_SUPER			(1 << 8)
+#define EXT4_DEBUG_SUPER            (1 << 8)
 
 /**@brief   Debug mask: ext4_bcache.c*/
-#define EXT4_DEBUG_BCACHE			(1 << 9)
+#define EXT4_DEBUG_BCACHE           (1 << 9)
 
 /**@brief   Debug mask: ext4_extents.c*/
 #define EXT4_DEBUG_EXTENTS          (1 << 10)
@@ -77,26 +77,26 @@
 
 
 
-/**@brief	All debug printf enabled.*/
-#define EXT4_DEBUG_ALL				(0xFFFFFFFF)
+/**@brief   All debug printf enabled.*/
+#define EXT4_DEBUG_ALL              (0xFFFFFFFF)
 
-/**@brief	Global mask debug settings.
- * @brief	m new debug mask.*/
+/**@brief   Global mask debug settings.
+ * @brief   m new debug mask.*/
 void ext4_dmask_set(uint32_t m);
 
-/**@brief	Global debug mask get.
- * @return	debug mask*/
+/**@brief   Global debug mask get.
+ * @return  debug mask*/
 uint32_t ext4_dmask_get(void);
 
 
 #if CONFIG_DEBUG_PRINTF
-/**@brief	Debug printf.*/
-#define ext4_dprintf(m, ...)	do {                            \
+/**@brief   Debug printf.*/
+#define ext4_dprintf(m, ...)    do {                            \
         (m & ext4_dmask_get()) ? printf(__VA_ARGS__) : (void)0; \
         fflush(stdout);                                         \
 }while(0)
 #else
-#define 	ext4_dprintf(m, ...)
+#define ext4_dprintf(m, ...)
 #endif
 
 
@@ -103,7 +103,7 @@
 
 #if CONFIG_DEBUG_ASSERT
 /**@brief   Debug asseration.*/
-#define ext4_assert(_v)	do {                                                \
+#define ext4_assert(_v) do {                                                \
         if(!(_v)){                                                          \
             printf("Assertion failed:\nmodule: %s\nfunc: %s\nline: %d\n",   \
                     __FILE__, __FUNCTION__, __LINE__);                      \
--- a/lwext4/ext4_dir.c
+++ b/lwext4/ext4_dir.c
@@ -439,8 +439,8 @@
 
     /* Entry was not found */
 
-    result->block.lb_id =  0;
-    result->dentry 		=  NULL;
+    result->block.lb_id = 0;
+    result->dentry = NULL;
 
     return ENOENT;
 }
@@ -513,7 +513,7 @@
 
     /* Initialize pointers, stop means to upper bound */
     struct ext4_directory_entry_ll *dentry  = (void *)target_block->data;
-    struct ext4_directory_entry_ll *stop 	=
+    struct ext4_directory_entry_ll *stop =
             (void *)(target_block->data + block_size);
 
     /*
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -89,7 +89,7 @@
     return root_info->indirect_levels;
 }
 
-void 	ext4_dir_dx_root_info_set_indirect_levels(
+void ext4_dir_dx_root_info_set_indirect_levels(
     struct ext4_directory_dx_root_info *root_info, uint8_t lvl)
 {
     root_info->indirect_levels = lvl;
@@ -430,7 +430,7 @@
 
 
 
-int 	ext4_dir_dx_find_entry(struct ext4_directory_search_result * result,
+int ext4_dir_dx_find_entry(struct ext4_directory_search_result * result,
     struct ext4_inode_ref *inode_ref, size_t name_len, const char *name)
 {
     /* Load direct block 0 (index root) */
@@ -799,7 +799,7 @@
         if (rc != EOK)
             return rc;
 
-        struct ext4_directory_dx_node  *new_node 	= (void *)new_block.data;
+        struct ext4_directory_dx_node  *new_node = (void *)new_block.data;
         struct ext4_directory_dx_entry *new_entries = new_node->entries;
 
         memset(&new_node->fake, 0, sizeof(struct ext4_fake_directory_entry));
--- a/lwext4/ext4_errno.h
+++ b/lwext4/ext4_errno.h
@@ -41,41 +41,41 @@
 #ifndef CONFIG_HAVE_OWN_ERRNO
 #include <errno.h>
 #else
-#define	EPERM        1	/* Operation not permitted */
-#define	ENOENT       2	/* No such file or directory */
-#define	ESRCH        3	/* No such process */
-#define	EINTR        4	/* Interrupted system call */
-#define	EIO          5	/* I/O error */
-#define	ENXIO        6	/* No such device or address */
-#define	E2BIG        7	/* Argument list too long */
-#define	ENOEXEC      8	/* Exec format error */
-#define	EBADF        9	/* Bad file number */
-#define	ECHILD      10	/* No child processes */
-#define	EAGAIN      11	/* Try again */
-#define	ENOMEM      12	/* Out of memory */
-#define	EACCES      13	/* Permission denied */
-#define	EFAULT      14	/* Bad address */
-#define	ENOTBLK     15	/* Block device required */
-#define	EBUSY       16	/* Device or resource busy */
-#define	EEXIST      17	/* File exists */
-#define	EXDEV       18	/* Cross-device link */
-#define	ENODEV      19	/* No such device */
-#define	ENOTDIR     20	/* Not a directory */
-#define	EISDIR      21	/* Is a directory */
-#define	EINVAL      22	/* Invalid argument */
-#define	ENFILE      23	/* File table overflow */
-#define	EMFILE      24	/* Too many open files */
-#define	ENOTTY      25	/* Not a typewriter */
-#define	ETXTBSY     26	/* Text file busy */
-#define	EFBIG       27	/* File too large */
-#define	ENOSPC      28	/* No space left on device */
-#define	ESPIPE      29	/* Illegal seek */
-#define	EROFS       30	/* Read-only file system */
-#define	EMLINK      31	/* Too many links */
-#define	EPIPE       32	/* Broken pipe */
-#define	EDOM        33	/* Math argument out of domain of func */
-#define	ERANGE      34	/* Math result not representable */
-#define	ENOTSUP     95  /* Not supported */
+#define EPERM        1 /* Operation not permitted */
+#define ENOENT       2 /* No such file or directory */
+#define ESRCH        3 /* No such process */
+#define EINTR        4 /* Interrupted system call */
+#define EIO          5 /* I/O error */
+#define ENXIO        6 /* No such device or address */
+#define E2BIG        7 /* Argument list too long */
+#define ENOEXEC      8 /* Exec format error */
+#define EBADF        9 /* Bad file number */
+#define ECHILD      10 /* No child processes */
+#define EAGAIN      11 /* Try again */
+#define ENOMEM      12 /* Out of memory */
+#define EACCES      13 /* Permission denied */
+#define EFAULT      14 /* Bad address */
+#define ENOTBLK     15 /* Block device required */
+#define EBUSY       16 /* Device or resource busy */
+#define EEXIST      17 /* File exists */
+#define EXDEV       18 /* Cross-device link */
+#define ENODEV      19 /* No such device */
+#define ENOTDIR     20 /* Not a directory */
+#define EISDIR      21 /* Is a directory */
+#define EINVAL      22 /* Invalid argument */
+#define ENFILE      23 /* File table overflow */
+#define EMFILE      24 /* Too many open files */
+#define ENOTTY      25 /* Not a typewriter */
+#define ETXTBSY     26 /* Text file busy */
+#define EFBIG       27 /* File too large */
+#define ENOSPC      28 /* No space left on device */
+#define ESPIPE      29 /* Illegal seek */
+#define EROFS       30 /* Read-only file system */
+#define EMLINK      31 /* Too many links */
+#define EPIPE       32 /* Broken pipe */
+#define EDOM        33 /* Math argument out of domain of func */
+#define ERANGE      34 /* Math result not representable */
+#define ENOTSUP     95  /* Not supported */
 #endif
 
 #ifndef EOK
--- a/lwext4/ext4_fs.c
+++ b/lwext4/ext4_fs.c
@@ -384,8 +384,8 @@
 {
     struct ext4_sblock *sb = &bg_ref->fs->sb;
 
-    uint32_t inode_size 	  = ext4_get32(sb, inode_size);
-    uint32_t block_size 	  = ext4_sb_get_block_size(sb);
+    uint32_t inode_size = ext4_get32(sb, inode_size);
+    uint32_t block_size = ext4_sb_get_block_size(sb);
     uint32_t inodes_per_block = block_size / inode_size;
     uint32_t inodes_in_group  = ext4_inodes_in_group_cnt(sb, bg_ref->index);
     uint32_t table_blocks = inodes_in_group / inodes_per_block;
@@ -670,10 +670,10 @@
     ext4_inode_set_uid(inode, 0);
     ext4_inode_set_gid(inode, 0);
     ext4_inode_set_size(inode, 0);
-    ext4_inode_set_access_time(inode, 		0);
+    ext4_inode_set_access_time(inode, 0);
     ext4_inode_set_change_inode_time(inode, 0);
     ext4_inode_set_modification_time(inode, 0);
-    ext4_inode_set_deletion_time(inode, 	0);
+    ext4_inode_set_deletion_time(inode, 0);
     ext4_inode_set_blocks_count(&fs->sb, inode, 0);
     ext4_inode_set_flags(inode, 0);
     ext4_inode_set_generation(inode, 0);
@@ -737,7 +737,7 @@
     uint32_t block_size = ext4_sb_get_block_size(&fs->sb);
     uint32_t count = block_size / sizeof(uint32_t);
 
-    struct	ext4_block  block;
+    struct ext4_block  block;
 
     /* 2) Double indirect */
     fblock = ext4_inode_get_indirect_block(inode_ref->inode, 1);
@@ -768,7 +768,7 @@
     }
 
     /* 3) Tripple indirect */
-    struct	ext4_block  subblock;
+    struct ext4_block  subblock;
     fblock = ext4_inode_get_indirect_block(inode_ref->inode, 2);
     if (fblock != 0) {
         int rc = ext4_block_get(fs->bdev, &block, fblock);
@@ -971,7 +971,7 @@
         return EOK;
     }
 
-    struct	ext4_block block;
+    struct ext4_block block;
 
     /*
      * Navigate through other levels, until we find the block number
@@ -1065,8 +1065,8 @@
 
     uint32_t new_block_addr;
 
-    struct	ext4_block block;
-    struct	ext4_block new_block;
+    struct ext4_block block;
+    struct ext4_block new_block;
 
     /* Is needed to allocate indirect block on the i-node level */
     if (current_block == 0) {
@@ -1224,7 +1224,7 @@
      * Navigate through other levels, until we find the block number
      * or find null reference meaning we are dealing with sparse file
      */
-    struct	ext4_block block;
+    struct ext4_block block;
 
     while (level > 0) {
 
--- a/lwext4/ext4_hash.h
+++ b/lwext4/ext4_hash.h
@@ -41,14 +41,14 @@
 
 #include <stdint.h>
 
-/**@brief	Directory entry name hash function.
- * @param	name entry name
- * @param	len entry name length
- * @param	hash_seed (from superblock)
- * @param	hash version (from superblock)
- * @param	hash_minor output value
- * @param	hash_major output value
- * @return 	standard error code*/
+/**@brief   Directory entry name hash function.
+ * @param   name entry name
+ * @param   len entry name length
+ * @param   hash_seed (from superblock)
+ * @param   hash version (from superblock)
+ * @param   hash_minor output value
+ * @param   hash_major output value
+ * @return  standard error code*/
 int ext2_htree_hash(const char *name, int len,
         const uint32_t *hash_seed, int hash_version,
         uint32_t *hash_major, uint32_t *hash_minor);
--- a/lwext4/ext4_ialloc.c
+++ b/lwext4/ext4_ialloc.c
@@ -86,7 +86,7 @@
     uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(
             bg_ref.block_group, sb);
 
-    struct	ext4_block bitmap_block;
+    struct ext4_block bitmap_block;
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
     if (rc != EOK)
         return rc;
@@ -173,7 +173,7 @@
             uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(
                     bg_ref.block_group, sb);
 
-            struct	ext4_block bitmap_block;
+            struct ext4_block bitmap_block;
             rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
             if (rc != EOK)
                 return rc;
--- a/lwext4/ext4_inode.c
+++ b/lwext4/ext4_inode.c
@@ -69,7 +69,7 @@
     return v;
 }
 
-void 	 ext4_inode_set_mode(struct ext4_sblock *sb, struct ext4_inode *inode,
+void ext4_inode_set_mode(struct ext4_sblock *sb, struct ext4_inode *inode,
     uint32_t mode)
 {
     inode->mode = to_le16((mode << 16) >> 16);
@@ -83,7 +83,7 @@
     return to_le32(inode->uid);
 }
 
-void 	 ext4_inode_set_uid(struct ext4_inode *inode, uint32_t uid)
+void ext4_inode_set_uid(struct ext4_inode *inode, uint32_t uid)
 {
     inode->uid = to_le32(uid);
 }
@@ -154,7 +154,7 @@
 }
 void ext4_inode_set_gid(struct ext4_inode *inode, uint32_t gid)
 {
-    inode->gid	= to_le32(gid);
+    inode->gid = to_le32(gid);
 }
 
 uint16_t ext4_inode_get_links_count(struct ext4_inode *inode)
@@ -234,7 +234,7 @@
 }
 void ext4_inode_set_flags(struct ext4_inode *inode, uint32_t flags)
 {
-    inode->flags = 	to_le32(flags);
+    inode->flags = to_le32(flags);
 }
 
 uint32_t ext4_inode_get_generation(struct ext4_inode *inode)
@@ -241,7 +241,7 @@
 {
     return to_le32(inode->generation);
 }
-void 	 ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen)
+void ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen)
 {
     inode->generation = to_le32(gen);
 }
--- a/lwext4/ext4_super.c
+++ b/lwext4/ext4_super.c
@@ -59,8 +59,8 @@
 uint32_t ext4_blocks_in_group_cnt(struct ext4_sblock *s, uint32_t bgid)
 {
     uint32_t block_group_count = ext4_block_group_cnt(s);
-    uint32_t blocks_per_group  = ext4_get32(s, blocks_per_group);
-    uint64_t total_blocks 	   = ext4_sb_get_blocks_cnt(s);
+    uint32_t blocks_per_group = ext4_get32(s, blocks_per_group);
+    uint64_t total_blocks = ext4_sb_get_blocks_cnt(s);
 
     if (bgid < block_group_count - 1)
         return blocks_per_group;
@@ -82,13 +82,13 @@
     return (total_inodes - ((block_group_count - 1) * inodes_per_group));
 }
 
-int	ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s)
+int ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s)
 {
     return ext4_block_writebytes(bdev, EXT4_SUPERBLOCK_OFFSET,
             s, EXT4_SUPERBLOCK_SIZE);
 }
 
-int	ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s)
+int ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s)
 {
     return ext4_block_readbytes(bdev, EXT4_SUPERBLOCK_OFFSET,
             s, EXT4_SUPERBLOCK_SIZE);
--- a/lwext4/ext4_super.h
+++ b/lwext4/ext4_super.h
@@ -165,13 +165,13 @@
  * @param   bdev block device descriptor.
  * @param   s superblock descruptor
  * @return  Standard error code */
-int	ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s);
+int ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s);
 
 /**@brief   Superblock read.
  * @param   bdev block device descriptor.
  * @param   s superblock descruptor
  * @return  Standard error code */
-int	ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s);
+int ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s);
 
 /**@brief   Superblock simple validation.
  * @param   s superblock dsecriptor
--- a/lwext4/ext4_types.h
+++ b/lwext4/ext4_types.h
@@ -230,8 +230,8 @@
                 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
 
 struct ext4_fs {
-    struct ext4_blockdev	*bdev;
-    struct ext4_sblock  	sb;
+    struct ext4_blockdev*bdev;
+    struct ext4_sblock sb;
 
     uint64_t inode_block_limits[4];
     uint64_t inode_blocks_per_level[4];
@@ -270,11 +270,11 @@
 } ;
 
 struct ext4_block_group_ref {
-    struct ext4_block 	block;
-    struct ext4_bgroup 	*block_group;
-    struct ext4_fs  	*fs;
-    uint32_t 			index;
-    bool 				dirty;
+    struct ext4_block block;
+    struct ext4_bgroup *block_group;
+    struct ext4_fs *fs;
+    uint32_t index;
+    bool dirty;
 };
 
 #define EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE  32
@@ -384,8 +384,8 @@
 #define EXT4_INODE_ROOT_INDEX  2
 
 struct ext4_inode_ref {
-    struct ext4_block 		 block;
-    struct ext4_inode 		*inode;
+    struct ext4_block  block;
+    struct ext4_inode *inode;
     struct ext4_fs  *fs;
     uint32_t index;
     bool dirty;
@@ -420,15 +420,15 @@
 } __attribute__((packed)) ;
 
 struct ext4_directory_iterator {
-    struct ext4_inode_ref 			*inode_ref;
-    struct ext4_block 	   			current_block;
-    uint64_t 						current_offset;
+    struct ext4_inode_ref *inode_ref;
+    struct ext4_block current_block;
+    uint64_t current_offset;
     struct ext4_directory_entry_ll  *current;
 };
 
 struct ext4_directory_search_result {
-    struct	ext4_block 		 		block;
-    struct  ext4_directory_entry_ll *dentry;
+    struct ext4_block block;
+    struct ext4_directory_entry_ll *dentry;
 };
 
 /* Structures for indexed directory */
@@ -478,7 +478,7 @@
 };
 
 struct ext4_directory_dx_block {
-    struct ext4_block 		 	    block;
+    struct ext4_block block;
     struct ext4_directory_dx_entry *entries;
     struct ext4_directory_dx_entry *position;
 } ;
@@ -526,31 +526,31 @@
 } ;
 
 struct ext4_extent_path {
-    struct	ext4_block 		 	block;
-    uint16_t 					depth;
+    struct ext4_block block;
+    uint16_t depth;
     struct ext4_extent_header *header;
-    struct ext4_extent_index  *index;
-    struct ext4_extent 		  *extent;
+    struct ext4_extent_index *index;
+    struct ext4_extent *extent;
 } ;
 
 #define EXT4_EXTENT_MAGIC  0xF30A
 
-#define	EXT4_EXTENT_FIRST(header) \
+#define EXT4_EXTENT_FIRST(header) \
         ((struct ext4_extent *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
 
-#define	EXT4_EXTENT_FIRST_INDEX(header) \
+#define EXT4_EXTENT_FIRST_INDEX(header) \
         ((struct ext4_extent_index *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
 
 
 /* EXT3 HTree directory indexing */
-#define EXT2_HTREE_LEGACY					0
-#define EXT2_HTREE_HALF_MD4					1
-#define EXT2_HTREE_TEA						2
-#define EXT2_HTREE_LEGACY_UNSIGNED			3
-#define EXT2_HTREE_HALF_MD4_UNSIGNED		4
-#define EXT2_HTREE_TEA_UNSIGNED				5
+#define EXT2_HTREE_LEGACY                   0
+#define EXT2_HTREE_HALF_MD4                 1
+#define EXT2_HTREE_TEA                      2
+#define EXT2_HTREE_LEGACY_UNSIGNED          3
+#define EXT2_HTREE_HALF_MD4_UNSIGNED        4
+#define EXT2_HTREE_TEA_UNSIGNED             5
 
-#define EXT2_HTREE_EOF 						0x7FFFFFFF
+#define EXT2_HTREE_EOF                      0x7FFFFFFF
 
 
 struct ext4_hash_info {
@@ -578,7 +578,7 @@
 
 static inline uint32_t to_le32(uint32_t n)
 {
-    return 	((n & 0xff) << 24) |
+    return  ((n & 0xff) << 24) |
             ((n & 0xff00) << 8) |
             ((n & 0xff0000) >> 8) |
             ((n & 0xff000000) >> 24);
@@ -586,27 +586,27 @@
 
 static inline uint16_t to_le16(uint16_t n)
 {
-    return 	((n & 0xff) << 8) |
+    return  ((n & 0xff) << 8) |
             ((n & 0xff00) >> 8);
 }
 
 
 #else
-#define to_le64(_n)	_n
-#define to_le32(_n)	_n
-#define to_le16(_n)	_n
+#define to_le64(_n) _n
+#define to_le32(_n) _n
+#define to_le16(_n) _n
 #endif
 
 /****************************Access macros to ext4 structures*****************/
 
-#define ext4_get32(s, f)		to_le32((s)->f)
-#define ext4_get16(s, f)		to_le16((s)->f)
-#define ext4_get8(s, f)			(s)->f
+#define ext4_get32(s, f)        to_le32((s)->f)
+#define ext4_get16(s, f)        to_le16((s)->f)
+#define ext4_get8(s, f)         (s)->f
 
 
-#define ext4_set32(s, f, v)		do { (s)->f = to_le32(v); }while(0)
-#define ext4_set16(s, f, v)		do { (s)->f = to_le16(v); }while(0)
-#define ext4_set8 (s, f, v)		do { (s)->f = (v); 		  }while(0)
+#define ext4_set32(s, f, v)     do { (s)->f = to_le32(v); }while(0)
+#define ext4_set16(s, f, v)     do { (s)->f = to_le16(v); }while(0)
+#define ext4_set8 (s, f, v)     do { (s)->f = (v);        }while(0)
 
 #endif /* EXT4_TYPES_H_ */
 
--- a/readme.txt
+++ b/readme.txt
@@ -53,7 +53,7 @@
  - DIR_PREALLOC:   no
  - IMAGIC_INODES:  no
  - HAS_JOURNAL:    no
- - EXT_ATTR: 	   no
+ - EXT_ATTR:       no
  - RESIZE_INODE:   no
  - DIR_INDEX:      yes
 
@@ -67,8 +67,8 @@
  - EXTRA_ISIZE:   yes
 
 Supported filetypes:
- - FIFO: 	  no
- - CHARDEV:	  no
+ - FIFO:      no
+ - CHARDEV:   no
  - DIRECTORY: yes
  - BLOCKDEV:  no
  - FILE:      yes
@@ -94,7 +94,7 @@
 
 +toolchain     - specific toolchain cmake files
 
-+ext4.h	       - lwext4 client library header
++ext4.h        - lwext4 client library header
 CMakeLists.txt - CMake config file
 ext_images.7z  - ext2/3/4 100MB images
 Makefile       - helper makefile to call cmake
--- a/toolchain/bf518.cmake
+++ b/toolchain/bf518.cmake
@@ -3,20 +3,15 @@
 set(CMAKE_SYSTEM_PROCESSOR bf518)
 
 # Toolchain settings
-set(CMAKE_C_COMPILER 	bfin-elf-gcc)
-set(CMAKE_CXX_COMPILER	bfin-elf-g++)
+set(CMAKE_C_COMPILER    bfin-elf-gcc)
+set(CMAKE_CXX_COMPILER  bfin-elf-g++)
 set(AS                  bfin-elf--gcc)
-set(AR			        bfin-elf-ar)
-set(OBJCOPY 		    bfin-elf-objcopy)
-set(OBJDUMP 		    bfin-elf-objdump)
+set(AR                  bfin-elf-ar)
+set(OBJCOPY             bfin-elf-objcopy)
+set(OBJDUMP             bfin-elf-objdump)
 set(SIZE                bfin-elf-size)
 
-set(CMAKE_C_FLAGS   "-mcpu=bf518 -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
-set(CMAKE_CXX_FLAGS "-mcpu=bf518 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
+set(CMAKE_C_FLAGS   "-mcpu=bf518 -Os -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
+set(CMAKE_CXX_FLAGS "-mcpu=bf518 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
 set(CMAKE_ASM_FLAGS "-mcpu=bf518 -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mcpu=bf592" CACHE INTERNAL "exe link flags")
-					
-							
-		
-		
-		
\ No newline at end of file
--- a/toolchain/cortex-m3.cmake
+++ b/toolchain/cortex-m3.cmake
@@ -3,16 +3,16 @@
 set(CMAKE_SYSTEM_PROCESSOR cortex-m3)
 
 # Toolchain settings
-set(CMAKE_C_COMPILER 	arm-none-eabi-gcc)
-set(CMAKE_CXX_COMPILER 	arm-none-eabi-g++)
-set(AS 	                arm-none-eabi-as)
-set(AR         			arm-none-eabi-ar)
-set(OBJCOPY 	    	arm-none-eabi-objcopy)
-set(OBJDUMP     		arm-none-eabi-objdump)
+set(CMAKE_C_COMPILER    arm-none-eabi-gcc)
+set(CMAKE_CXX_COMPILER  arm-none-eabi-g++)
+set(AS                  arm-none-eabi-as)
+set(AR                  arm-none-eabi-ar)
+set(OBJCOPY             arm-none-eabi-objcopy)
+set(OBJDUMP             arm-none-eabi-objdump)
 set(SIZE                arm-none-eabi-size)
 
-set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m3 -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
-set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m3 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
+set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m3 -Os -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
+set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m3 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
 set(CMAKE_ASM_FLAGS "-mthumb -mcpu=cortex-m3" CACHE INTERNAL "asm compiler flags")
 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mthumb -mcpu=cortex-m3" CACHE INTERNAL "exe link flags")
 
--- a/toolchain/cortex-m4.cmake
+++ b/toolchain/cortex-m4.cmake
@@ -3,16 +3,16 @@
 set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
 
 # Toolchain settings
-set(CMAKE_C_COMPILER 	arm-none-eabi-gcc)
-set(CMAKE_CXX_COMPILER 	arm-none-eabi-g++)
-set(AS 	                arm-none-eabi-as)
-set(AR         			arm-none-eabi-ar)
-set(OBJCOPY 	    	arm-none-eabi-objcopy)
-set(OBJDUMP     		arm-none-eabi-objdump)
+set(CMAKE_C_COMPILER    arm-none-eabi-gcc)
+set(CMAKE_CXX_COMPILER  arm-none-eabi-g++)
+set(AS                  arm-none-eabi-as)
+set(AR                  arm-none-eabi-ar)
+set(OBJCOPY             arm-none-eabi-objcopy)
+set(OBJDUMP             arm-none-eabi-objdump)
 set(SIZE                arm-none-eabi-size)
 
-set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m4 -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
-set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m4 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
+set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m4 -Os -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
+set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m4 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
 set(CMAKE_ASM_FLAGS "-mthumb -mcpu=cortex-m4" CACHE INTERNAL "asm compiler flags")
 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mthumb -mcpu=cortex-m4" CACHE INTERNAL "exe link flags")