Code format.
authorgkostka <kostka.grzegorz@gmail.com>
Sun, 27 Oct 2013 23:00:15 +0000 (23:00 +0000)
committergkostka <kostka.grzegorz@gmail.com>
Sun, 27 Oct 2013 23:00:15 +0000 (23:00 +0000)
ext4.h
lwext4/ext4.c
lwext4/ext4_bcache.c
lwext4/ext4_block_group.h
lwext4/ext4_blockdev.c
lwext4/ext4_config.h
lwext4/ext4_dir_idx.c
lwext4/ext4_super.c

diff --git a/ext4.h b/ext4.h
index 053c2572e26c9f26e05234454607c0a8a987e0e5..11d33bd5277ef55d85367687fb7817b1f2084bc7 100644 (file)
--- a/ext4.h
+++ b/ext4.h
@@ -163,7 +163,7 @@ typedef struct  {
  * @param   bd block device cache (0 = automatic cache mode)\r
  * @param   dev_name register name\r
  * @param   standard error code*/\r
-int    ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,\r
+int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,\r
         const char *dev_name);\r
 \r
 /**@brief   Mount a block device with EXT4 partition to the mountpoint.\r
@@ -174,12 +174,12 @@ int       ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
  *          -   /my_second_partition/\r
  *\r
  * @return standard error code */\r
-int    ext4_mount(const char * dev_name,  char *mount_point);\r
+int ext4_mount(const char * dev_name,  char *mount_point);\r
 \r
 /**@brief   Umount operation.\r
  * @param      mount_point mount name\r
  * @return  standard error code */\r
-int    ext4_umount(char *mount_point);\r
+int ext4_umount(char *mount_point);\r
 \r
 \r
 /**@brief   Some of the filesystem stats.*/\r
index f56759763ff196f27a463e4abdd60122a2f3bd28..60f44fa73c1b2c51950100ab312f831dd4aa657e 100644 (file)
 \r
 #include <ext4.h>\r
 \r
-/**@brief      Mount point OS dependent lock*/\r
+/**@brief   Mount point OS dependent lock*/\r
 #define EXT4_MP_LOCK(_m)    \\r
         do { (_m)->os_locks ? (_m)->os_locks->lock() : 0; }while(0)\r
 \r
-/**@brief      Mount point OS dependent unlock*/\r
+/**@brief   Mount point OS dependent unlock*/\r
 #define EXT4_MP_UNLOCK(_m)  \\r
         do { (_m)->os_locks ? (_m)->os_locks->unlock() : 0; }while(0)\r
 \r
-/**@brief      Mount point descrpitor.*/\r
+/**@brief   Mount point descrpitor.*/\r
 struct ext4_mountpoint {\r
 \r
     /**@brief  Mount point name (@ref ext4_mount)*/\r
-    const char                  *name;\r
+    const char *name;\r
 \r
     /**@brief  Os dependent lock/unlock functions.*/\r
     struct ext4_lock *os_locks;\r
 \r
     /**@brief  Ext4 filesystem internals.*/\r
-    struct ext4_fs      fs;\r
+    struct ext4_fs fs;\r
 \r
     /**@brief  Dynamic alocation cache flag.*/\r
-    bool            cache_dynamic;\r
+    bool cache_dynamic;\r
 };\r
 \r
-/**@brief      Block devices descriptor.*/\r
+/**@brief   Block devices descriptor.*/\r
 struct _ext4_devices {\r
 \r
-    /**@brief  Block device name (@ref ext4_device_register)*/\r
-    const char                         *name;\r
+    /**@brief   Block device name (@ref ext4_device_register)*/\r
+    const char *name;\r
 \r
-    /**@brief  Block device handle.*/\r
-    struct ext4_blockdev       *bd;\r
+    /**@brief   Block device handle.*/\r
+    struct ext4_blockdev *bd;\r
 \r
-    /**@brief  Block cache handle.*/\r
-    struct ext4_bcache         *bc;\r
+    /**@brief   Block cache handle.*/\r
+    struct ext4_bcache *bc;\r
 };\r
 \r
 /**@brief      Block devices.*/\r
@@ -92,11 +92,11 @@ struct      _ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];
 \r
 \r
 /**@brief      Mountpoints.*/\r
-struct ext4_mountpoint _mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];\r
+struct ext4_mountpoint _mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];\r
 \r
 \r
 \r
-int    ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,\r
+int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,\r
     const char *dev_name)\r
 {\r
     uint32_t i;\r
@@ -355,7 +355,6 @@ int ext4_mount(const char * dev_name, char *mount_point)
     bsize = ext4_sb_get_block_size(&mp->fs.sb);\r
     ext4_block_set_lb_size(bd, bsize);\r
 \r
-\r
     mp->cache_dynamic = 0;\r
 \r
     if(!bc){\r
@@ -374,7 +373,6 @@ int ext4_mount(const char * dev_name, char *mount_point)
     if(bsize != bc->itemsize)\r
         return ENOTSUP;\r
 \r
-\r
     /*Bind block cache to block device*/\r
     r = ext4_block_bind_bcache(bd, bc);\r
     if(r != EOK){\r
@@ -468,7 +466,6 @@ static struct ext4_mountpoint* ext4_get_mount(const char *path)
     return 0;\r
 }\r
 \r
-\r
 static int ext4_path_check(const char *path, bool* is_goal)\r
 {\r
     int i;\r
@@ -683,7 +680,6 @@ static int ext4_generic_open (ext4_file *f, const char *path,
 \r
         if(f->flags & O_APPEND)\r
             f->fpos = f->fsize;\r
-\r
     }\r
 \r
     r = ext4_fs_put_inode_ref(&ref);\r
@@ -695,11 +691,11 @@ static int ext4_generic_open (ext4_file *f, const char *path,
 int ext4_fremove(const char *path)\r
 {\r
     ext4_file   f;\r
-    uint32_t    parent_inode;\r
-    uint32_t    name_off;\r
-    int     r;\r
-    int     len;\r
-    bool    is_goal;\r
+    uint32_t parent_inode;\r
+    uint32_t name_off;\r
+    int r;\r
+    int len;\r
+    bool is_goal;\r
     struct ext4_mountpoint *mp = ext4_get_mount(path);\r
 \r
     struct ext4_inode_ref child;\r
@@ -788,7 +784,7 @@ int ext4_fclose(ext4_file *f)
 }\r
 int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)\r
 {\r
-    int                 r = EOK;\r
+    int r = EOK;\r
     uint32_t u;\r
     uint32_t fblock;\r
     uint32_t fblock_start;\r
@@ -922,7 +918,7 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
 \r
 int    ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)\r
 {\r
-    int                 r = EOK;\r
+    int r = EOK;\r
     uint32_t u;\r
     uint32_t fblock;\r
     struct ext4_block b;\r
@@ -1096,13 +1092,10 @@ int     ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
 \r
 }\r
 \r
-\r
-\r
 int ext4_fseek(ext4_file *f, uint64_t offset, uint32_t origin)\r
 {\r
     switch(origin){\r
     case SEEK_SET:\r
-\r
         if(offset > f->fsize)\r
             return EINVAL;\r
 \r
@@ -1117,43 +1110,45 @@ int ext4_fseek(ext4_file *f, uint64_t offset, uint32_t origin)
     case SEEK_END:\r
         if(offset > f->fsize)\r
             return EINVAL;\r
+\r
         f->fpos = f->fsize - offset;\r
         return EOK;\r
 \r
     }\r
-\r
     return EINVAL;\r
 }\r
 \r
 uint64_t ext4_ftell (ext4_file *f)\r
 {\r
-    return  f->fpos;\r
+    return f->fpos;\r
 }\r
 \r
 uint64_t ext4_fsize (ext4_file *f)\r
 {\r
-    return  f->fsize;\r
+    return f->fsize;\r
 }\r
 \r
 /*********************************DIRECTORY OPERATION************************/\r
 \r
 int ext4_dir_rm(const char *path)\r
 {\r
-    int         r;\r
-    int         len;\r
-    ext4_file   f;\r
-    struct ext4_mountpoint *mp = ext4_get_mount(path);\r
-    struct ext4_inode_ref   current;\r
-    struct ext4_inode_ref   child;\r
+    int r;\r
+    int len;\r
+    ext4_file f;\r
 \r
+    struct ext4_mountpoint *mp = ext4_get_mount(path);\r
+    struct ext4_inode_ref current;\r
+    struct ext4_inode_ref child;\r
     struct ext4_directory_iterator it;\r
+\r
     uint32_t name_off;\r
     uint32_t inode_up;\r
     uint32_t inode_current;\r
     uint32_t depth = 1;\r
-    bool     has_children;\r
-    bool     is_goal;\r
-    bool     dir_end;\r
+\r
+    bool has_children;\r
+    bool is_goal;\r
+    bool dir_end;\r
 \r
     if(!mp)\r
         return ENOENT;\r
@@ -1313,7 +1308,7 @@ int ext4_dir_rm(const char *path)
 int ext4_dir_mk(const char *path)\r
 {\r
     int r;\r
-    ext4_file   f;\r
+    ext4_file f;\r
 \r
     struct ext4_mountpoint *mp = ext4_get_mount(path);\r
 \r
@@ -1362,7 +1357,7 @@ int ext4_dir_close(ext4_dir *d)
 \r
 ext4_direntry* ext4_dir_entry_get(ext4_dir *d, uint32_t id)\r
 {\r
-    int         r;\r
+    int r;\r
     uint32_t i;\r
     ext4_direntry *de = 0;\r
     struct ext4_inode_ref dir;\r
index bab156bf23fc333e8012b176c071ca880badf813..1ceaacb12536ccd735dfa393af5488a8968ea39a 100644 (file)
@@ -43,7 +43,7 @@
 #include <stdlib.h>\r
 \r
 \r
-int    ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,\r
+int ext4_bcache_init_dynamic(struct    ext4_bcache *bc, uint32_t cnt,\r
     uint32_t itemsize)\r
 {\r
     ext4_assert(bc && cnt && itemsize);\r
index b7a4625a906d567a24d46b94772c83e551977a4b..29c1ac7a292410fd802f0cfff01c5c3235e327b2 100644 (file)
@@ -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 @@ static inline uint64_t ext4_bg_get_block_bitmap(struct ext4_bgroup *bg,
     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 @@ static inline uint64_t ext4_bg_get_inode_bitmap(struct ext4_bgroup *bg,
     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 @@ static inline uint64_t ext4_bg_get_inode_table_first_block(
     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 @@ static inline uint32_t ext4_bg_get_free_blocks_count(struct ext4_bgroup *bg,
     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 @@ static inline void ext4_bg_set_free_blocks_count(struct ext4_bgroup *bg,
         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 @@ static inline uint32_t ext4_bg_get_free_inodes_count(struct ext4_bgroup *bg,
     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 @@ static inline void ext4_bg_set_free_inodes_count(struct ext4_bgroup *bg,
         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 @@ static inline uint32_t ext4_bg_get_used_dirs_count(struct ext4_bgroup *bg,
     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 @@ static inline void ext4_bg_set_used_dirs_count(struct ext4_bgroup *bg,
         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 @@ static inline uint32_t ext4_bg_get_itable_unused(struct ext4_bgroup *bg,
     return v;
 }
 
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_itable_unused(struct ext4_bgroup *bg,
     struct ext4_sblock *s, uint32_t cnt)
 {
@@ -163,18 +172,20 @@ static inline void ext4_bg_set_itable_unused(struct ext4_bgroup *bg,
         bg->itable_unused_hi = to_le16(cnt >> 16);
 }
 
-
+/**@brief   TODO: ...*/
 static inline void ext4_bg_set_checksum(struct ext4_bgroup *bg,
     uint16_t crc)
 {
     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 @@ static inline void ext4_bg_set_flag(struct ext4_bgroup *bg, uint32_t f)
     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 @@ static inline void ext4_bg_clear_flag(struct ext4_bgroup *bg, uint32_t f)
     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_ */
index a6c7323fbc88cc8fb77d46d0606f695e2887f502..eaf7e6868b62403630edcbe220a5ebb4af1d259b 100644 (file)
@@ -94,9 +94,10 @@ int ext4_block_get(struct    ext4_blockdev *bdev, struct     ext4_block *b,
 {
     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,9 +149,8 @@ int ext4_block_get(struct   ext4_blockdev *bdev, struct     ext4_block *b,
     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);
 
@@ -161,7 +161,6 @@ int ext4_block_get(struct   ext4_blockdev *bdev, struct     ext4_block *b,
     }
 
     bdev->bread_ctr++;
-
     return EOK;
 }
 
@@ -189,8 +188,8 @@ int ext4_block_set(struct   ext4_blockdev *bdev, struct     ext4_block *b)
         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 @@ int ext4_blocks_get_direct(struct ext4_blockdev *bdev, void *buf,
 
     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 @@ int ext4_blocks_set_direct(struct   ext4_blockdev *bdev, const void *buf,
 
     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 @@ int        ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
 {
     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,14 +254,12 @@ int       ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
     if(!(bdev->flags & EXT4_BDEV_INITIALIZED))
         return EIO;
 
-
     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){
@@ -283,7 +275,6 @@ int ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
         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 @@ int       ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
 
     /*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 @@ int ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
 
     /*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_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
 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 @@ int ext4_block_readbytes(struct   ext4_blockdev *bdev, uint64_t off, void *buf,
     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 @@ int ext4_block_readbytes(struct     ext4_blockdev *bdev, uint64_t off, void *buf,
                 len : (bdev->ph_bsize - unalg);
 
         r = bdev->bread(bdev, bdev->ph_bbuf, block_idx, 1);
-
         if(r != EOK)
             return r;
 
@@ -374,7 +357,6 @@ int ext4_block_readbytes(struct     ext4_blockdev *bdev, uint64_t off, void *buf,
         block_idx++;
     }
 
-
     /*Aligned data*/
     blen = len / bdev->ph_bsize;
 
@@ -391,14 +373,11 @@ int ext4_block_readbytes(struct   ext4_blockdev *bdev, uint64_t off, void *buf,
 
     /*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 @@ int         ext4_block_delay_cache_flush(struct     ext4_blockdev *bdev,
             bdev->bc->ref_blocks--;
         }
     }
-
     return EOK;
 }
 
index 5080256c54514a59ac29362abaac080212b38c34..2f103c0af8d696cd37029f605c1635560da8e256 100644 (file)
 
 /**@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
 
 
 
 /**@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_ */
 
 /**
index 4a75a353e55146f70ff675dbfae18a5831b69a2d..6f5246296a23857d9d51fcedd169bf3569b64768 100644 (file)
@@ -48,7 +48,7 @@
 struct ext4_dx_sort_entry {\r
     uint32_t hash;\r
     uint32_t rec_len;\r
-    void        *dentry;\r
+    void *dentry;\r
 };\r
 \r
 static int ext4_dir_dx_hash_string(struct ext4_hash_info *hinfo, int len,\r
@@ -60,37 +60,37 @@ static int ext4_dir_dx_hash_string(struct ext4_hash_info *hinfo, int len,
 \r
 \r
 uint8_t ext4_dir_dx_root_info_get_hash_version(\r
-        struct ext4_directory_dx_root_info *root_info)\r
+    struct ext4_directory_dx_root_info *root_info)\r
 {\r
     return root_info->hash_version;\r
 }\r
 \r
 \r
-void   ext4_dir_dx_root_info_set_hash_version(\r
-        struct ext4_directory_dx_root_info  *root_info, uint8_t v)\r
+void ext4_dir_dx_root_info_set_hash_version(\r
+    struct ext4_directory_dx_root_info  *root_info, uint8_t v)\r
 {\r
     root_info->hash_version = v;\r
 }\r
 \r
 uint8_t ext4_dir_dx_root_info_get_info_length(\r
-        struct ext4_directory_dx_root_info *root_info)\r
+    struct ext4_directory_dx_root_info *root_info)\r
 {\r
     return root_info->info_length;\r
 }\r
-void   ext4_dir_dx_root_info_set_info_length(\r
-        struct ext4_directory_dx_root_info  *root_info, uint8_t len)\r
+void ext4_dir_dx_root_info_set_info_length(\r
+    struct ext4_directory_dx_root_info  *root_info, uint8_t len)\r
 {\r
     root_info->info_length = len;\r
 }\r
 \r
 uint8_t ext4_dir_dx_root_info_get_indirect_levels(\r
-        struct ext4_directory_dx_root_info *root_info)\r
+    struct ext4_directory_dx_root_info *root_info)\r
 {\r
     return root_info->indirect_levels;\r
 }\r
 \r
 void   ext4_dir_dx_root_info_set_indirect_levels(\r
-        struct ext4_directory_dx_root_info *root_info, uint8_t lvl)\r
+    struct ext4_directory_dx_root_info *root_info, uint8_t lvl)\r
 {\r
     root_info->indirect_levels = lvl;\r
 }\r
@@ -98,53 +98,53 @@ void        ext4_dir_dx_root_info_set_indirect_levels(
 \r
 \r
 uint16_t ext4_dir_dx_countlimit_get_limit(\r
-        struct ext4_directory_dx_countlimit *climit)\r
+    struct ext4_directory_dx_countlimit *climit)\r
 {\r
     return to_le16(climit->limit);\r
 }\r
-void   ext4_dir_dx_countlimit_set_limit(\r
-        struct ext4_directory_dx_countlimit *climit, uint16_t limit)\r
+void ext4_dir_dx_countlimit_set_limit(\r
+    struct ext4_directory_dx_countlimit *climit, uint16_t limit)\r
 {\r
     climit->limit = to_le16(limit);\r
 }\r
 \r
 uint16_t ext4_dir_dx_countlimit_get_count(\r
-        struct ext4_directory_dx_countlimit *climit)\r
+    struct ext4_directory_dx_countlimit *climit)\r
 {\r
     return to_le16(climit->count);\r
 }\r
 \r
-void   ext4_dir_dx_countlimit_set_count(\r
-        struct ext4_directory_dx_countlimit *climit, uint16_t count)\r
+void ext4_dir_dx_countlimit_set_count(\r
+    struct ext4_directory_dx_countlimit *climit, uint16_t count)\r
 {\r
     climit->count = to_le16(count);\r
 }\r
 \r
 \r
 uint32_t ext4_dir_dx_entry_get_hash(\r
-        struct ext4_directory_dx_entry *entry)\r
+    struct ext4_directory_dx_entry *entry)\r
 {\r
     return to_le32(entry->hash);\r
 }\r
 void ext4_dir_dx_entry_set_hash(\r
-        struct ext4_directory_dx_entry *entry, uint32_t hash)\r
+    struct ext4_directory_dx_entry *entry, uint32_t hash)\r
 {\r
     entry->hash = to_le32(hash);\r
 }\r
 \r
 uint32_t ext4_dir_dx_entry_get_block(\r
-        struct ext4_directory_dx_entry *entry)\r
+    struct ext4_directory_dx_entry *entry)\r
 {\r
     return to_le32(entry->block);\r
 }\r
-void   ext4_dir_dx_entry_set_block(\r
-        struct ext4_directory_dx_entry *entry, uint32_t block)\r
+void ext4_dir_dx_entry_set_block(\r
+    struct ext4_directory_dx_entry *entry, uint32_t block)\r
 {\r
     entry->block = to_le32(block);\r
 }\r
 /****************************************************************************/\r
 \r
-int    ext4_dir_dx_init(struct ext4_inode_ref *dir)\r
+int ext4_dir_dx_init(struct ext4_inode_ref *dir)\r
 {\r
     /* Load block 0, where will be index root located */\r
     uint32_t fblock;\r
@@ -165,7 +165,6 @@ int         ext4_dir_dx_init(struct ext4_inode_ref *dir)
     /* Initialize root info structure */\r
     uint8_t hash_version = ext4_get8(&dir->fs->sb, default_hash_version);\r
 \r
-\r
     ext4_dir_dx_root_info_set_hash_version(info, hash_version);\r
     ext4_dir_dx_root_info_set_indirect_levels(info, 0);\r
     ext4_dir_dx_root_info_set_info_length(info, 8);\r
@@ -223,8 +222,8 @@ int         ext4_dir_dx_init(struct ext4_inode_ref *dir)
 }\r
 \r
 static int ext4_dir_hinfo_init(struct ext4_hash_info *hinfo,\r
-        struct ext4_block *root_block, struct ext4_sblock *sb, size_t name_len,\r
-        const char *name)\r
+    struct ext4_block *root_block, struct ext4_sblock *sb, size_t name_len,\r
+    const char *name)\r
 {\r
     struct ext4_directory_dx_root *root =\r
             (struct ext4_directory_dx_root *) root_block->data;\r
@@ -276,9 +275,9 @@ static int ext4_dir_hinfo_init(struct ext4_hash_info *hinfo,
 \r
 \r
 static int ext4_dir_dx_get_leaf(struct ext4_hash_info *hinfo,\r
-        struct ext4_inode_ref *inode_ref, struct ext4_block *root_block,\r
-        struct ext4_directory_dx_block **dx_block,\r
-        struct ext4_directory_dx_block *dx_blocks)\r
+    struct ext4_inode_ref *inode_ref, struct ext4_block *root_block,\r
+    struct ext4_directory_dx_block **dx_block,\r
+    struct ext4_directory_dx_block *dx_blocks)\r
 {\r
     struct ext4_directory_dx_block *tmp_dx_block = dx_blocks;\r
     struct ext4_directory_dx_root *root =\r
@@ -368,8 +367,8 @@ static int ext4_dir_dx_get_leaf(struct ext4_hash_info *hinfo,
 }\r
 \r
 static int ext4_dir_dx_next_block(struct ext4_inode_ref *inode_ref,\r
-        uint32_t hash, struct ext4_directory_dx_block *dx_block,\r
-        struct ext4_directory_dx_block *dx_blocks)\r
+    uint32_t hash, struct ext4_directory_dx_block *dx_block,\r
+    struct ext4_directory_dx_block *dx_blocks)\r
 {\r
     uint32_t num_handles = 0;\r
     struct ext4_directory_dx_block *p = dx_block;\r
@@ -432,7 +431,7 @@ static int ext4_dir_dx_next_block(struct ext4_inode_ref *inode_ref,
 \r
 \r
 int    ext4_dir_dx_find_entry(struct ext4_directory_search_result * result,\r
-        struct ext4_inode_ref *inode_ref, size_t name_len, const char *name)\r
+    struct ext4_inode_ref *inode_ref, size_t name_len, const char *name)\r
 {\r
     /* Load direct block 0 (index root) */\r
     uint32_t root_block_addr;\r
@@ -543,8 +542,8 @@ static int ext4_dir_dx_entry_comparator(const void *arg1, const void *arg2)
 }\r
 \r
 static void ext4_dir_dx_insert_entry(\r
-        struct ext4_directory_dx_block *index_block, uint32_t hash,\r
-        uint32_t iblock)\r
+    struct ext4_directory_dx_block *index_block, uint32_t hash,\r
+    uint32_t iblock)\r
 {\r
     struct ext4_directory_dx_entry *old_index_entry = index_block->position;\r
     struct ext4_directory_dx_entry *new_index_entry = old_index_entry + 1;\r
@@ -567,9 +566,9 @@ static void ext4_dir_dx_insert_entry(
 }\r
 \r
 static int ext4_dir_dx_split_data(struct ext4_inode_ref *inode_ref,\r
-        struct ext4_hash_info *hinfo, struct ext4_block *old_data_block,\r
-        struct ext4_directory_dx_block *index_block,\r
-        struct ext4_block *new_data_block)\r
+    struct ext4_hash_info *hinfo, struct ext4_block *old_data_block,\r
+    struct ext4_directory_dx_block *index_block,\r
+    struct ext4_block *new_data_block)\r
 {\r
     int rc = EOK;\r
 \r
@@ -639,7 +638,7 @@ static int ext4_dir_dx_split_data(struct ext4_inode_ref *inode_ref,
 \r
     /* Sort all entries */\r
     qsort(sort_array, idx, sizeof(struct ext4_dx_sort_entry),\r
-            ext4_dir_dx_entry_comparator);\r
+        ext4_dir_dx_entry_comparator);\r
 \r
     /* Allocate new block for store the second part of entries */\r
     uint32_t new_fblock;\r
@@ -729,7 +728,7 @@ static int ext4_dir_dx_split_data(struct ext4_inode_ref *inode_ref,
     free(entry_buffer);\r
 \r
     ext4_dir_dx_insert_entry(index_block, new_hash + continued,\r
-            new_iblock);\r
+        new_iblock);\r
 \r
     *new_data_block = new_data_block_tmp;\r
 \r
@@ -746,9 +745,9 @@ static int ext4_dir_dx_split_data(struct ext4_inode_ref *inode_ref,
  *\r
  */\r
 static int ext4_dir_dx_split_index(struct ext4_inode_ref *inode_ref,\r
-        struct  ext4_directory_dx_block *dx_blocks,\r
-        struct ext4_directory_dx_block *dx_block,\r
-        struct ext4_directory_dx_block **new_dx_block)\r
+    struct  ext4_directory_dx_block *dx_blocks,\r
+    struct ext4_directory_dx_block *dx_block,\r
+    struct ext4_directory_dx_block **new_dx_block)\r
 {\r
     struct ext4_directory_dx_entry *entries;\r
 \r
@@ -819,7 +818,7 @@ static int ext4_dir_dx_split_index(struct ext4_inode_ref *inode_ref,
 \r
             /* Copy data to new node */\r
             memcpy((void *) new_entries, (void *) (entries + count_left),\r
-                    count_right * sizeof(struct ext4_directory_dx_entry));\r
+                count_right * sizeof(struct ext4_directory_dx_entry));\r
 \r
             /* Initialize new node */\r
             struct ext4_directory_dx_countlimit *left_countlimit =\r
@@ -902,8 +901,8 @@ static int ext4_dir_dx_split_index(struct ext4_inode_ref *inode_ref,
     return EOK;\r
 }\r
 \r
-int    ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,\r
-        struct ext4_inode_ref *child, const char *name)\r
+int ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,\r
+    struct ext4_inode_ref *child, const char *name)\r
 {\r
     int rc2 = EOK;\r
 \r
index c40a539d7b79939bbb55a08e244d7a72eba7561c..15cfc50269254fb2147dd8f6cc64176bcc53cf55 100644 (file)
@@ -73,7 +73,7 @@ uint32_t ext4_inodes_in_group_cnt(struct ext4_sblock *s, uint32_t bgid)
 {
     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 @@ bool ext4_sb_check(struct ext4_sblock *s)
     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;