shithub: lwext4

Download patch

ref: 14dd317f2a50e0ef02aa811f5d3311e879b8e19a
parent: 57c3921e0740fd268e794bdb86c6fea7994101b5
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Oct 27 19:00:15 EDT 2013

Code format.

--- a/ext4.h
+++ b/ext4.h
@@ -163,7 +163,7 @@
  * @param   bd block device cache (0 = automatic cache mode)
  * @param   dev_name register name
  * @param   standard error code*/
-int	ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
+int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
         const char *dev_name);
 
 /**@brief   Mount a block device with EXT4 partition to the mountpoint.
@@ -174,12 +174,12 @@
  *          -   /my_second_partition/
  *
  * @return standard error code */
-int	ext4_mount(const char * dev_name,  char *mount_point);
+int ext4_mount(const char * dev_name,  char *mount_point);
 
 /**@brief   Umount operation.
  * @param	mount_point mount name
  * @return  standard error code */
-int	ext4_umount(char *mount_point);
+int ext4_umount(char *mount_point);
 
 
 /**@brief   Some of the filesystem stats.*/
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -50,41 +50,41 @@
 
 #include <ext4.h>
 
-/**@brief	Mount point OS dependent lock*/
+/**@brief   Mount point OS dependent lock*/
 #define EXT4_MP_LOCK(_m)    \
         do { (_m)->os_locks ? (_m)->os_locks->lock() : 0; }while(0)
 
-/**@brief	Mount point OS dependent unlock*/
+/**@brief   Mount point OS dependent unlock*/
 #define EXT4_MP_UNLOCK(_m)  \
         do { (_m)->os_locks ? (_m)->os_locks->unlock() : 0; }while(0)
 
-/**@brief	Mount point descrpitor.*/
+/**@brief   Mount point descrpitor.*/
 struct ext4_mountpoint {
 
     /**@brief	Mount point name (@ref ext4_mount)*/
-    const char 		 *name;
+    const char *name;
 
     /**@brief	Os dependent lock/unlock functions.*/
     struct ext4_lock *os_locks;
 
     /**@brief	Ext4 filesystem internals.*/
-    struct ext4_fs	 fs;
+    struct ext4_fs fs;
 
     /**@brief	Dynamic alocation cache flag.*/
-    bool            cache_dynamic;
+    bool cache_dynamic;
 };
 
-/**@brief	Block devices descriptor.*/
+/**@brief   Block devices descriptor.*/
 struct	_ext4_devices {
 
-    /**@brief	Block device name (@ref ext4_device_register)*/
-    const char				*name;
+    /**@brief   Block device name (@ref ext4_device_register)*/
+    const char *name;
 
-    /**@brief	Block device handle.*/
-    struct ext4_blockdev	*bd;
+    /**@brief   Block device handle.*/
+    struct ext4_blockdev *bd;
 
-    /**@brief	Block cache handle.*/
-    struct ext4_bcache		*bc;
+    /**@brief   Block cache handle.*/
+    struct ext4_bcache *bc;
 };
 
 /**@brief	Block devices.*/
@@ -92,11 +92,11 @@
 
 
 /**@brief	Mountpoints.*/
-struct ext4_mountpoint	_mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];
+struct ext4_mountpoint _mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];
 
 
 
-int	ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
+int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
     const char *dev_name)
 {
     uint32_t i;
@@ -355,7 +355,6 @@
     bsize = ext4_sb_get_block_size(&mp->fs.sb);
     ext4_block_set_lb_size(bd, bsize);
 
-
     mp->cache_dynamic = 0;
 
     if(!bc){
@@ -374,7 +373,6 @@
     if(bsize != bc->itemsize)
         return ENOTSUP;
 
-
     /*Bind block cache to block device*/
     r = ext4_block_bind_bcache(bd, bc);
     if(r != EOK){
@@ -468,7 +466,6 @@
     return 0;
 }
 
-
 static int ext4_path_check(const char *path, bool* is_goal)
 {
     int i;
@@ -683,7 +680,6 @@
 
         if(f->flags & O_APPEND)
             f->fpos = f->fsize;
-
     }
 
     r = ext4_fs_put_inode_ref(&ref);
@@ -695,11 +691,11 @@
 int ext4_fremove(const char *path)
 {
     ext4_file   f;
-    uint32_t    parent_inode;
-    uint32_t    name_off;
-    int     r;
-    int     len;
-    bool    is_goal;
+    uint32_t parent_inode;
+    uint32_t name_off;
+    int r;
+    int len;
+    bool is_goal;
     struct ext4_mountpoint *mp = ext4_get_mount(path);
 
     struct ext4_inode_ref child;
@@ -788,7 +784,7 @@
 }
 int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
 {
-    int		 r = EOK;
+    int r = EOK;
     uint32_t u;
     uint32_t fblock;
     uint32_t fblock_start;
@@ -922,7 +918,7 @@
 
 int	ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
 {
-    int		 r = EOK;
+    int r = EOK;
     uint32_t u;
     uint32_t fblock;
     struct ext4_block b;
@@ -1096,13 +1092,10 @@
 
 }
 
-
-
 int ext4_fseek(ext4_file *f, uint64_t offset, uint32_t origin)
 {
     switch(origin){
     case SEEK_SET:
-
         if(offset > f->fsize)
             return EINVAL;
 
@@ -1117,22 +1110,22 @@
     case SEEK_END:
         if(offset > f->fsize)
             return EINVAL;
+
         f->fpos = f->fsize - offset;
         return EOK;
 
     }
-
     return EINVAL;
 }
 
 uint64_t ext4_ftell (ext4_file *f)
 {
-    return  f->fpos;
+    return f->fpos;
 }
 
 uint64_t ext4_fsize (ext4_file *f)
 {
-    return  f->fsize;
+    return f->fsize;
 }
 
 /*********************************DIRECTORY OPERATION************************/
@@ -1139,22 +1132,24 @@
 
 int ext4_dir_rm(const char *path)
 {
-    int         r;
-    int         len;
-    ext4_file   f;
-    struct ext4_mountpoint *mp = ext4_get_mount(path);
-    struct ext4_inode_ref   current;
-    struct ext4_inode_ref   child;
+    int r;
+    int len;
+    ext4_file f;
 
+    struct ext4_mountpoint *mp = ext4_get_mount(path);
+    struct ext4_inode_ref current;
+    struct ext4_inode_ref child;
     struct ext4_directory_iterator it;
+
     uint32_t name_off;
     uint32_t inode_up;
     uint32_t inode_current;
     uint32_t depth = 1;
-    bool     has_children;
-    bool     is_goal;
-    bool     dir_end;
 
+    bool has_children;
+    bool is_goal;
+    bool dir_end;
+
     if(!mp)
         return ENOENT;
 
@@ -1313,7 +1308,7 @@
 int ext4_dir_mk(const char *path)
 {
     int r;
-    ext4_file   f;
+    ext4_file f;
 
     struct ext4_mountpoint *mp = ext4_get_mount(path);
 
@@ -1362,7 +1357,7 @@
 
 ext4_direntry* ext4_dir_entry_get(ext4_dir *d, uint32_t id)
 {
-    int 	 r;
+    int r;
     uint32_t i;
     ext4_direntry *de = 0;
     struct ext4_inode_ref dir;
--- 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);
--- a/lwext4/ext4_block_group.h
+++ b/lwext4/ext4_block_group.h
@@ -50,6 +50,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 
+/**@brief   TODO: ...*/
 static inline uint64_t ext4_bg_get_block_bitmap(struct ext4_bgroup *bg,
     struct ext4_sblock *s)
 {
@@ -61,6 +62,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline uint64_t ext4_bg_get_inode_bitmap(struct ext4_bgroup *bg,
     struct ext4_sblock *s)
 {
@@ -73,6 +75,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline uint64_t ext4_bg_get_inode_table_first_block(
     struct ext4_bgroup *bg, struct ext4_sblock *s)
 {
@@ -84,6 +87,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline uint32_t ext4_bg_get_free_blocks_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s)
 {
@@ -95,6 +99,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_free_blocks_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
@@ -103,6 +108,7 @@
         bg->free_blocks_count_hi = to_le16(cnt >> 16);
 }
 
+/**@brief   TODO: ...*/
 static inline uint32_t ext4_bg_get_free_inodes_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s)
 {
@@ -114,6 +120,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_free_inodes_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
@@ -122,7 +129,7 @@
         bg->free_inodes_count_hi = to_le16(cnt >> 16);
 }
 
-
+/**@brief   TODO: ...*/
 static inline uint32_t ext4_bg_get_used_dirs_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s)
 {
@@ -134,6 +141,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_used_dirs_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
@@ -142,7 +150,7 @@
         bg->used_dirs_count_hi = to_le16(cnt >> 16);
 }
 
-
+/**@brief   TODO: ...*/
 static inline uint32_t ext4_bg_get_itable_unused(struct ext4_bgroup *bg,
     struct ext4_sblock *s)
 {
@@ -155,6 +163,7 @@
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_itable_unused(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
@@ -163,7 +172,7 @@
         bg->itable_unused_hi = to_le16(cnt >> 16);
 }
 
-
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_checksum(struct ext4_bgroup *bg,
     uint16_t crc)
 {
@@ -170,11 +179,13 @@
     bg->checksum = to_le16(crc);
 }
 
+/**@brief   TODO: ...*/
 static inline bool ext4_bg_has_flag(struct ext4_bgroup *bg, uint32_t f)
 {
     return to_le16(bg->flags) & f;
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_flag(struct ext4_bgroup *bg, uint32_t f)
 {
     uint16_t flags = to_le16(bg->flags);
@@ -182,6 +193,7 @@
     bg->flags = to_le16(flags);
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_clear_flag(struct ext4_bgroup *bg, uint32_t f)
 {
     uint16_t flags = to_le16(bg->flags);
@@ -189,7 +201,7 @@
     bg->flags = to_le16(flags);
 }
 
-
+/**@brief   TODO: ...*/
 uint16_t ext4_bg_crc16(uint16_t crc, const uint8_t *buffer, size_t len);
 
 #endif /* EXT4_BLOCK_GROUP_H_ */
--- a/lwext4/ext4_blockdev.c
+++ b/lwext4/ext4_blockdev.c
@@ -94,9 +94,10 @@
 {
     uint64_t pba;
     uint32_t pb_cnt;
-    bool	 is_new;
-    int 	 r;
     uint32_t i;
+    bool is_new;
+    int r;
+
     ext4_assert(bdev && b);
 
     if(!(bdev->flags & EXT4_BDEV_INITIALIZED))
@@ -148,10 +149,9 @@
     if(!b->data)
         return ENOMEM;
 
-    pba 	= (lba * bdev->lg_bsize) / bdev->ph_bsize;
-    pb_cnt  =  bdev->lg_bsize / bdev->ph_bsize;
+    pba = (lba * bdev->lg_bsize) / bdev->ph_bsize;
+    pb_cnt = bdev->lg_bsize / bdev->ph_bsize;
 
-
     r = bdev->bread(bdev, b->data, pba, pb_cnt);
 
     if(r != EOK){
@@ -161,7 +161,6 @@
     }
 
     bdev->bread_ctr++;
-
     return EOK;
 }
 
@@ -189,8 +188,8 @@
         return ext4_bcache_free(bdev->bc, b, bdev->cache_flush_delay);
     }
 
-    pba 	= (b->lb_id * bdev->lg_bsize) / bdev->ph_bsize;
-    pb_cnt  =  bdev->lg_bsize / bdev->ph_bsize;
+    pba = (b->lb_id * bdev->lg_bsize) / bdev->ph_bsize;
+    pb_cnt = bdev->lg_bsize / bdev->ph_bsize;
 
 
     r = bdev->bwrite(bdev, b->data, pba, pb_cnt);
@@ -215,16 +214,13 @@
 
     ext4_assert(bdev && buf);
 
-    pba 	= (lba * bdev->lg_bsize) / bdev->ph_bsize;
-    pb_cnt  =  bdev->lg_bsize / bdev->ph_bsize;
+    pba = (lba * bdev->lg_bsize) / bdev->ph_bsize;
+    pb_cnt = bdev->lg_bsize / bdev->ph_bsize;
 
     bdev->bread_ctr++;
-
     return bdev->bread(bdev, buf, pba, pb_cnt * cnt);
 }
 
-
-
 int ext4_blocks_set_direct(struct	ext4_blockdev *bdev, const void *buf,
     uint64_t lba, uint32_t cnt)
 {
@@ -233,8 +229,8 @@
 
     ext4_assert(bdev && buf);
 
-    pba 	= (lba * bdev->lg_bsize) / bdev->ph_bsize;
-    pb_cnt  =  bdev->lg_bsize / bdev->ph_bsize;
+    pba = (lba * bdev->lg_bsize) / bdev->ph_bsize;
+    pb_cnt = bdev->lg_bsize / bdev->ph_bsize;
 
     bdev->bwrite_ctr++;
 
@@ -247,11 +243,9 @@
 {
     uint64_t block_idx;
     uint64_t block_end;
-
     uint32_t blen;
-
     uint32_t unalg;
-    int		 r = EOK;
+    int r = EOK;
 
     const uint8_t	*p = (void *)buf;
 
@@ -260,7 +254,6 @@
     if(!(bdev->flags & EXT4_BDEV_INITIALIZED))
         return EIO;
 
-
     block_idx =  off / bdev->ph_bsize;
     block_end   =  block_idx + len / bdev->ph_bsize;
 
@@ -267,7 +260,6 @@
     if(!(block_end < bdev->ph_bcnt))
         return EINVAL;				/*Ups. Out of range operation*/
 
-
     /*OK lets deal with the first possible unaligned block*/
     unalg = (off & (bdev->ph_bsize - 1));
     if(unalg){
@@ -283,7 +275,6 @@
         memcpy(bdev->ph_bbuf + unalg, p, wlen);
 
         r = bdev->bwrite(bdev, bdev->ph_bbuf, block_idx, 1);
-
         if(r != EOK)
             return r;
 
@@ -295,13 +286,12 @@
 
     /*Aligned data*/
     blen = len / bdev->ph_bsize;
-
     r = bdev->bwrite(bdev, p, block_idx, blen);
 
     if(r != EOK)
         return r;
 
-    p 	+= bdev->ph_bsize * blen;
+    p += bdev->ph_bsize * blen;
     len -= bdev->ph_bsize * blen;
 
     block_idx += blen;
@@ -309,9 +299,7 @@
 
     /*Rest of the data*/
     if(len){
-
         r = bdev->bread(bdev, bdev->ph_bbuf, block_idx, 1);
-
         if(r != EOK)
             return r;
 
@@ -332,13 +320,11 @@
 int ext4_block_readbytes(struct	ext4_blockdev *bdev, uint64_t off, void *buf,
     uint32_t len)
 {
-
     uint64_t block_idx;
     uint64_t block_end;
     uint32_t blen;
-
     uint32_t unalg;
-    int		 r = EOK;
+    int r = EOK;
 
     uint8_t	*p = (void *)buf;
 
@@ -347,14 +333,12 @@
     if(!(bdev->flags & EXT4_BDEV_INITIALIZED))
         return EIO;
 
+    block_idx = off / bdev->ph_bsize;
+    block_end = block_idx + len / bdev->ph_bsize;
 
-    block_idx =  off / bdev->ph_bsize;
-    block_end   =  block_idx + len / bdev->ph_bsize;
-
     if(!(block_end < bdev->ph_bcnt))
         return EINVAL;				/*Ups. Out of range operation*/
 
-
     /*OK lets deal with the first possible unaligned block*/
     unalg = (off & (bdev->ph_bsize - 1));
     if(unalg){
@@ -363,7 +347,6 @@
                 len : (bdev->ph_bsize - unalg);
 
         r = bdev->bread(bdev, bdev->ph_bbuf, block_idx, 1);
-
         if(r != EOK)
             return r;
 
@@ -374,7 +357,6 @@
         block_idx++;
     }
 
-
     /*Aligned data*/
     blen = len / bdev->ph_bsize;
 
@@ -391,14 +373,11 @@
 
     /*Rest of the data*/
     if(len){
-
         r = bdev->bread(bdev, bdev->ph_bbuf, block_idx, 1);
-
         if(r != EOK)
             return r;
 
         memcpy(p, bdev->ph_bbuf, len);
-
     }
 
     return r;
@@ -437,7 +416,6 @@
             bdev->bc->ref_blocks--;
         }
     }
-
     return EOK;
 }
 
--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -44,12 +44,12 @@
 
 /**@brief	Enable directory indexing feature (EXT3 feature)*/
 #ifndef CONFIG_DIR_INDEX_ENABLE
-#define CONFIG_DIR_INDEX_ENABLE				1
+#define CONFIG_DIR_INDEX_ENABLE     1
 #endif
 
 /**@brief	Enable extents feature (EXT4 feature)*/
 #ifndef CONFIG_EXTENT_ENABLE
-#define CONFIG_EXTENT_ENABLE				1
+#define CONFIG_EXTENT_ENABLE        1
 #endif
 
 
@@ -56,41 +56,40 @@
 
 /**@brief	Include error codes from ext4_errno or sandard library.*/
 #ifndef CONFIG_HAVE_OWN_ERRNO
-#define CONFIG_HAVE_OWN_ERRNO				1
+#define CONFIG_HAVE_OWN_ERRNO       1
 #endif
 
 
 /**@brief	Debug printf enable (stdout)*/
 #ifndef CONFIG_DEBUG_PRINTF
-#define CONFIG_DEBUG_PRINTF					1
+#define CONFIG_DEBUG_PRINTF         1
 #endif
 
 /**@brief	Assert printf enable (stdout)*/
 #ifndef CONFIG_DEBUG_ASSERT
-#define CONFIG_DEBUG_ASSERT					1
+#define CONFIG_DEBUG_ASSERT         1
 #endif
 
 /**@brief	Statistics of block device*/
 #ifndef CONFIG_BLOCK_DEV_ENABLE_STATS
-#define CONFIG_BLOCK_DEV_ENABLE_STATS		1
+#define CONFIG_BLOCK_DEV_ENABLE_STATS   1
 #endif
 
 /**@brief	Cache size of block device.*/
 #ifndef CONFIG_BLOCK_DEV_CACHE_SIZE
-#define CONFIG_BLOCK_DEV_CACHE_SIZE			8
+#define CONFIG_BLOCK_DEV_CACHE_SIZE     8
 #endif
 
 
 /**@brief	Ilosc urzadzen blokowych.*/
 #ifndef CONFIG_EXT4_BLOCKDEVS_COUNT
-#define CONFIG_EXT4_BLOCKDEVS_COUNT			2
+#define CONFIG_EXT4_BLOCKDEVS_COUNT     2
 #endif
 
 /**@brief	Ilosc punktow montowania systemu plikow*/
 #ifndef CONFIG_EXT4_MOUNTPOINTS_COUNT
-#define CONFIG_EXT4_MOUNTPOINTS_COUNT		2
+#define CONFIG_EXT4_MOUNTPOINTS_COUNT   2
 #endif
-
 
 #endif /* EXT4_CONFIG_H_ */
 
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -48,7 +48,7 @@
 struct ext4_dx_sort_entry {
     uint32_t hash;
     uint32_t rec_len;
-    void 	 *dentry;
+    void *dentry;
 };
 
 static int ext4_dir_dx_hash_string(struct ext4_hash_info *hinfo, int len,
@@ -60,37 +60,37 @@
 
 
 uint8_t ext4_dir_dx_root_info_get_hash_version(
-        struct ext4_directory_dx_root_info *root_info)
+    struct ext4_directory_dx_root_info *root_info)
 {
     return root_info->hash_version;
 }
 
 
-void 	ext4_dir_dx_root_info_set_hash_version(
-        struct ext4_directory_dx_root_info  *root_info, uint8_t v)
+void ext4_dir_dx_root_info_set_hash_version(
+    struct ext4_directory_dx_root_info  *root_info, uint8_t v)
 {
     root_info->hash_version = v;
 }
 
 uint8_t ext4_dir_dx_root_info_get_info_length(
-        struct ext4_directory_dx_root_info *root_info)
+    struct ext4_directory_dx_root_info *root_info)
 {
     return root_info->info_length;
 }
-void 	ext4_dir_dx_root_info_set_info_length(
-        struct ext4_directory_dx_root_info  *root_info, uint8_t len)
+void ext4_dir_dx_root_info_set_info_length(
+    struct ext4_directory_dx_root_info  *root_info, uint8_t len)
 {
     root_info->info_length = len;
 }
 
 uint8_t ext4_dir_dx_root_info_get_indirect_levels(
-        struct ext4_directory_dx_root_info *root_info)
+    struct ext4_directory_dx_root_info *root_info)
 {
     return root_info->indirect_levels;
 }
 
 void 	ext4_dir_dx_root_info_set_indirect_levels(
-        struct ext4_directory_dx_root_info *root_info, uint8_t lvl)
+    struct ext4_directory_dx_root_info *root_info, uint8_t lvl)
 {
     root_info->indirect_levels = lvl;
 }
@@ -98,24 +98,24 @@
 
 
 uint16_t ext4_dir_dx_countlimit_get_limit(
-        struct ext4_directory_dx_countlimit *climit)
+    struct ext4_directory_dx_countlimit *climit)
 {
     return to_le16(climit->limit);
 }
-void 	ext4_dir_dx_countlimit_set_limit(
-        struct ext4_directory_dx_countlimit *climit, uint16_t limit)
+void ext4_dir_dx_countlimit_set_limit(
+    struct ext4_directory_dx_countlimit *climit, uint16_t limit)
 {
     climit->limit = to_le16(limit);
 }
 
 uint16_t ext4_dir_dx_countlimit_get_count(
-        struct ext4_directory_dx_countlimit *climit)
+    struct ext4_directory_dx_countlimit *climit)
 {
     return to_le16(climit->count);
 }
 
-void 	ext4_dir_dx_countlimit_set_count(
-        struct ext4_directory_dx_countlimit *climit, uint16_t count)
+void ext4_dir_dx_countlimit_set_count(
+    struct ext4_directory_dx_countlimit *climit, uint16_t count)
 {
     climit->count = to_le16(count);
 }
@@ -122,29 +122,29 @@
 
 
 uint32_t ext4_dir_dx_entry_get_hash(
-        struct ext4_directory_dx_entry *entry)
+    struct ext4_directory_dx_entry *entry)
 {
     return to_le32(entry->hash);
 }
 void ext4_dir_dx_entry_set_hash(
-        struct ext4_directory_dx_entry *entry, uint32_t hash)
+    struct ext4_directory_dx_entry *entry, uint32_t hash)
 {
     entry->hash = to_le32(hash);
 }
 
 uint32_t ext4_dir_dx_entry_get_block(
-        struct ext4_directory_dx_entry *entry)
+    struct ext4_directory_dx_entry *entry)
 {
     return to_le32(entry->block);
 }
-void 	ext4_dir_dx_entry_set_block(
-        struct ext4_directory_dx_entry *entry, uint32_t block)
+void ext4_dir_dx_entry_set_block(
+    struct ext4_directory_dx_entry *entry, uint32_t block)
 {
     entry->block = to_le32(block);
 }
 /****************************************************************************/
 
-int 	ext4_dir_dx_init(struct ext4_inode_ref *dir)
+int ext4_dir_dx_init(struct ext4_inode_ref *dir)
 {
     /* Load block 0, where will be index root located */
     uint32_t fblock;
@@ -165,7 +165,6 @@
     /* Initialize root info structure */
     uint8_t hash_version = ext4_get8(&dir->fs->sb, default_hash_version);
 
-
     ext4_dir_dx_root_info_set_hash_version(info, hash_version);
     ext4_dir_dx_root_info_set_indirect_levels(info, 0);
     ext4_dir_dx_root_info_set_info_length(info, 8);
@@ -223,8 +222,8 @@
 }
 
 static int ext4_dir_hinfo_init(struct ext4_hash_info *hinfo,
-        struct ext4_block *root_block, struct ext4_sblock *sb, size_t name_len,
-        const char *name)
+    struct ext4_block *root_block, struct ext4_sblock *sb, size_t name_len,
+    const char *name)
 {
     struct ext4_directory_dx_root *root =
             (struct ext4_directory_dx_root *) root_block->data;
@@ -276,9 +275,9 @@
 
 
 static int ext4_dir_dx_get_leaf(struct ext4_hash_info *hinfo,
-        struct ext4_inode_ref *inode_ref, struct ext4_block *root_block,
-        struct ext4_directory_dx_block **dx_block,
-        struct ext4_directory_dx_block *dx_blocks)
+    struct ext4_inode_ref *inode_ref, struct ext4_block *root_block,
+    struct ext4_directory_dx_block **dx_block,
+    struct ext4_directory_dx_block *dx_blocks)
 {
     struct ext4_directory_dx_block *tmp_dx_block = dx_blocks;
     struct ext4_directory_dx_root *root =
@@ -368,8 +367,8 @@
 }
 
 static int ext4_dir_dx_next_block(struct ext4_inode_ref *inode_ref,
-        uint32_t hash, struct ext4_directory_dx_block *dx_block,
-        struct ext4_directory_dx_block *dx_blocks)
+    uint32_t hash, struct ext4_directory_dx_block *dx_block,
+    struct ext4_directory_dx_block *dx_blocks)
 {
     uint32_t num_handles = 0;
     struct ext4_directory_dx_block *p = dx_block;
@@ -432,7 +431,7 @@
 
 
 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)
+    struct ext4_inode_ref *inode_ref, size_t name_len, const char *name)
 {
     /* Load direct block 0 (index root) */
     uint32_t root_block_addr;
@@ -543,8 +542,8 @@
 }
 
 static void ext4_dir_dx_insert_entry(
-        struct ext4_directory_dx_block *index_block, uint32_t hash,
-        uint32_t iblock)
+    struct ext4_directory_dx_block *index_block, uint32_t hash,
+    uint32_t iblock)
 {
     struct ext4_directory_dx_entry *old_index_entry = index_block->position;
     struct ext4_directory_dx_entry *new_index_entry = old_index_entry + 1;
@@ -567,9 +566,9 @@
 }
 
 static int ext4_dir_dx_split_data(struct ext4_inode_ref *inode_ref,
-        struct ext4_hash_info *hinfo, struct ext4_block *old_data_block,
-        struct ext4_directory_dx_block *index_block,
-        struct ext4_block *new_data_block)
+    struct ext4_hash_info *hinfo, struct ext4_block *old_data_block,
+    struct ext4_directory_dx_block *index_block,
+    struct ext4_block *new_data_block)
 {
     int rc = EOK;
 
@@ -639,7 +638,7 @@
 
     /* Sort all entries */
     qsort(sort_array, idx, sizeof(struct ext4_dx_sort_entry),
-            ext4_dir_dx_entry_comparator);
+        ext4_dir_dx_entry_comparator);
 
     /* Allocate new block for store the second part of entries */
     uint32_t new_fblock;
@@ -729,7 +728,7 @@
     free(entry_buffer);
 
     ext4_dir_dx_insert_entry(index_block, new_hash + continued,
-            new_iblock);
+        new_iblock);
 
     *new_data_block = new_data_block_tmp;
 
@@ -746,9 +745,9 @@
  *
  */
 static int ext4_dir_dx_split_index(struct ext4_inode_ref *inode_ref,
-        struct  ext4_directory_dx_block *dx_blocks,
-        struct ext4_directory_dx_block *dx_block,
-        struct ext4_directory_dx_block **new_dx_block)
+    struct  ext4_directory_dx_block *dx_blocks,
+    struct ext4_directory_dx_block *dx_block,
+    struct ext4_directory_dx_block **new_dx_block)
 {
     struct ext4_directory_dx_entry *entries;
 
@@ -819,7 +818,7 @@
 
             /* Copy data to new node */
             memcpy((void *) new_entries, (void *) (entries + count_left),
-                    count_right * sizeof(struct ext4_directory_dx_entry));
+                count_right * sizeof(struct ext4_directory_dx_entry));
 
             /* Initialize new node */
             struct ext4_directory_dx_countlimit *left_countlimit =
@@ -902,8 +901,8 @@
     return EOK;
 }
 
-int 	ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,
-        struct ext4_inode_ref *child, const char *name)
+int ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,
+    struct ext4_inode_ref *child, const char *name)
 {
     int rc2 = EOK;
 
--- a/lwext4/ext4_super.c
+++ b/lwext4/ext4_super.c
@@ -73,7 +73,7 @@
 {
     uint32_t block_group_count = ext4_block_group_cnt(s);
     uint32_t inodes_per_group  = ext4_get32(s, inodes_per_group);
-    uint32_t total_inodes =		 ext4_get32(s, inodes_count);
+    uint32_t total_inodes = ext4_get32(s, inodes_count);
 
 
     if (bgid < block_group_count - 1)
@@ -117,12 +117,10 @@
     if (ext4_get32(s, first_inode) < 11)
         return false;
 
-    if (ext4_sb_get_desc_size(s) <
-            EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
+    if (ext4_sb_get_desc_size(s) < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
         return false;
 
-    if (ext4_sb_get_desc_size(s)  >
-    EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE)
+    if (ext4_sb_get_desc_size(s) > EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE)
         return false;
 
     return true;