Removed nasty tabs.
authorgkostka <kostka.grzegorz@gmail.com>
Sun, 27 Oct 2013 23:50:36 +0000 (23:50 +0000)
committergkostka <kostka.grzegorz@gmail.com>
Sun, 27 Oct 2013 23:50:36 +0000 (23:50 +0000)
28 files changed:
blockdev/filedev/ext4_filedev.c
blockdev/filedev/ext4_filedev.h
demos/generic/main.c
ext4.h
lwext4/ext4.c
lwext4/ext4_balloc.c
lwext4/ext4_balloc.h
lwext4/ext4_bcache.c
lwext4/ext4_bcache.h
lwext4/ext4_bitmap.h
lwext4/ext4_blockdev.c
lwext4/ext4_blockdev.h
lwext4/ext4_config.h
lwext4/ext4_debug.h
lwext4/ext4_dir.c
lwext4/ext4_dir_idx.c
lwext4/ext4_errno.h
lwext4/ext4_fs.c
lwext4/ext4_hash.h
lwext4/ext4_ialloc.c
lwext4/ext4_inode.c
lwext4/ext4_super.c
lwext4/ext4_super.h
lwext4/ext4_types.h
readme.txt
toolchain/bf518.cmake
toolchain/cortex-m3.cmake
toolchain/cortex-m4.cmake

index d0530d86b770fcb973a46dfa4f7f5787124360c1..437e840428fbd8b458d0af17b4d27fabeeec78a6 100644 (file)
 #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 @@ static FILE *dev_file;
 /**********************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 @@ EXT4_BCACHE_STATIC_INSTANCE(__cache, CONFIG_BLOCK_DEV_CACHE_SIZE, 1024);
 /******************************************************************************/
 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_bwrite(struct ext4_blockdev *bdev, const void *buf,
 /******************************************************************************/
 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;
 }
 
 /******************************************************************************/
index 95156d1452c66087395cddef698a8aaf65903700..408ddfe651006ebe068a0ac3bcf01dfd643bd8ff 100644 (file)
 #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_ */
index d61af819a74fd153cf4364918d86c61d86b9eb81..86ed0214735cd2fe9e2c0e72eacfd1452c109a7b 100644 (file)
 /**@brief   Input stream name.*/\r
 char input_name[128] = "ext2";\r
 \r
-/**@brief      Read-write size*/\r
+/**@brief   Read-write size*/\r
 static int rw_szie  = 1024 * 1024;\r
 \r
-/**@brief      Read-write size*/\r
+/**@brief   Read-write size*/\r
 static int rw_count = 10;\r
 \r
 /**@brief   Directory test count*/\r
@@ -70,16 +70,16 @@ static bool sbstat = false;
 /**@brief   Indicates that input is windows partition.*/\r
 static bool winpart = false;\r
 \r
-/**@brief      File write buffer*/\r
-static uint8_t *wr_buff;\r
+/**@brief   File write buffer*/\r
+static uint8_t *wr_buff;\r
 \r
-/**@brief      File read buffer.*/\r
-static uint8_t *rd_buff;\r
+/**@brief   File read buffer.*/\r
+static uint8_t *rd_buff;\r
 \r
-/**@brief      Block device handle.*/\r
+/**@brief   Block device handle.*/\r
 static struct ext4_blockdev *bd;\r
 \r
-/**@brief      Block cache handle.*/\r
+/**@brief   Block cache handle.*/\r
 static struct ext4_bcache   *bc;\r
 \r
 static const char *usage = "                                    \n\\r
@@ -99,52 +99,52 @@ Usage:                                                          \n\
 \r
 static char* entry_to_str(uint8_t type)\r
 {\r
-       switch(type){\r
-       case EXT4_DIRENTRY_UNKNOWN:\r
-               return "[UNK] ";\r
-       case EXT4_DIRENTRY_REG_FILE:\r
-               return "[FIL] ";\r
-       case EXT4_DIRENTRY_DIR:\r
-               return "[DIR] ";\r
-       case EXT4_DIRENTRY_CHRDEV:\r
-               return "[CHA] ";\r
-       case EXT4_DIRENTRY_BLKDEV:\r
-               return "[BLK] ";\r
-       case EXT4_DIRENTRY_FIFO:\r
-               return "[FIF] ";\r
-       case EXT4_DIRENTRY_SOCK:\r
-               return "[SOC] ";\r
-       case EXT4_DIRENTRY_SYMLINK:\r
-               return "[SYM] ";\r
-       default:\r
-               break;\r
-       }\r
-       return "[???]";\r
+    switch(type){\r
+    case EXT4_DIRENTRY_UNKNOWN:\r
+        return "[UNK] ";\r
+    case EXT4_DIRENTRY_REG_FILE:\r
+        return "[FIL] ";\r
+    case EXT4_DIRENTRY_DIR:\r
+        return "[DIR] ";\r
+    case EXT4_DIRENTRY_CHRDEV:\r
+        return "[CHA] ";\r
+    case EXT4_DIRENTRY_BLKDEV:\r
+        return "[BLK] ";\r
+    case EXT4_DIRENTRY_FIFO:\r
+        return "[FIF] ";\r
+    case EXT4_DIRENTRY_SOCK:\r
+        return "[SOC] ";\r
+    case EXT4_DIRENTRY_SYMLINK:\r
+        return "[SYM] ";\r
+    default:\r
+        break;\r
+    }\r
+    return "[???]";\r
 }\r
 \r
 static void dir_ls(const char *path)\r
 {\r
-       int j = 0;\r
-       char sss[255];\r
-       ext4_dir d;\r
-       ext4_direntry *de;\r
-\r
-       printf("**********************************************\n");\r
-\r
-       ext4_dir_open(&d, path);\r
-       de = ext4_dir_entry_get(&d, j++);\r
-       printf("ls %s\n", path);\r
-\r
-       while(de){\r
-               memcpy(sss, de->name, de->name_length);\r
-               sss[de->name_length] = 0;\r
-               printf("%s", entry_to_str(de->inode_type));\r
-               printf("%s", sss);\r
-               printf("\n");\r
-               de = ext4_dir_entry_get(&d, j++);\r
-       }\r
-       printf("**********************************************\n");\r
-       ext4_dir_close(&d);\r
+    int j = 0;\r
+    char sss[255];\r
+    ext4_dir d;\r
+    ext4_direntry *de;\r
+\r
+    printf("**********************************************\n");\r
+\r
+    ext4_dir_open(&d, path);\r
+    de = ext4_dir_entry_get(&d, j++);\r
+    printf("ls %s\n", path);\r
+\r
+    while(de){\r
+        memcpy(sss, de->name, de->name_length);\r
+        sss[de->name_length] = 0;\r
+        printf("%s", entry_to_str(de->inode_type));\r
+        printf("%s", sss);\r
+        printf("\n");\r
+        de = ext4_dir_entry_get(&d, j++);\r
+    }\r
+    printf("**********************************************\n");\r
+    ext4_dir_close(&d);\r
 }\r
 \r
 static void mp_stats(void)\r
@@ -397,8 +397,8 @@ static bool mount(void)
 {\r
     int r;\r
     if(winpart){\r
-         if(!open_winpartition())\r
-             return false;\r
+        if(!open_winpartition())\r
+            return false;\r
     }else{\r
         if(!open_filedev())\r
             return false;\r
@@ -445,52 +445,52 @@ static bool parse_opt(int argc, char **argv)
     int c;\r
 \r
     static struct option long_options[] =\r
-      {\r
-        {"in",      required_argument, 0, 'a'},\r
-        {"rws",     required_argument, 0, 'b'},\r
-        {"rwc",     required_argument, 0, 'c'},\r
-        {"cache",   required_argument, 0, 'd'},\r
-        {"dirs",    required_argument, 0, 'e'},\r
-        {"clean",   no_argument,       0, 'f'},\r
-        {"bstat",   no_argument,       0, 'g'},\r
-        {"sbstat",  no_argument,       0, 'h'},\r
-        {"wpart",   no_argument,       0, 'i'},\r
-        {0, 0, 0, 0}\r
-      };\r
+    {\r
+            {"in",      required_argument, 0, 'a'},\r
+            {"rws",     required_argument, 0, 'b'},\r
+            {"rwc",     required_argument, 0, 'c'},\r
+            {"cache",   required_argument, 0, 'd'},\r
+            {"dirs",    required_argument, 0, 'e'},\r
+            {"clean",   no_argument,       0, 'f'},\r
+            {"bstat",   no_argument,       0, 'g'},\r
+            {"sbstat",  no_argument,       0, 'h'},\r
+            {"wpart",   no_argument,       0, 'i'},\r
+            {0, 0, 0, 0}\r
+    };\r
 \r
     while(-1 != (c = getopt_long (argc, argv, "a:b:c:d:e:fghi", long_options, &option_index))) {\r
 \r
         switch(c){\r
-            case 'a':\r
-                strcpy(input_name, optarg);\r
-                break;\r
-            case 'b':\r
-                rw_szie = atoi(optarg);\r
-                break;\r
-            case 'c':\r
-                rw_count = atoi(optarg);\r
-                break;\r
-            case 'd':\r
-                cache_mode = atoi(optarg);\r
-                break;\r
-            case 'e':\r
-                dir_cnt = atoi(optarg);\r
-                break;\r
-            case 'f':\r
-                cleanup_flag = true;\r
-                break;\r
-            case 'g':\r
-                bstat = true;\r
-                break;\r
-            case 'h':\r
-                sbstat = true;\r
-                break;\r
-            case 'i':\r
-                winpart = true;\r
-                break;\r
-            default:\r
-                printf("%s", usage);\r
-                return false;\r
+        case 'a':\r
+            strcpy(input_name, optarg);\r
+            break;\r
+        case 'b':\r
+            rw_szie = atoi(optarg);\r
+            break;\r
+        case 'c':\r
+            rw_count = atoi(optarg);\r
+            break;\r
+        case 'd':\r
+            cache_mode = atoi(optarg);\r
+            break;\r
+        case 'e':\r
+            dir_cnt = atoi(optarg);\r
+            break;\r
+        case 'f':\r
+            cleanup_flag = true;\r
+            break;\r
+        case 'g':\r
+            bstat = true;\r
+            break;\r
+        case 'h':\r
+            sbstat = true;\r
+            break;\r
+        case 'i':\r
+            winpart = true;\r
+            break;\r
+        default:\r
+            printf("%s", usage);\r
+            return false;\r
 \r
         }\r
     }\r
@@ -520,20 +520,20 @@ int main(int argc, char **argv)
     dir_ls("/mp/");\r
     fflush(stdout);\r
     if(!dir_test(dir_cnt))\r
-           return EXIT_FAILURE;\r
+        return EXIT_FAILURE;\r
 \r
     fflush(stdout);\r
-       if(!file_test())\r
-           return EXIT_FAILURE;\r
+    if(!file_test())\r
+        return EXIT_FAILURE;\r
 \r
-       fflush(stdout);\r
-       dir_ls("/mp/");\r
+    fflush(stdout);\r
+    dir_ls("/mp/");\r
 \r
-       if(sbstat)\r
-           mp_stats();\r
+    if(sbstat)\r
+        mp_stats();\r
 \r
-       if(cleanup_flag)\r
-           cleanup();\r
+    if(cleanup_flag)\r
+        cleanup();\r
 \r
     if(bstat)\r
         block_stats();\r
diff --git a/ext4.h b/ext4.h
index 11d33bd5277ef55d85367687fb7817b1f2084bc7..06b677430d1f04a28edc21291ee0bcf1d456ff67 100644 (file)
--- a/ext4.h
+++ b/ext4.h
@@ -32,7 +32,7 @@
 /**\r
  * @file  ext4.h\r
  * @brief Ext4 high level operations (files, directories, mountpoints...).\r
- *               Client has to include only this file.\r
+ *        Client has to include only this file.\r
  */\r
 \r
 #ifndef EXT4_H_\r
 /********************************FILE SEEK FLAGS*****************************/\r
 \r
 #ifndef SEEK_SET\r
-#define SEEK_SET       0\r
+#define SEEK_SET    0\r
 #endif\r
 \r
 #ifndef SEEK_CUR\r
-#define SEEK_CUR       1\r
+#define SEEK_CUR    1\r
 #endif\r
 \r
 #ifndef SEEK_END\r
-#define SEEK_END       2\r
+#define SEEK_END    2\r
 #endif\r
 \r
 /********************************OS LOCK INFERFACE***************************/\r
 \r
-/**@brief      OS dependent lock interface.*/\r
+/**@brief   OS dependent lock interface.*/\r
 struct ext4_lock {\r
 \r
-    /**@brief  Lock access to mountpoint*/\r
+    /**@brief   Lock access to mountpoint*/\r
     void (*lock)(void);\r
 \r
-    /**@brief  Unlock access to mountpoint*/\r
+    /**@brief   Unlock access to mountpoint*/\r
     void (*unlock)(void);\r
 };\r
 \r
 \r
 /********************************FILE DESCRIPTOR*****************************/\r
 \r
-/**@brief      File descriptor*/\r
+/**@brief   File descriptor*/\r
 typedef struct ext4_file {\r
 \r
-    /**@brief  Pountpoint handle.*/\r
+    /**@brief   Pountpoint handle.*/\r
     struct ext4_mountpoint *mp;\r
 \r
-    /**@brief  File inode id*/\r
+    /**@brief   File inode id*/\r
     uint32_t inode;\r
 \r
-    /**@brief  Open flags.*/\r
+    /**@brief   Open flags.*/\r
     uint32_t flags;\r
 \r
-    /**@brief  File size.*/\r
+    /**@brief   File size.*/\r
     uint64_t fsize;\r
 \r
-    /**@brief  File position*/\r
+    /**@brief   File position*/\r
     uint64_t fpos;\r
 }ext4_file;\r
 \r
 /*****************************DIRECTORY DESCRIPTOR***************************/\r
-/**@brief      Directory entry types. Copy from ext4_types.h*/\r
+/**@brief   Directory entry types. Copy from ext4_types.h*/\r
 enum  {\r
     EXT4_DIRENTRY_UNKNOWN = 0,\r
     EXT4_DIRENTRY_REG_FILE,\r
@@ -146,10 +146,10 @@ typedef struct {
 }ext4_direntry;\r
 \r
 typedef struct  {\r
-    /**@brief  File descriptor*/\r
-    ext4_file          f;\r
-    /**@brief  Current direntry.*/\r
-    ext4_direntry      de;\r
+    /**@brief   File descriptor*/\r
+    ext4_file f;\r
+    /**@brief   Current direntry.*/\r
+    ext4_direntry de;\r
 }ext4_dir;\r
 \r
 /********************************MOUNT OPERATIONS****************************/\r
@@ -167,8 +167,8 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
         const char *dev_name);\r
 \r
 /**@brief   Mount a block device with EXT4 partition to the mountpoint.\r
- * @param      dev_name block device name (@ref ext4_device_register)\r
- * @param      mount_point pount point, for example\r
+ * @param   dev_name block device name (@ref ext4_device_register)\r
+ * @param   mount_point pount point, for example\r
  *          -   /\r
  *          -   /my_partition/\r
  *          -   /my_second_partition/\r
@@ -177,7 +177,7 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
 int ext4_mount(const char * dev_name,  char *mount_point);\r
 \r
 /**@brief   Umount operation.\r
- * @param      mount_point mount name\r
+ * @param   mount_point mount name\r
  * @return  standard error code */\r
 int ext4_umount(char *mount_point);\r
 \r
@@ -212,9 +212,9 @@ int ext4_mount_point_stats(const char *mount_point,
 int ext4_fremove(const char *path);\r
 \r
 /**@brief   File open function.\r
- * @param      filename, (has to start from mountpoint)\r
- *                     /my_partition/my_file\r
- * @param      flags open file flags\r
+ * @param   filename, (has to start from mountpoint)\r
+ *          /my_partition/my_file\r
+ * @param   flags open file flags\r
  *  |---------------------------------------------------------------|\r
  *  |   r or rb                 O_RDONLY                            |\r
  *  |---------------------------------------------------------------|\r
@@ -229,7 +229,7 @@ int ext4_fremove(const char *path);
  *  |   a+ or ab+ or a+b        O_RDWR|O_CREAT|O_APPEND             |\r
  *  |---------------------------------------------------------------|\r
  *\r
- * @return     standard error code*/\r
+ * @return  standard error code*/\r
 int ext4_fopen (ext4_file *f, const char *path, const char *flags);\r
 \r
 /**@brief   File close function.\r
index 60f44fa73c1b2c51950100ab312f831dd4aa657e..c5dd967ba645d1a3fdbe4ce49089ab777e45b973 100644 (file)
 /**@brief   Mount point descrpitor.*/\r
 struct ext4_mountpoint {\r
 \r
-    /**@brief  Mount point name (@ref ext4_mount)*/\r
+    /**@brief   Mount point name (@ref ext4_mount)*/\r
     const char *name;\r
 \r
-    /**@brief  Os dependent lock/unlock functions.*/\r
+    /**@brief   Os dependent lock/unlock functions.*/\r
     struct ext4_lock *os_locks;\r
 \r
-    /**@brief  Ext4 filesystem internals.*/\r
+    /**@brief   Ext4 filesystem internals.*/\r
     struct ext4_fs fs;\r
 \r
-    /**@brief  Dynamic alocation cache flag.*/\r
+    /**@brief   Dynamic alocation cache flag.*/\r
     bool cache_dynamic;\r
 };\r
 \r
 /**@brief   Block devices descriptor.*/\r
-struct _ext4_devices {\r
+struct _ext4_devices {\r
 \r
     /**@brief   Block device name (@ref ext4_device_register)*/\r
     const char *name;\r
@@ -87,11 +87,11 @@ struct      _ext4_devices {
     struct ext4_bcache *bc;\r
 };\r
 \r
-/**@brief      Block devices.*/\r
-struct _ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];\r
+/**@brief   Block devices.*/\r
+struct _ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];\r
 \r
 \r
-/**@brief      Mountpoints.*/\r
+/**@brief   Mountpoints.*/\r
 struct ext4_mountpoint _mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];\r
 \r
 \r
@@ -105,8 +105,8 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc,
     for (i = 0; i < CONFIG_EXT4_BLOCKDEVS_COUNT; ++i) {\r
         if(!_bdevices[i].name){\r
             _bdevices[i].name   = dev_name;\r
-            _bdevices[i].bd    = bd;\r
-            _bdevices[i].bc    = bc;\r
+            _bdevices[i].bd = bd;\r
+            _bdevices[i].bc = bc;\r
             return EOK;\r
         }\r
     }\r
@@ -388,11 +388,11 @@ int ext4_mount(const char * dev_name, char *mount_point)
 }\r
 \r
 \r
-int    ext4_umount(char *mount_point)\r
+int ext4_umount(char *mount_point)\r
 {\r
-    int        i;\r
-    int        r = EOK;\r
-    struct ext4_mountpoint     *mp = 0;\r
+    int i;\r
+    int r = EOK;\r
+    struct ext4_mountpoint *mp = 0;\r
 \r
     for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {\r
         if(_mp[i].name){\r
@@ -502,7 +502,7 @@ static bool ext4_parse_flags(const char *flags, uint32_t *file_flags)
     }\r
 \r
     if(!strcmp(flags, "a") || !strcmp(flags, "ab")){\r
-        *file_flags = O_WRONLY | O_CREAT | O_APPEND    ;\r
+        *file_flags = O_WRONLY | O_CREAT | O_APPEND;\r
         return true;\r
     }\r
 \r
@@ -531,10 +531,10 @@ static int ext4_generic_open (ext4_file *f, const char *path,
 {\r
     struct ext4_mountpoint *mp = ext4_get_mount(path);\r
     struct ext4_directory_search_result result;\r
-    struct ext4_inode_ref      ref;\r
-    bool       is_goal = false;\r
-    uint8_t    inode_type = EXT4_DIRECTORY_FILETYPE_DIR;\r
-    int                r = ENOENT;\r
+    struct ext4_inode_ref ref;\r
+    bool is_goal = false;\r
+    uint8_t inode_type = EXT4_DIRECTORY_FILETYPE_DIR;\r
+    int r = ENOENT;\r
     uint32_t next_inode;\r
 \r
     f->mp = 0;\r
@@ -585,7 +585,7 @@ static int ext4_generic_open (ext4_file *f, const char *path,
                 break;\r
 \r
             /*O_CREAT allows create new entry*/\r
-            struct ext4_inode_ref      child_ref;\r
+            struct ext4_inode_ref child_ref;\r
             r = ext4_fs_alloc_inode(&mp->fs, &child_ref, is_goal ? !file_expect : true);\r
             if(r != EOK)\r
                 break;\r
@@ -790,7 +790,7 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
     uint32_t fblock_start;\r
     uint32_t fblock_cnt;\r
     struct ext4_block b;\r
-    uint8_t    *u8_buf = buf;\r
+    uint8_t *u8_buf = buf;\r
     struct ext4_inode_ref ref;\r
     uint32_t sblock;\r
     uint32_t sblock_end;\r
@@ -821,7 +821,7 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
 \r
     block_size = ext4_sb_get_block_size(&f->mp->fs.sb);\r
     size = size > (f->fsize - f->fpos) ? (f->fsize - f->fpos) : size;\r
-    sblock     = (f->fpos) / block_size;\r
+    sblock = (f->fpos) / block_size;\r
     sblock_end = (f->fpos + size) / block_size;\r
     u = (f->fpos) % block_size;\r
 \r
@@ -916,13 +916,13 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
     return r;\r
 }\r
 \r
-int    ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)\r
+int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)\r
 {\r
     int r = EOK;\r
     uint32_t u;\r
     uint32_t fblock;\r
     struct ext4_block b;\r
-    uint8_t    *u8_buf = buf;\r
+    uint8_t *u8_buf = buf;\r
     struct ext4_inode_ref ref;\r
     uint32_t sblock;\r
     uint32_t sblock_end;\r
@@ -962,7 +962,7 @@ int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
     if(f->fsize % block_size)\r
         file_blocks++;\r
 \r
-    sblock     = (f->fpos) / block_size;\r
+    sblock = (f->fpos) / block_size;\r
 \r
     u = (f->fpos) % block_size;\r
 \r
index 4d420a696db4c69664277e55c68b78cd75118a34..47173d2022e3e2c65efeb9030f1470b6f10dadc0 100644 (file)
@@ -62,12 +62,12 @@ static uint32_t ext4_balloc_get_bgid_of_block(struct ext4_sblock *s,
 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 @@ uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
         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 @@ uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
 
 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 @@ int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref, uint32_t baddr)
     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 @@ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref, uint32_t first,
     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 @@ int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
     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 @@ int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
             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)
index 50df4980d1b23e68ac606cb66928c09170d07634..f3ca6e3abb8a53f5655b743deea43311c305aefe 100644 (file)
 #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);
 
index 1ceaacb12536ccd735dfa393af5488a8968ea39a..b6de610abd8a7c2f542bdaf638aeffbf2f093e8b 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
@@ -104,7 +104,7 @@ int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
     return ENOMEM;\r
 }\r
 \r
-int ext4_bcache_fini_dynamic(struct    ext4_bcache *bc)\r
+int ext4_bcache_fini_dynamic(struct ext4_bcache *bc)\r
 {\r
     if(bc->refctr)\r
         free(bc->refctr);\r
@@ -195,8 +195,8 @@ int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,
 \r
     if(cache_id != bc->cnt){\r
         /*There was unreferenced block*/\r
-        bc->lba[cache_id]         = b->lb_id;\r
-        bc->refctr[cache_id]   = 1;\r
+        bc->lba[cache_id] = b->lb_id;\r
+        bc->refctr[cache_id] = 1;\r
         bc->lru_id[cache_id] = ++bc->lru_ctr;\r
 \r
         /*Set valid cache data and id*/\r
@@ -245,8 +245,8 @@ int ext4_bcache_free (struct ext4_bcache *bc, struct ext4_block *b,
     if(!bc->refctr[b->cache_id] && !bc->free_delay[b->cache_id])\r
         bc->ref_blocks--;\r
 \r
-    b->lb_id    = 0;\r
-    b->data     = 0;\r
+    b->lb_id = 0;\r
+    b->data = 0;\r
     b->cache_id = 0;\r
 \r
     return EOK;\r
index c64841b6cae60711ee5057edf22436f8758c8f29..218af070488b1136d9dc33ef3462558f333aa344 100644 (file)
 #include <stdint.h>\r
 #include <stdbool.h>\r
 \r
-/**@brief      Single block descriptor.*/\r
-struct ext4_block {\r
-    /**@brief  Dirty flag.*/\r
-    bool               dirty;\r
+/**@brief   Single block descriptor.*/\r
+struct ext4_block {\r
+    /**@brief   Dirty flag.*/\r
+    bool dirty;\r
 \r
-    /**@brief  Logical block ID*/\r
-    uint64_t   lb_id;\r
+    /**@brief   Logical block ID*/\r
+    uint64_t lb_id;\r
 \r
     /**@brief   Cache id*/\r
-    uint32_t    cache_id;\r
+    uint32_t cache_id;\r
 \r
-    /**@brief  Data buffer.*/\r
-    uint8_t            *data;\r
+    /**@brief   Data buffer.*/\r
+    uint8_t *data;\r
 };\r
 \r
 \r
-/**@brief      Block cache descriptor.*/\r
-struct ext4_bcache {\r
+/**@brief   Block cache descriptor.*/\r
+struct ext4_bcache {\r
 \r
-    /**@brief  Item count in block cache*/\r
-    uint32_t   cnt;\r
+    /**@brief   Item count in block cache*/\r
+    uint32_t cnt;\r
 \r
-    /**@brief  Item size in block cache*/\r
-    uint32_t   itemsize;\r
+    /**@brief   Item size in block cache*/\r
+    uint32_t itemsize;\r
 \r
-    /**@brief  Last recently used counter.*/\r
-    uint32_t   lru_ctr;\r
+    /**@brief   Last recently used counter.*/\r
+    uint32_t lru_ctr;\r
 \r
-    /**@brief  Reference count table (cnt).*/\r
-    uint32_t   *refctr;\r
+    /**@brief   Reference count table (cnt).*/\r
+    uint32_t *refctr;\r
 \r
-    /**@brief  Last recently used ID table (cnt)*/\r
-    uint32_t   *lru_id;\r
+    /**@brief   Last recently used ID table (cnt)*/\r
+    uint32_t *lru_id;\r
 \r
-    /**@brief  Free delay mode table (cnt)*/\r
-    uint8_t    *free_delay;\r
+    /**@brief   Free delay mode table (cnt)*/\r
+    uint8_t *free_delay;\r
 \r
-    /**@brief  Logical block table (cnt).*/\r
-    uint64_t   *lba;\r
+    /**@brief   Logical block table (cnt).*/\r
+    uint64_t *lba;\r
 \r
-    /**@brief  Cache data buffers (cnt * itemsize)*/\r
-    uint8_t            *data;\r
+    /**@brief   Cache data buffers (cnt * itemsize)*/\r
+    uint8_t *data;\r
 \r
-    /**@brief  Currently referenced datablocks*/\r
-    uint32_t   ref_blocks;\r
+    /**@brief   Currently referenced datablocks*/\r
+    uint32_t ref_blocks;\r
 \r
-    /**@brief  Maximum referenced datablocks*/\r
-    uint32_t   max_ref_blocks;\r
+    /**@brief   Maximum referenced datablocks*/\r
+    uint32_t max_ref_blocks;\r
 \r
 };\r
 \r
-/**@brief      Static initializer of block cache structure.*/\r
+/**@brief   Static initializer of block cache structure.*/\r
 #define EXT4_BCACHE_STATIC_INSTANCE(__name, __cnt, __itemsize)      \\r
-        static uint32_t        __name##_refctr[(__cnt)];                   \\r
-        static uint32_t        __name##_lru_id[(__cnt)];                   \\r
-        static uint8_t         __name##_free_delay[(__cnt)];           \\r
-        static uint64_t        __name##_lba[(__cnt)];                      \\r
-        static uint8_t         __name##_data[(__cnt) * (__itemsize)];      \\r
-        static struct ext4_bcache      __name = {                      \\r
-                .cnt      = __cnt,                                 \\r
+        static uint32_t __name##_refctr[(__cnt)];                   \\r
+        static uint32_t __name##_lru_id[(__cnt)];                   \\r
+        static uint8_t  __name##_free_delay[(__cnt)];               \\r
+        static uint64_t __name##_lba[(__cnt)];                      \\r
+        static uint8_t  __name##_data[(__cnt) * (__itemsize)];      \\r
+        static struct ext4_bcache __name = {                        \\r
+                .cnt     = __cnt,                                   \\r
                 .itemsize  = __itemsize,                            \\r
                 .lru_ctr   = 0,                                     \\r
-                .refctr           = __name##_refctr,                       \\r
+                .refctr    = __name##_refctr,                       \\r
                 .lru_id    = __name##_lru_id,                       \\r
-                .lba      = __name##_lba,                          \\r
+                .lba    = __name##_lba,                             \\r
                 .free_delay= __name##_free_delay,                   \\r
-                .data     = __name##_data,                         \\r
+                .data    = __name##_data,                           \\r
         }\r
 \r
 \r
-/**@brief      Dynamic initialization of block cache.\r
- * @param      bc block cache descriptor\r
- * @param      cnt items count in block cache\r
- * @param      itemsize single item size (in bytes)\r
- * @return     standard error code*/\r
-int    ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,\r
+/**@brief   Dynamic initialization of block cache.\r
+ * @param   bc block cache descriptor\r
+ * @param   cnt items count in block cache\r
+ * @param   itemsize single item size (in bytes)\r
+ * @return  standard error code*/\r
+int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,\r
     uint32_t itemsize);\r
 \r
-/**@brief      Dynamic de-initialization of block cache.\r
- * @param      bc block cache descriptor\r
- * @return     standard error code*/\r
-int ext4_bcache_fini_dynamic(struct    ext4_bcache *bc);\r
+/**@brief   Dynamic de-initialization of block cache.\r
+ * @param   bc block cache descriptor\r
+ * @return  standard error code*/\r
+int ext4_bcache_fini_dynamic(struct ext4_bcache *bc);\r
 \r
-/**@brief      Allocate block from block cache memory.\r
+/**@brief   Allocate block from block cache memory.\r
  *          Unreferenced block allocation is based on LRU\r
  *          (Last Recently Used) algorithm.\r
- * @param      bc      block cache descriptor\r
- * @param      b block to alloc\r
- * @param      is_new block is new (needs to be read)\r
+ * @param   bc block cache descriptor\r
+ * @param   b block to alloc\r
+ * @param   is_new block is new (needs to be read)\r
  * @return  standard error code*/\r
 int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,\r
     bool *is_new);\r
 \r
-/**@brief      Free block from cache memory (decrement reference counter).\r
- * @param      bc      block cache descriptor\r
- * @param      b block to free\r
+/**@brief   Free block from cache memory (decrement reference counter).\r
+ * @param   bc block cache descriptor\r
+ * @param   b block to free\r
  * @return  standard error code*/\r
 int ext4_bcache_free (struct ext4_bcache *bc, struct ext4_block *b,\r
     uint8_t free_delay);\r
 \r
 \r
-/**@brief      Return a full status of block cache.\r
- * @param      bc      block cache descriptor\r
- * @return     full status*/\r
+/**@brief   Return a full status of block cache.\r
+ * @param   bc block cache descriptor\r
+ * @return  full status*/\r
 bool ext4_bcache_is_full(struct ext4_bcache *bc);\r
 \r
 #endif /* EXT4_BCACHE_H_ */\r
index 6b5d73e7c18f9f787a206a44b8f8dea71ff29863..c3a6bd4e4b50f3b92e189e0d03786a28f3517d70 100644 (file)
 #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));
 }
 
 
-/**@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);
 
index eaf7e6868b62403630edcbe220a5ebb4af1d259b..e360a0f77a373863dbcf36fe034972d7c9363fa6 100644 (file)
@@ -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 @@ int   ext4_block_init(struct  ext4_blockdev *bdev)
 
     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 @@ int ext4_block_bind_bcache(struct ext4_blockdev *bdev, struct ext4_bcache *bc)
     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 @@ void ext4_block_set_lb_size(struct    ext4_blockdev *bdev, uint64_t   lb_bsize)
 
 }
 
-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_fini(struct    ext4_blockdev *bdev)
 }
 
 
-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 @@ int ext4_block_get(struct   ext4_blockdev *bdev, struct     ext4_block *b,
     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 @@ int ext4_block_set(struct   ext4_blockdev *bdev, struct     ext4_block *b)
     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 @@ int ext4_blocks_get_direct(struct   ext4_blockdev *bdev, void *buf,
     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_blocks_set_direct(struct   ext4_blockdev *bdev, const void *buf,
 }
 
 
-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 @@ int ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
     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 @@ int ext4_block_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
     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_writebytes(struct    ext4_blockdev *bdev, uint64_t off,
 
 
 
-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 @@ int ext4_block_readbytes(struct     ext4_blockdev *bdev, uint64_t off, void *buf,
     uint32_t unalg;
     int r = EOK;
 
-    uint8_t    *p = (void *)buf;
+    uint8_t *p = (void *)buf;
 
     ext4_assert(bdev && buf);
 
@@ -337,7 +337,7 @@ int ext4_block_readbytes(struct     ext4_blockdev *bdev, uint64_t off, void *buf,
     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 @@ int ext4_block_readbytes(struct     ext4_blockdev *bdev, uint64_t off, void *buf,
     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 @@ int ext4_block_readbytes(struct     ext4_blockdev *bdev, uint64_t off, void *buf,
     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;
index 79cceb183d946d4d7cf4137a908bb3d5508d99ee..5cebd709b896fe8328591d8300a92cafcfa0a9a7 100644 (file)
 #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 @@ struct    ext4_blockdev  {
                 .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_ */
 
index 2f103c0af8d696cd37029f605c1635560da8e256..3a371f6c9dc0106bb8ce3691a047e531e9c9e909 100644 (file)
 #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
 
 
 
-/**@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
index a79cadf83154a0c0af4974642c3476b6d382485e..c82579b7e3715e1a83522297a4b13b5ed4d82511 100644 (file)
 #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)
 
 
 
-/**@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
 
 
 
 #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__);                      \
index eb499bfb2736956eb31a9444cd4cf4198b74f3a7..7936767e7059d5dfb697c0678dd0f0d012a35337 100644 (file)
@@ -439,8 +439,8 @@ int ext4_dir_find_entry(struct ext4_directory_search_result *result,
 \r
     /* Entry was not found */\r
 \r
-    result->block.lb_id =  0;\r
-    result->dentry             =  NULL;\r
+    result->block.lb_id = 0;\r
+    result->dentry = NULL;\r
 \r
     return ENOENT;\r
 }\r
@@ -513,7 +513,7 @@ int ext4_dir_try_insert_entry(struct ext4_sblock *sb,
 \r
     /* Initialize pointers, stop means to upper bound */\r
     struct ext4_directory_entry_ll *dentry  = (void *)target_block->data;\r
-    struct ext4_directory_entry_ll *stop       =\r
+    struct ext4_directory_entry_ll *stop =\r
             (void *)(target_block->data + block_size);\r
 \r
     /*\r
index 6f5246296a23857d9d51fcedd169bf3569b64768..76bcf303c20dbb367770cbc57caad8fd1bd36816 100644 (file)
@@ -89,7 +89,7 @@ uint8_t ext4_dir_dx_root_info_get_indirect_levels(
     return root_info->indirect_levels;\r
 }\r
 \r
-void   ext4_dir_dx_root_info_set_indirect_levels(\r
+void ext4_dir_dx_root_info_set_indirect_levels(\r
     struct ext4_directory_dx_root_info *root_info, uint8_t lvl)\r
 {\r
     root_info->indirect_levels = lvl;\r
@@ -430,7 +430,7 @@ static int ext4_dir_dx_next_block(struct ext4_inode_ref *inode_ref,
 \r
 \r
 \r
-int    ext4_dir_dx_find_entry(struct ext4_directory_search_result * result,\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
 {\r
     /* Load direct block 0 (index root) */\r
@@ -799,7 +799,7 @@ static int ext4_dir_dx_split_index(struct ext4_inode_ref *inode_ref,
         if (rc != EOK)\r
             return rc;\r
 \r
-        struct ext4_directory_dx_node  *new_node       = (void *)new_block.data;\r
+        struct ext4_directory_dx_node  *new_node = (void *)new_block.data;\r
         struct ext4_directory_dx_entry *new_entries = new_node->entries;\r
 \r
         memset(&new_node->fake, 0, sizeof(struct ext4_fake_directory_entry));\r
index 2b7f41f22229a57c8d7f19f4038152238910aed0..c96830ff035178699379d204e5f418e6ef5a9967 100644 (file)
 #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
index 4c12ca5a208a58c3a3b9b5bedc5fc567f5d0910c..19d986de253cc87b569208d6452c1d5e5d6f8fe7 100644 (file)
@@ -384,8 +384,8 @@ static int ext4_fs_init_inode_table(struct ext4_block_group_ref *bg_ref)
 {
     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 @@ int ext4_fs_alloc_inode(struct ext4_fs *fs, struct ext4_inode_ref *inode_ref,
     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 @@ int ext4_fs_free_inode(struct ext4_inode_ref *inode_ref)
     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 @@ int ext4_fs_free_inode(struct ext4_inode_ref *inode_ref)
     }
 
     /* 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 @@ int ext4_fs_get_inode_data_block_index(struct ext4_inode_ref *inode_ref,
         return EOK;
     }
 
-    struct     ext4_block block;
+    struct ext4_block block;
 
     /*
      * Navigate through other levels, until we find the block number
@@ -1065,8 +1065,8 @@ int ext4_fs_set_inode_data_block_index(struct ext4_inode_ref *inode_ref,
 
     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 @@ int ext4_fs_release_inode_block(struct ext4_inode_ref *inode_ref,
      * 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) {
 
index 6464a2c5448a2e5ed21292682ef2f643fdf0bdf3..d6e589216165ad5dbb63131e0dda5ae4f987cdc0 100644 (file)
 \r
 #include <stdint.h>\r
 \r
-/**@brief      Directory entry name hash function.\r
- * @param      name entry name\r
- * @param      len entry name length\r
- * @param      hash_seed (from superblock)\r
- * @param      hash version (from superblock)\r
- * @param      hash_minor output value\r
- * @param      hash_major output value\r
- * @return     standard error code*/\r
+/**@brief   Directory entry name hash function.\r
+ * @param   name entry name\r
+ * @param   len entry name length\r
+ * @param   hash_seed (from superblock)\r
+ * @param   hash version (from superblock)\r
+ * @param   hash_minor output value\r
+ * @param   hash_major output value\r
+ * @return  standard error code*/\r
 int ext2_htree_hash(const char *name, int len,\r
         const uint32_t *hash_seed, int hash_version,\r
         uint32_t *hash_major, uint32_t *hash_minor);\r
index 5d851718fa8d433aebf21f804f7e33228b401403..9562217207e4611ce972d3808e0c12b552803e30 100644 (file)
@@ -86,7 +86,7 @@ int ext4_ialloc_free_inode(struct ext4_fs *fs, uint32_t index, bool is_dir)
     uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(\r
             bg_ref.block_group, sb);\r
 \r
-    struct     ext4_block bitmap_block;\r
+    struct ext4_block bitmap_block;\r
     rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);\r
     if (rc != EOK)\r
         return rc;\r
@@ -173,7 +173,7 @@ int ext4_ialloc_alloc_inode(struct ext4_fs *fs, uint32_t *index, bool is_dir)
             uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(\r
                     bg_ref.block_group, sb);\r
 \r
-            struct     ext4_block bitmap_block;\r
+            struct ext4_block bitmap_block;\r
             rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);\r
             if (rc != EOK)\r
                 return rc;\r
index ec552fcdf5743a34e6a8e3dfd0af7f2569e4a785..e4e887fa6b1e3a4af85c5951cb975c8eb7f5d82f 100644 (file)
@@ -69,7 +69,7 @@ uint32_t ext4_inode_get_mode(struct ext4_sblock *sb, struct ext4_inode *inode)
     return v;\r
 }\r
 \r
-void    ext4_inode_set_mode(struct ext4_sblock *sb, struct ext4_inode *inode,\r
+void ext4_inode_set_mode(struct ext4_sblock *sb, struct ext4_inode *inode,\r
     uint32_t mode)\r
 {\r
     inode->mode = to_le16((mode << 16) >> 16);\r
@@ -83,7 +83,7 @@ uint32_t ext4_inode_get_uid(struct ext4_inode *inode)
     return to_le32(inode->uid);\r
 }\r
 \r
-void    ext4_inode_set_uid(struct ext4_inode *inode, uint32_t uid)\r
+void ext4_inode_set_uid(struct ext4_inode *inode, uint32_t uid)\r
 {\r
     inode->uid = to_le32(uid);\r
 }\r
@@ -154,7 +154,7 @@ uint32_t ext4_inode_get_gid(struct ext4_inode *inode)
 }\r
 void ext4_inode_set_gid(struct ext4_inode *inode, uint32_t gid)\r
 {\r
-    inode->gid = to_le32(gid);\r
+    inode->gid = to_le32(gid);\r
 }\r
 \r
 uint16_t ext4_inode_get_links_count(struct ext4_inode *inode)\r
@@ -234,14 +234,14 @@ uint32_t ext4_inode_get_flags(struct ext4_inode *inode)
 }\r
 void ext4_inode_set_flags(struct ext4_inode *inode, uint32_t flags)\r
 {\r
-    inode->flags =     to_le32(flags);\r
+    inode->flags = to_le32(flags);\r
 }\r
 \r
 uint32_t ext4_inode_get_generation(struct ext4_inode *inode)\r
 {\r
     return to_le32(inode->generation);\r
 }\r
-void    ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen)\r
+void ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen)\r
 {\r
     inode->generation = to_le32(gen);\r
 }\r
index 15cfc50269254fb2147dd8f6cc64176bcc53cf55..f02d014197a648380d06e4c79e990d98c27bd6f2 100644 (file)
@@ -59,8 +59,8 @@ uint32_t ext4_block_group_cnt(struct ext4_sblock *s)
 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 @@ uint32_t ext4_inodes_in_group_cnt(struct ext4_sblock *s, uint32_t bgid)
     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);
index 0035deddfc8e968bf6bf9a117c65ac21e672a590..6c221069e48db8bd154bd9eba672812a4effdef9 100644 (file)
@@ -165,13 +165,13 @@ uint32_t ext4_inodes_in_group_cnt(struct ext4_sblock *s, uint32_t bgid);
  * @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
index 8ce44da2aa806b3b1fdef054ea1c8140647d760e..8d1502476e9f7fde1b5d422a830d16ce09f0f7b1 100644 (file)
@@ -230,8 +230,8 @@ struct ext4_sblock {
                 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_bgroup {
 } ;
 
 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 @@ struct ext4_inode {
 #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 @@ struct ext4_directory_entry_ll {
 } __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_node {
 };
 
 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_header {
 } ;
 
 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 uint64_t to_le64(uint64_t n)
 
 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 uint32_t to_le32(uint32_t n)
 
 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_ */
 
index 1cc5b2d0fc7b41fb4c455f5ffae46272aec2b23f..7bf83d339b5e20d4765f6947047b74a02e090a84 100644 (file)
@@ -53,7 +53,7 @@ FEATURE_INCOMPAT (able to mount with unsupported feature):
  - DIR_PREALLOC:   no\r
  - IMAGIC_INODES:  no\r
  - HAS_JOURNAL:    no\r
- - EXT_ATTR:      no\r
+ - EXT_ATTR:       no\r
  - RESIZE_INODE:   no\r
  - DIR_INDEX:      yes\r
 \r
@@ -67,8 +67,8 @@ FEATURE_RO (able to mount in read only with unsupported feature):
  - EXTRA_ISIZE:   yes\r
 \r
 Supported filetypes:\r
- - FIFO:         no\r
- - CHARDEV:      no\r
+ - FIFO:      no\r
+ - CHARDEV:   no\r
  - DIRECTORY: yes\r
  - BLOCKDEV:  no\r
  - FILE:      yes\r
@@ -94,7 +94,7 @@ lwext4 project tree
 \r
 +toolchain     - specific toolchain cmake files\r
 \r
-+ext4.h               - lwext4 client library header\r
++ext4.h        - lwext4 client library header\r
 CMakeLists.txt - CMake config file\r
 ext_images.7z  - ext2/3/4 100MB images\r
 Makefile       - helper makefile to call cmake\r
index ce6d83266c3d842982d85a76a9396132262973a9..05ec46172f386aac9187cabcfc424fce75bc63e6 100644 (file)
@@ -3,20 +3,15 @@ SET(CMAKE_SYSTEM_NAME Generic)
 set(CMAKE_SYSTEM_PROCESSOR bf518)\r
 \r
 # Toolchain settings\r
-set(CMAKE_C_COMPILER   bfin-elf-gcc)\r
-set(CMAKE_CXX_COMPILER bfin-elf-g++)\r
+set(CMAKE_C_COMPILER    bfin-elf-gcc)\r
+set(CMAKE_CXX_COMPILER  bfin-elf-g++)\r
 set(AS                  bfin-elf--gcc)\r
-set(AR                         bfin-elf-ar)\r
-set(OBJCOPY                bfin-elf-objcopy)\r
-set(OBJDUMP                bfin-elf-objdump)\r
+set(AR                  bfin-elf-ar)\r
+set(OBJCOPY             bfin-elf-objcopy)\r
+set(OBJDUMP             bfin-elf-objdump)\r
 set(SIZE                bfin-elf-size)\r
 \r
-set(CMAKE_C_FLAGS   "-mcpu=bf518 -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")\r
-set(CMAKE_CXX_FLAGS "-mcpu=bf518 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")\r
+set(CMAKE_C_FLAGS   "-mcpu=bf518 -Os -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")\r
+set(CMAKE_CXX_FLAGS "-mcpu=bf518 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")\r
 set(CMAKE_ASM_FLAGS "-mcpu=bf518 -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")\r
 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mcpu=bf592" CACHE INTERNAL "exe link flags")\r
-                                       \r
-                                                       \r
-               \r
-               \r
-               
\ No newline at end of file
index da912b126f41d52d6c8a403af18427bf6189bc17..2894d90161b85563165a7d8676ea4b18803d3f18 100644 (file)
@@ -3,16 +3,16 @@ SET(CMAKE_SYSTEM_NAME Generic)
 set(CMAKE_SYSTEM_PROCESSOR cortex-m3)\r
 \r
 # Toolchain settings\r
-set(CMAKE_C_COMPILER   arm-none-eabi-gcc)\r
-set(CMAKE_CXX_COMPILER         arm-none-eabi-g++)\r
-set(AS                         arm-none-eabi-as)\r
-set(AR                                 arm-none-eabi-ar)\r
-set(OBJCOPY            arm-none-eabi-objcopy)\r
-set(OBJDUMP                    arm-none-eabi-objdump)\r
+set(CMAKE_C_COMPILER    arm-none-eabi-gcc)\r
+set(CMAKE_CXX_COMPILER  arm-none-eabi-g++)\r
+set(AS                  arm-none-eabi-as)\r
+set(AR                  arm-none-eabi-ar)\r
+set(OBJCOPY             arm-none-eabi-objcopy)\r
+set(OBJDUMP             arm-none-eabi-objdump)\r
 set(SIZE                arm-none-eabi-size)\r
 \r
-set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m3 -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")\r
-set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m3 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")\r
+set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m3 -Os -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")\r
+set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m3 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")\r
 set(CMAKE_ASM_FLAGS "-mthumb -mcpu=cortex-m3" CACHE INTERNAL "asm compiler flags")\r
 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mthumb -mcpu=cortex-m3" CACHE INTERNAL "exe link flags")\r
 \r
index 649bff4be03b78d2e80b4f14ce6aeea8cc57c934..617e8842054fbb1b4e3dcd7c8ea4a73b6a108776 100644 (file)
@@ -3,16 +3,16 @@ SET(CMAKE_SYSTEM_NAME Generic)
 set(CMAKE_SYSTEM_PROCESSOR cortex-m4)\r
 \r
 # Toolchain settings\r
-set(CMAKE_C_COMPILER   arm-none-eabi-gcc)\r
-set(CMAKE_CXX_COMPILER         arm-none-eabi-g++)\r
-set(AS                         arm-none-eabi-as)\r
-set(AR                                 arm-none-eabi-ar)\r
-set(OBJCOPY            arm-none-eabi-objcopy)\r
-set(OBJDUMP                    arm-none-eabi-objdump)\r
+set(CMAKE_C_COMPILER    arm-none-eabi-gcc)\r
+set(CMAKE_CXX_COMPILER  arm-none-eabi-g++)\r
+set(AS                  arm-none-eabi-as)\r
+set(AR                  arm-none-eabi-ar)\r
+set(OBJCOPY             arm-none-eabi-objcopy)\r
+set(OBJDUMP             arm-none-eabi-objdump)\r
 set(SIZE                arm-none-eabi-size)\r
 \r
-set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m4 -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")\r
-set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m4 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")\r
+set(CMAKE_C_FLAGS   "-mthumb -mcpu=cortex-m4 -Os -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")\r
+set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m4 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")\r
 set(CMAKE_ASM_FLAGS "-mthumb -mcpu=cortex-m4" CACHE INTERNAL "asm compiler flags")\r
 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mthumb -mcpu=cortex-m4" CACHE INTERNAL "exe link flags")\r
 \r