shithub: lwext4

Download patch

ref: 1e17302a6d811f32d889577d97b895eccc5c5ef2
parent: 0d8a58b8e5ab4190b5aa0c4b935161725aad7cac
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Oct 27 18:18:54 EDT 2013

1. Code format.
2. Commants.


--- a/ext4.h
+++ b/ext4.h
@@ -154,7 +154,7 @@
 
 /********************************MOUNT OPERATIONS****************************/
 
-/**@brief	Register a block device to a name.
+/**@brief   Register a block device to a name.
  *          @warning Block device has to be filled by
  *          @ref EXT4_BLOCKDEV_STATIC_INSTANCE. Block cache may be created
  *          @ref EXT4_BCACHE_STATIC_INSTANCE.
@@ -166,7 +166,7 @@
 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.
+/**@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
  *          -   /
@@ -176,7 +176,7 @@
  * @return standard error code */
 int	ext4_mount(const char * dev_name,  char *mount_point);
 
-/**@brief	Umount operation.
+/**@brief   Umount operation.
  * @param	mount_point mount name
  * @return  standard error code */
 int	ext4_umount(char *mount_point);
@@ -206,12 +206,12 @@
 
 /********************************FILE OPERATIONS*****************************/
 
-/**@brief	Remove file by path.
+/**@brief   Remove file by path.
  * @param   path path to file
  * @return  standard error code */
 int ext4_fremove(const char *path);
 
-/**@brief	File open function.
+/**@brief   File open function.
  * @param	filename, (has to start from mountpoint)
  * 			/my_partition/my_file
  * @param	flags open file flags
@@ -232,7 +232,7 @@
  * @return	standard error code*/
 int ext4_fopen (ext4_file *f, const char *path, const char *flags);
 
-/**@brief	File close function.
+/**@brief   File close function.
  * @param   f file handle
  * @return  standard error code*/
 int ext4_fclose(ext4_file *f);
@@ -245,7 +245,7 @@
  * @return  standard error code*/
 int ext4_fread (ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt);
 
-/**@brief	Write data to file.
+/**@brief   Write data to file.
  * @param   f file handle
  * @param   buf data to write
  * @param   size write length
@@ -253,7 +253,7 @@
  * @return  standard error code*/
 int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt);
 
-/**@brief	File seek operation.
+/**@brief   File seek operation.
  * @param   f file handle
  * @param   offset offset to seek
  * @param   origin seek type:
@@ -263,12 +263,12 @@
  * @return  standard error code*/
 int ext4_fseek (ext4_file *f, uint64_t offset, uint32_t origin);
 
-/**@brief	Get file position.
+/**@brief   Get file position.
  * @param   f file handle
  * @return  actual file position */
 uint64_t ext4_ftell (ext4_file *f);
 
-/**@brief	Get file size.
+/**@brief   Get file size.
  * @param   f file handle
  * @return  file size */
 uint64_t ext4_fsize (ext4_file *f);
@@ -275,7 +275,7 @@
 
 /*********************************DIRECTORY OPERATION***********************/
 
-/**@brief	Recursive directory remove.
+/**@brief   Recursive directory remove.
  * @param   path directory path to remove
  * @return  standard error code*/
 int ext4_dir_rm(const char *path);
@@ -285,19 +285,19 @@
  * @return  standard error code*/
 int ext4_dir_mk(const char *path);
 
-/**@brief	Directory open.
+/**@brief   Directory open.
  * @param   d directory handle
  * @param   path directory path
  * @return  standard error code*/
 int ext4_dir_open (ext4_dir *d, const char *path);
 
-/**@brief	Directory close.
+/**@brief   Directory close.
  * @param   d directory handle
  * @return  standard error code*/
 int ext4_dir_close(ext4_dir *d);
 
 
-/**@brief	Return directory entry by id.
+/**@brief   Return directory entry by id.
  * @param   d directory handle
  * @param   id entry id
  * @return  directory entry id (NULL id no entry)*/
--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -97,7 +97,7 @@
 
 
 int	ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
-        const char *dev_name)
+    const char *dev_name)
 {
     uint32_t i;
     ext4_assert(bd && dev_name);
@@ -175,7 +175,7 @@
 
 
 static int ext4_link(struct ext4_mountpoint *mp, struct ext4_inode_ref *parent,
-        struct ext4_inode_ref *child, const char *name, uint32_t name_len)
+    struct ext4_inode_ref *child, const char *name, uint32_t name_len)
 {
     /* Check maximum name length */
     if(name_len > EXT4_DIRECTORY_FILENAME_LEN)
@@ -214,7 +214,7 @@
                 return rc;
 
             ext4_inode_set_flag(child->inode,
-                    EXT4_INODE_FLAG_INDEX);
+                EXT4_INODE_FLAG_INDEX);
             child->dirty = true;
         }
 #endif
@@ -304,7 +304,7 @@
 
 /****************************************************************************/
 
-int			ext4_mount(const char * dev_name,  char *mount_point)
+int ext4_mount(const char * dev_name, char *mount_point)
 {
     ext4_assert(mount_point && dev_name);
     int r = EOK;
@@ -311,9 +311,9 @@
     int i;
 
     uint32_t bsize;
-    struct ext4_blockdev	*bd = 0;
-    struct ext4_bcache		*bc = 0;
-    struct ext4_mountpoint	*mp = 0;
+    struct ext4_blockdev *bd = 0;
+    struct ext4_bcache *bc = 0;
+    struct ext4_mountpoint *mp = 0;
 
     if(mount_point[strlen(mount_point) - 1] != '/')
         return ENOTSUP;
@@ -390,10 +390,10 @@
 }
 
 
-int			ext4_umount(char *mount_point)
+int	ext4_umount(char *mount_point)
 {
-    int 	i;
-    int 	r = EOK;
+    int	i;
+    int	r = EOK;
     struct ext4_mountpoint	*mp = 0;
 
     for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
@@ -434,11 +434,9 @@
             break;
         }
     }
-
     if(!mp)
         return ENOENT;
 
-
     EXT4_MP_LOCK(mp);
     stats->inodes_count      = ext4_get32(&mp->fs.sb, inodes_count);
     stats->free_inodes_count = ext4_get32(&mp->fs.sb, free_inodes_count);
@@ -458,7 +456,7 @@
 
 /********************************FILE OPERATIONS*****************************/
 
-static struct ext4_mountpoint*  ext4_get_mount(const char *path)
+static struct ext4_mountpoint* ext4_get_mount(const char *path)
 {
     int i;
     for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
@@ -532,13 +530,13 @@
 /****************************************************************************/
 
 static int ext4_generic_open (ext4_file *f, const char *path,
-        const char *flags, bool file_expect, uint32_t *parent_inode, uint32_t *name_off)
+    const char *flags, bool file_expect, uint32_t *parent_inode, uint32_t *name_off)
 {
     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;
+    uint8_t	inode_type = EXT4_DIRECTORY_FILETYPE_DIR;
     int		r = ENOENT;
     uint32_t next_inode;
 
@@ -763,7 +761,7 @@
 }
 
 
-int	ext4_fopen (ext4_file *f, const char *path, const char *flags)
+int ext4_fopen (ext4_file *f, const char *path, const char *flags)
 {
     struct ext4_mountpoint *mp = ext4_get_mount(path);
     int r;
@@ -777,7 +775,7 @@
     return r;
 }
 
-int	ext4_fclose(ext4_file *f)
+int ext4_fclose(ext4_file *f)
 {
     ext4_assert(f && f->mp);
 
@@ -788,7 +786,7 @@
 
     return EOK;
 }
-int	ext4_fread (ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
+int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
 {
     int		 r = EOK;
     uint32_t u;
@@ -1100,7 +1098,7 @@
 
 
 
-int ext4_fseek (ext4_file *f, uint64_t offset, uint32_t origin)
+int ext4_fseek(ext4_file *f, uint64_t offset, uint32_t origin)
 {
     switch(origin){
     case SEEK_SET:
@@ -1343,7 +1341,7 @@
     return r;
 }
 
-int	ext4_dir_open (ext4_dir *d, const char *path)
+int ext4_dir_open (ext4_dir *d, const char *path)
 {
     struct ext4_mountpoint *mp = ext4_get_mount(path);
     int r;
@@ -1357,12 +1355,12 @@
     return r;
 }
 
-int	ext4_dir_close(ext4_dir *d)
+int ext4_dir_close(ext4_dir *d)
 {
     return ext4_fclose(&d->f);
 }
 
-ext4_direntry*	ext4_dir_entry_get(ext4_dir *d, uint32_t id)
+ext4_direntry* ext4_dir_entry_get(ext4_dir *d, uint32_t id)
 {
     int 	 r;
     uint32_t i;
--- a/lwext4/ext4_balloc.h
+++ b/lwext4/ext4_balloc.h
@@ -54,28 +54,28 @@
  * @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);
+    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*/
-int 	ext4_balloc_free_block(struct ext4_inode_ref *inode_ref,
-        uint32_t baddr);
+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*/
-int 	ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
-        uint32_t first, uint32_t count);
+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*/
-int 	ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
-        uint32_t *baddr);
+int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
+    uint32_t *baddr);
 
 /**@brief	Try allocate selected block.
  * @param	inode_ref inode reference
@@ -82,8 +82,8 @@
  * @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);
+int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
+    uint32_t baddr, bool *free);
 
 #endif /* EXT4_BALLOC_H_ */
 
--- a/lwext4/ext4_bcache.c
+++ b/lwext4/ext4_bcache.c
@@ -48,15 +48,9 @@
 {
     ext4_assert(bc && cnt && itemsize);
 
-    bc->lru_ctr= 0;
+    memset(bc, 0, sizeof(struct ext4_bcache));
 
-    bc->refctr	 	= 0;
-    bc->lru_id 		= 0;
-    bc->free_delay  = 0;
-    bc->lba	  	 	= 0;
-    bc->data	 	= 0;
-
-    bc->refctr   = malloc(cnt * sizeof(uint32_t));
+    bc->refctr = malloc(cnt * sizeof(uint32_t));
     if(!bc->refctr)
         goto error;
 
@@ -68,11 +62,11 @@
     if(!bc->free_delay)
         goto error;
 
-    bc->lba 	 = malloc(cnt * sizeof(uint64_t));
+    bc->lba = malloc(cnt * sizeof(uint64_t));
     if(!bc->lba)
         goto error;
 
-    bc->data	 = malloc(cnt * itemsize);
+    bc->data = malloc(cnt * itemsize);
     if(!bc->data)
         goto error;
 
@@ -81,7 +75,7 @@
     memset(bc->free_delay, 0, cnt * sizeof(uint8_t));
     memset(bc->lba, 0, cnt * sizeof(uint64_t));
 
-    bc->cnt      = cnt;
+    bc->cnt = cnt;
     bc->itemsize = itemsize;
     bc->ref_blocks = 0;
     bc->max_ref_blocks = 0;
@@ -105,6 +99,8 @@
     if(bc->data)
         free(bc->data);
 
+    memset(bc, 0, sizeof(struct ext4_bcache));
+
     return ENOMEM;
 }
 
@@ -125,14 +121,8 @@
     if(bc->data)
         free(bc->data);
 
-    bc->lru_ctr= 0;
+    memset(bc, 0, sizeof(struct ext4_bcache));
 
-    bc->refctr	 	= 0;
-    bc->lru_id 		= 0;
-    bc->free_delay  = 0;
-    bc->lba	  	 	= 0;
-    bc->data	 	= 0;
-
     return EOK;
 }
 
@@ -150,7 +140,7 @@
     }
 
     uint32_t cache_id = bc->cnt;
-    uint32_t alloc_id;
+    uint32_t alloc_id = 0;
 
     *is_new = false;
 
--- a/lwext4/ext4_bitmap.c
+++ b/lwext4/ext4_bitmap.c
@@ -42,10 +42,8 @@
 
 void ext4_bmap_bits_free(uint8_t *bmap, uint32_t sbit, uint32_t bcnt)
 {
-    uint32_t i;
+    uint32_t i = sbit;
 
-    i = sbit;
-
     while(i & 7){
 
         if(!bcnt)
@@ -56,15 +54,11 @@
         bcnt--;
         i++;
     }
-
     sbit  = i;
     bmap += (sbit >> 3);
 
-
-
     while(bcnt >= 32){
         *(uint32_t *)bmap = 0;
-
         bmap += 4;
         bcnt -= 32;
         sbit += 32;
@@ -72,7 +66,6 @@
 
     while(bcnt >= 16){
         *(uint16_t *)bmap = 0;
-
         bmap += 2;
         bcnt -= 16;
         sbit += 16;
@@ -80,7 +73,6 @@
 
     while(bcnt >= 8){
         *bmap = 0;
-
         bmap += 1;
         bcnt -= 8;
         sbit += 8;
@@ -123,7 +115,6 @@
         if(*(uint32_t *)bmap != 0xFFFFFFFF)
             goto finish_it;
 
-
         bmap += 4;
         bcnt -= 32;
         sbit += 32;
@@ -133,7 +124,6 @@
         if(*(uint16_t *)bmap != 0xFFFF)
             goto finish_it;
 
-
         bmap += 2;
         bcnt -= 16;
         sbit += 16;
@@ -161,7 +151,6 @@
             return EOK;
         }
     }
-
 
     return ENOSPC;
 }
--- a/lwext4/ext4_block_group.h
+++ b/lwext4/ext4_block_group.h
@@ -95,7 +95,7 @@
     return v;
 }
 
-static inline void 	 ext4_bg_set_free_blocks_count(struct ext4_bgroup *bg,
+static inline void ext4_bg_set_free_blocks_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
     bg->free_blocks_count_lo = to_le16((cnt << 16) >> 16);
@@ -114,7 +114,7 @@
     return v;
 }
 
-static inline void 	 ext4_bg_set_free_inodes_count(struct ext4_bgroup *bg,
+static inline void ext4_bg_set_free_inodes_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
     bg->free_inodes_count_lo = to_le16((cnt << 16) >> 16);
@@ -134,7 +134,7 @@
     return v;
 }
 
-static inline void 	 ext4_bg_set_used_dirs_count(struct ext4_bgroup *bg,
+static inline void ext4_bg_set_used_dirs_count(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
     bg->used_dirs_count_lo = to_le16((cnt << 16) >> 16);
@@ -155,7 +155,7 @@
     return v;
 }
 
-static inline void 	 ext4_bg_set_itable_unused(struct ext4_bgroup *bg,
+static inline void ext4_bg_set_itable_unused(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
     bg->itable_unused_lo = to_le16((cnt << 16) >> 16);
@@ -164,18 +164,18 @@
 }
 
 
-static inline void 	 ext4_bg_set_checksum(struct ext4_bgroup *bg,
+static inline void ext4_bg_set_checksum(struct ext4_bgroup *bg,
     uint16_t crc)
 {
     bg->checksum = to_le16(crc);
 }
 
-static inline bool 	 ext4_bg_has_flag(struct ext4_bgroup *bg, uint32_t f)
+static inline bool ext4_bg_has_flag(struct ext4_bgroup *bg, uint32_t f)
 {
     return to_le16(bg->flags) & f;
 }
 
-static inline void 	 ext4_bg_set_flag(struct ext4_bgroup *bg, uint32_t f)
+static inline void ext4_bg_set_flag(struct ext4_bgroup *bg, uint32_t f)
 {
     uint16_t flags = to_le16(bg->flags);
     flags |= f;
@@ -182,7 +182,7 @@
     bg->flags = to_le16(flags);
 }
 
-static inline void 	 ext4_bg_clear_flag(struct ext4_bgroup *bg, uint32_t f)
+static inline void ext4_bg_clear_flag(struct ext4_bgroup *bg, uint32_t f)
 {
     uint16_t flags = to_le16(bg->flags);
     flags &= ~f;
--- a/lwext4/ext4_blockdev.h
+++ b/lwext4/ext4_blockdev.h
@@ -61,7 +61,7 @@
      * @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);
+            uint64_t blk_id, uint32_t blk_cnt);
 
     /**@brief	Block write function.
      * @param	buf input buffer
@@ -68,12 +68,15 @@
      * @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);
+            uint64_t blk_id, uint32_t blk_cnt);
 
     /**@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;
 
@@ -92,12 +95,13 @@
     /**@brief	Flags of te block device.*/
     uint8_t		flags;
 
-    /**@brief	Block cache.*/
-    struct	ext4_bcache *bc;
-
+    /**@brief   Cache flush delay mode flag.*/
     uint8_t		cache_flush_delay;
 
+    /**@brief   Physical read counter*/
     uint32_t	bread_ctr;
+
+    /**@brief   Physical write counter*/
     uint32_t	bwrite_ctr;
 };
 
@@ -104,7 +108,7 @@
 
 /**@brief	Static initialization fo the block device.*/
 #define EXT4_BLOCKDEV_STATIC_INSTANCE(__name, __bsize, __bcnt, __open,  \
-                                            __bread, __bwrite, __close)	\
+        __bread, __bwrite, __close)	\
         static uint8_t	__name##_ph_bbuf[(__bsize)];                    \
         static struct	ext4_blockdev __name = {                        \
                 .open   = __open,                                       \
--- a/lwext4/ext4_debug.c
+++ b/lwext4/ext4_debug.c
@@ -40,10 +40,10 @@
 #include <stdarg.h>
 #include <stdio.h>
 
-static uint32_t		__dbg_mask__;
+static uint32_t __dbg_mask__;
 
 
-void	ext4_dmask_set(uint32_t m)
+void ext4_dmask_set(uint32_t m)
 {
     __dbg_mask__ = m;
 }
--- a/lwext4/ext4_debug.h
+++ b/lwext4/ext4_debug.h
@@ -42,34 +42,34 @@
 #include <stdint.h>
 #include <stdio.h>
 
-/**@brief	Debug mask: ext4_blockdev.c*/
+/**@brief   Debug mask: ext4_blockdev.c*/
 #define EXT4_DEBUG_BLOCKDEV			(1 << 0)
 
-/**@brief	Debug mask: ext4_fs.c*/
+/**@brief   Debug mask: ext4_fs.c*/
 #define EXT4_DEBUG_FS				(1 << 1)
 
-/**@brief	Debug mask: ext4_balloc.c*/
+/**@brief   Debug mask: ext4_balloc.c*/
 #define EXT4_DEBUG_BALLOC			(1 << 2)
 
-/**@brief	Debug mask: ext4_bitmap.c*/
+/**@brief   Debug mask: ext4_bitmap.c*/
 #define EXT4_DEBUG_BITMAP			(1 << 3)
 
-/**@brief	Debug mask: ext4_dir_idx.c*/
+/**@brief   Debug mask: ext4_dir_idx.c*/
 #define EXT4_DEBUG_DIR_IDX			(1 << 4)
 
-/**@brief	Debug mask: ext4_dir.c*/
+/**@brief   Debug mask: ext4_dir.c*/
 #define EXT4_DEBUG_DIR				(1 << 5)
 
-/**@brief	Debug mask: ext4_ialloc.c*/
+/**@brief   Debug mask: ext4_ialloc.c*/
 #define EXT4_DEBUG_IALLOC			(1 << 6)
 
-/**@brief	Debug mask: ext4_inode.c*/
+/**@brief   Debug mask: ext4_inode.c*/
 #define EXT4_DEBUG_INODE			(1 << 7)
 
-/**@brief	Debug mask: ext4_super.c*/
+/**@brief   Debug mask: ext4_super.c*/
 #define EXT4_DEBUG_SUPER			(1 << 8)
 
-/**@brief	Debug mask: ext4_bcache.c*/
+/**@brief   Debug mask: ext4_bcache.c*/
 #define EXT4_DEBUG_BCACHE			(1 << 9)
 
 /**@brief   Debug mask: ext4_extents.c*/
@@ -82,7 +82,7 @@
 
 /**@brief	Global mask debug settings.
  * @brief	m new debug mask.*/
-void	 ext4_dmask_set(uint32_t m);
+void ext4_dmask_set(uint32_t m);
 
 /**@brief	Global debug mask get.
  * @return	debug mask*/
@@ -91,9 +91,9 @@
 
 #if CONFIG_DEBUG_PRINTF
 /**@brief	Debug printf.*/
-#define 	ext4_dprintf(m, ...)	do {					\
-        (m & ext4_dmask_get()) ? printf(__VA_ARGS__) : (void)0;	\
-        fflush(stdout);											\
+#define ext4_dprintf(m, ...)	do {                            \
+        (m & ext4_dmask_get()) ? printf(__VA_ARGS__) : (void)0; \
+        fflush(stdout);                                         \
 }while(0)
 #else
 #define 	ext4_dprintf(m, ...)
@@ -102,16 +102,16 @@
 
 
 #if CONFIG_DEBUG_ASSERT
-#define 	ext4_assert(_v)	do {						                    \
-        if(!(_v)){											                \
-            printf("Assertion failed:\nModule: %s\nFunc: %s\nLine: %d\n",   \
+/**@brief   Debug asseration.*/
+#define ext4_assert(_v)	do {                                                \
+        if(!(_v)){                                                          \
+            printf("Assertion failed:\nmodule: %s\nfunc: %s\nline: %d\n",   \
                     __FILE__, __FUNCTION__, __LINE__);                      \
         }                                                                   \
 }while(0)
 #else
-#define 	ext4_assert(_v)
+#define ext4_assert(_v)
 #endif
-
 
 #endif /* EXT4_DEBUG_H_ */
 
--- a/lwext4/ext4_dir_idx.h
+++ b/lwext4/ext4_dir_idx.h
@@ -48,52 +48,72 @@
 #include <stdint.h>
 #include <stdbool.h>
 
+/**@brief   TODO: ...*/
 uint8_t ext4_dir_dx_root_info_get_hash_version(
-        struct ext4_directory_dx_root_info *root_info);
-void 	ext4_dir_dx_root_info_set_hash_version(
-        struct ext4_directory_dx_root_info  *root_info, uint8_t v);
+    struct ext4_directory_dx_root_info *root_info);
 
+/**@brief   TODO: ...*/
+void ext4_dir_dx_root_info_set_hash_version(
+    struct ext4_directory_dx_root_info  *root_info, uint8_t v);
+
+/**@brief   TODO: ...*/
 uint8_t ext4_dir_dx_root_info_get_info_length(
-        struct ext4_directory_dx_root_info *root_info);
-void 	ext4_dir_dx_root_info_set_info_length(
-        struct ext4_directory_dx_root_info  *root_info, uint8_t len);
+    struct ext4_directory_dx_root_info *root_info);
 
+/**@brief   TODO: ...*/
+void ext4_dir_dx_root_info_set_info_length(
+    struct ext4_directory_dx_root_info  *root_info, uint8_t len);
+
+/**@brief   TODO: ...*/
 uint8_t ext4_dir_dx_root_info_get_indirect_levels(
-        struct ext4_directory_dx_root_info *root_info);
-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);
 
+/**@brief   TODO: ...*/
+void ext4_dir_dx_root_info_set_indirect_levels(
+    struct ext4_directory_dx_root_info *root_info, uint8_t lvl);
 
-
+/**@brief   TODO: ...*/
 uint16_t ext4_dir_dx_countlimit_get_limit(
-        struct ext4_directory_dx_countlimit *climit);
-void 	ext4_dir_dx_countlimit_set_limit(
-        struct ext4_directory_dx_countlimit *climit, uint16_t limit);
+    struct ext4_directory_dx_countlimit *climit);
 
+/**@brief   TODO: ...*/
+void ext4_dir_dx_countlimit_set_limit(
+    struct ext4_directory_dx_countlimit *climit, uint16_t limit);
+
+/**@brief   TODO: ...*/
 uint16_t ext4_dir_dx_countlimit_get_count(
-        struct ext4_directory_dx_countlimit *climit);
-void 	ext4_dir_dx_countlimit_set_count(
-        struct ext4_directory_dx_countlimit *climit, uint16_t count);
+    struct ext4_directory_dx_countlimit *climit);
 
+/**@brief   TODO: ...*/
+void ext4_dir_dx_countlimit_set_count(
+    struct ext4_directory_dx_countlimit *climit, uint16_t count);
 
+/**@brief   TODO: ...*/
 uint32_t ext4_dir_dx_entry_get_hash(
-        struct ext4_directory_dx_entry *entry);
+    struct ext4_directory_dx_entry *entry);
+
+/**@brief   TODO: ...*/
 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);
 
+/**@brief   TODO: ...*/
 uint32_t ext4_dir_dx_entry_get_block(
-        struct ext4_directory_dx_entry *entry);
-void 	ext4_dir_dx_entry_set_block(
-        struct ext4_directory_dx_entry *entry, uint32_t block);
+    struct ext4_directory_dx_entry *entry);
 
+/**@brief   TODO: ...*/
+void ext4_dir_dx_entry_set_block(
+    struct ext4_directory_dx_entry *entry, uint32_t block);
 
-int 	ext4_dir_dx_init(struct ext4_inode_ref *dir);
+/**@brief   TODO: ...*/
+int ext4_dir_dx_init(struct ext4_inode_ref *dir);
 
-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);
+/**@brief   TODO: ...*/
+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);
 
-int 	ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,
-        struct ext4_inode_ref *child, const char *name);
+/**@brief   TODO: ...*/
+int ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,
+    struct ext4_inode_ref *child, const char *name);
 
 #endif /* EXT4_DIR_IDX_H_ */