History

Removed nasty tabs.

gkostka committed 13 years ago

Commit ead60f11 parent 14dd31728 files · +600 −605Browse files

Unified · Split

28 files
  1. blockdev/filedev/ext4_filedev.c +36 −36
  2. blockdev/filedev/ext4_filedev.h +5 −5
  3. demos/generic/main.c +103 −103
  4. ext4.h +25 −25
  5. lwext4/ext4.c +25 −25
  6. lwext4/ext4_balloc.c +11 −11
  7. lwext4/ext4_balloc.h +21 −21
  8. lwext4/ext4_bcache.c +6 −6
  9. lwext4/ext4_bcache.h +62 −62
  10. lwext4/ext4_bitmap.h +21 −21
  11. lwext4/ext4_blockdev.c +16 −16
  12. lwext4/ext4_blockdev.h +102 −102
  13. lwext4/ext4_config.h +9 −9
  14. lwext4/ext4_debug.h +20 −20
  15. lwext4/ext4_dir.c +3 −3
  16. lwext4/ext4_dir_idx.c +3 −3
  17. lwext4/ext4_errno.h +35 −35
  18. lwext4/ext4_fs.c +10 −10
  19. lwext4/ext4_hash.h +8 −8
  20. lwext4/ext4_ialloc.c +2 −2
  21. lwext4/ext4_inode.c +5 −5
  22. lwext4/ext4_super.c +4 −4
  23. lwext4/ext4_super.h +2 −2
  24. lwext4/ext4_types.h +39 −39
  25. readme.txt +4 −4
  26. toolchain/bf518.cmake +7 −12
  27. toolchain/cortex-m3.cmake +8 −8
  28. toolchain/cortex-m4.cmake +8 −8
blockdev/filedev/ext4_filedev.c+36−36
@@ -33,14 +33,14 @@ · 32 unmodified lines
3333 #include <string.h>
3434 #include <fcntl.h>
3535
36−/**@brief Default filename.*/
36+/**@brief Default filename.*/
3737 static const char *fname = "ext2";
3838
39−/**@brief Image block size.*/
40−#define EXT4_FILEDEV_BSIZE 512
39+/**@brief Image block size.*/
40+#define EXT4_FILEDEV_BSIZE 512
4141
42−/**@brief Image file descriptor.*/
43−static FILE *dev_file;
42+/**@brief Image file descriptor.*/
43+static FILE *dev_file;
4444
4545 #define DROP_LINUXCACHE_BUFFERS 1
4646
@@ -48,21 +48,21 @@ static FILE *dev_file; · 1 unmodified line
4848 /**********************BLOCKDEV INTERFACE**************************************/
4949 static int filedev_open(struct ext4_blockdev *bdev);
5050 static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
51− uint32_t blk_cnt);
51+ uint32_t blk_cnt);
5252 static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf,
53− uint64_t blk_id, uint32_t blk_cnt);
53+ uint64_t blk_id, uint32_t blk_cnt);
5454 static int filedev_close(struct ext4_blockdev *bdev);
5555
5656
5757 /******************************************************************************/
5858 EXT4_BLOCKDEV_STATIC_INSTANCE(
59− _filedev,
60− EXT4_FILEDEV_BSIZE,
61− 0,
62− filedev_open,
63− filedev_bread,
64− filedev_bwrite,
65− filedev_close
59+ _filedev,
60+ EXT4_FILEDEV_BSIZE,
61+ 0,
62+ filedev_open,
63+ filedev_bread,
64+ filedev_bwrite,
65+ filedev_close
6666 );
6767
6868 /******************************************************************************/
@@ -71,34 +71,34 @@ EXT4_BCACHE_STATIC_INSTANCE(__cache, CONFIG_BLOCK_DEV_CACHE_SIZE, 1024); · 2 unmodified lines
7171 /******************************************************************************/
7272 static int filedev_open(struct ext4_blockdev *bdev)
7373 {
74− dev_file = fopen(fname, "r+b");
74+ dev_file = fopen(fname, "r+b");
7575
76− if(!dev_file)
77− return EIO;
76+ if(!dev_file)
77+ return EIO;
7878
79− /*No buffering at file.*/
80− setbuf(dev_file, 0);
79+ /*No buffering at file.*/
80+ setbuf(dev_file, 0);
8181
82− if(fseek(dev_file, 0, SEEK_END))
83− return EFAULT;
82+ if(fseek(dev_file, 0, SEEK_END))
83+ return EFAULT;
8484
85− _filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
85+ _filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
8686
87− return EOK;
87+ return EOK;
8888 }
8989
9090 /******************************************************************************/
9191
9292 static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
93− uint32_t blk_cnt)
93+ uint32_t blk_cnt)
9494 {
95− if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
96− return EIO;
95+ if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
96+ return EIO;
9797
98− if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
99− return EIO;
98+ if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
99+ return EIO;
100100
101− return EOK;
101+ return EOK;
102102 }
103103
104104 static void drop_cache(void)
@@ -130,26 +130,26 @@ static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf, · 25 unmodified lines
130130 /******************************************************************************/
131131 static int filedev_close(struct ext4_blockdev *bdev)
132132 {
133− fclose(dev_file);
134− return EOK;
133+ fclose(dev_file);
134+ return EOK;
135135 }
136136
137137
138138 /******************************************************************************/
139139
140−struct ext4_bcache* ext4_filecache_get(void)
140+struct ext4_bcache* ext4_filecache_get(void)
141141 {
142− return &__cache;
142+ return &__cache;
143143 }
144144 /******************************************************************************/
145−struct ext4_blockdev* ext4_filedev_get(void)
145+struct ext4_blockdev* ext4_filedev_get(void)
146146 {
147− return &_filedev;
147+ return &_filedev;
148148 }
149149 /******************************************************************************/
150150 void ext4_filedev_filename(const char *n)
151151 {
152− fname = n;
152+ fname = n;
153153 }
154154
155155 /******************************************************************************/
blockdev/filedev/ext4_filedev.h+5−5
@@ -34,12 +34,12 @@ · 33 unmodified lines
3434 #include <stdint.h>
3535 #include <stdbool.h>
3636
37−/**@brief Filecache get.*/
38−struct ext4_bcache* ext4_filecache_get(void);
37+/**@brief Filecache get.*/
38+struct ext4_bcache* ext4_filecache_get(void);
3939
40−/**@brief File blockdev get.*/
41−struct ext4_blockdev* ext4_filedev_get(void);
40+/**@brief File blockdev get.*/
41+struct ext4_blockdev* ext4_filedev_get(void);
4242
43−void ext4_filedev_filename(const char *n);
43+void ext4_filedev_filename(const char *n);
4444
4545 #endif /* EXT4_FILEDEV_H_ */
demos/generic/main.c+103−103
@@ -46,10 +46,10 @@ · 45 unmodified lines
4646 /**@brief Input stream name.*/
4747 char input_name[128] = "ext2";
4848
49−/**@brief Read-write size*/
49+/**@brief Read-write size*/
5050 static int rw_szie = 1024 * 1024;
5151
52−/**@brief Read-write size*/
52+/**@brief Read-write size*/
5353 static int rw_count = 10;
5454
5555 /**@brief Directory test count*/
@@ -70,16 +70,16 @@ static bool sbstat = false; · 14 unmodified lines
7070 /**@brief Indicates that input is windows partition.*/
7171 static bool winpart = false;
7272
73−/**@brief File write buffer*/
74−static uint8_t *wr_buff;
73+/**@brief File write buffer*/
74+static uint8_t *wr_buff;
7575
76−/**@brief File read buffer.*/
77−static uint8_t *rd_buff;
76+/**@brief File read buffer.*/
77+static uint8_t *rd_buff;
7878
79−/**@brief Block device handle.*/
79+/**@brief Block device handle.*/
8080 static struct ext4_blockdev *bd;
8181
82−/**@brief Block cache handle.*/
82+/**@brief Block cache handle.*/
8383 static struct ext4_bcache *bc;
8484
8585 static const char *usage = " \n\
@@ -99,52 +99,52 @@ Usage: \n\ · 13 unmodified lines
9999
100100 static char* entry_to_str(uint8_t type)
101101 {
102− switch(type){
103− case EXT4_DIRENTRY_UNKNOWN:
104− return "[UNK] ";
105− case EXT4_DIRENTRY_REG_FILE:
106− return "[FIL] ";
107− case EXT4_DIRENTRY_DIR:
108− return "[DIR] ";
109− case EXT4_DIRENTRY_CHRDEV:
110− return "[CHA] ";
111− case EXT4_DIRENTRY_BLKDEV:
112− return "[BLK] ";
113− case EXT4_DIRENTRY_FIFO:
114− return "[FIF] ";
115− case EXT4_DIRENTRY_SOCK:
116− return "[SOC] ";
117− case EXT4_DIRENTRY_SYMLINK:
118− return "[SYM] ";
119− default:
120− break;
121− }
122− return "[???]";
102+ switch(type){
103+ case EXT4_DIRENTRY_UNKNOWN:
104+ return "[UNK] ";
105+ case EXT4_DIRENTRY_REG_FILE:
106+ return "[FIL] ";
107+ case EXT4_DIRENTRY_DIR:
108+ return "[DIR] ";
109+ case EXT4_DIRENTRY_CHRDEV:
110+ return "[CHA] ";
111+ case EXT4_DIRENTRY_BLKDEV:
112+ return "[BLK] ";
113+ case EXT4_DIRENTRY_FIFO:
114+ return "[FIF] ";
115+ case EXT4_DIRENTRY_SOCK:
116+ return "[SOC] ";
117+ case EXT4_DIRENTRY_SYMLINK:
118+ return "[SYM] ";
119+ default:
120+ break;
121+ }
122+ return "[???]";
123123 }
124124
125125 static void dir_ls(const char *path)
126126 {
127− int j = 0;
128− char sss[255];
129− ext4_dir d;
130− ext4_direntry *de;
131−
132− printf("**********************************************\n");
133−
134− ext4_dir_open(&d, path);
135− de = ext4_dir_entry_get(&d, j++);
136− printf("ls %s\n", path);
137−
138− while(de){
139− memcpy(sss, de->name, de->name_length);
140− sss[de->name_length] = 0;
141− printf("%s", entry_to_str(de->inode_type));
142− printf("%s", sss);
143− printf("\n");
144− de = ext4_dir_entry_get(&d, j++);
145− }
146− printf("**********************************************\n");
147− ext4_dir_close(&d);
127+ int j = 0;
128+ char sss[255];
129+ ext4_dir d;
130+ ext4_direntry *de;
131+
132+ printf("**********************************************\n");
133+
134+ ext4_dir_open(&d, path);
135+ de = ext4_dir_entry_get(&d, j++);
136+ printf("ls %s\n", path);
137+
138+ while(de){
139+ memcpy(sss, de->name, de->name_length);
140+ sss[de->name_length] = 0;
141+ printf("%s", entry_to_str(de->inode_type));
142+ printf("%s", sss);
143+ printf("\n");
144+ de = ext4_dir_entry_get(&d, j++);
145+ }
146+ printf("**********************************************\n");
147+ ext4_dir_close(&d);
148148 }
149149
150150 static void mp_stats(void)
@@ -397,8 +397,8 @@ static bool mount(void) · 246 unmodified lines
397397 {
398398 int r;
399399 if(winpart){
400− if(!open_winpartition())
401− return false;
400+ if(!open_winpartition())
401+ return false;
402402 }else{
403403 if(!open_filedev())
404404 return false;
@@ -445,52 +445,52 @@ static bool parse_opt(int argc, char **argv) · 40 unmodified lines
445445 int c;
446446
447447 static struct option long_options[] =
448− {
449− {"in", required_argument, 0, 'a'},
450− {"rws", required_argument, 0, 'b'},
451− {"rwc", required_argument, 0, 'c'},
452− {"cache", required_argument, 0, 'd'},
453− {"dirs", required_argument, 0, 'e'},
454− {"clean", no_argument, 0, 'f'},
455− {"bstat", no_argument, 0, 'g'},
456− {"sbstat", no_argument, 0, 'h'},
457− {"wpart", no_argument, 0, 'i'},
458− {0, 0, 0, 0}
459− };
448+ {
449+ {"in", required_argument, 0, 'a'},
450+ {"rws", required_argument, 0, 'b'},
451+ {"rwc", required_argument, 0, 'c'},
452+ {"cache", required_argument, 0, 'd'},
453+ {"dirs", required_argument, 0, 'e'},
454+ {"clean", no_argument, 0, 'f'},
455+ {"bstat", no_argument, 0, 'g'},
456+ {"sbstat", no_argument, 0, 'h'},
457+ {"wpart", no_argument, 0, 'i'},
458+ {0, 0, 0, 0}
459+ };
460460
461461 while(-1 != (c = getopt_long (argc, argv, "a:b:c:d:e:fghi", long_options, &option_index))) {
462462
463463 switch(c){
464− case 'a':
465− strcpy(input_name, optarg);
466− break;
467− case 'b':
468− rw_szie = atoi(optarg);
469− break;
470− case 'c':
471− rw_count = atoi(optarg);
472− break;
473− case 'd':
474− cache_mode = atoi(optarg);
475− break;
476− case 'e':
477− dir_cnt = atoi(optarg);
478− break;
479− case 'f':
480− cleanup_flag = true;
481− break;
482− case 'g':
483− bstat = true;
484− break;
485− case 'h':
486− sbstat = true;
487− break;
488− case 'i':
489− winpart = true;
490− break;
491− default:
492− printf("%s", usage);
493− return false;
464+ case 'a':
465+ strcpy(input_name, optarg);
466+ break;
467+ case 'b':
468+ rw_szie = atoi(optarg);
469+ break;
470+ case 'c':
471+ rw_count = atoi(optarg);
472+ break;
473+ case 'd':
474+ cache_mode = atoi(optarg);
475+ break;
476+ case 'e':
477+ dir_cnt = atoi(optarg);
478+ break;
479+ case 'f':
480+ cleanup_flag = true;
481+ break;
482+ case 'g':
483+ bstat = true;
484+ break;
485+ case 'h':
486+ sbstat = true;
487+ break;
488+ case 'i':
489+ winpart = true;
490+ break;
491+ default:
492+ printf("%s", usage);
493+ return false;
494494
495495 }
496496 }
@@ -520,20 +520,20 @@ int main(int argc, char **argv) · 23 unmodified lines
520520 dir_ls("/mp/");
521521 fflush(stdout);
522522 if(!dir_test(dir_cnt))
523− return EXIT_FAILURE;
523+ return EXIT_FAILURE;
524524
525525 fflush(stdout);
526− if(!file_test())
527− return EXIT_FAILURE;
526+ if(!file_test())
527+ return EXIT_FAILURE;
528528
529− fflush(stdout);
530− dir_ls("/mp/");
529+ fflush(stdout);
530+ dir_ls("/mp/");
531531
532− if(sbstat)
533− mp_stats();
532+ if(sbstat)
533+ mp_stats();
534534
535− if(cleanup_flag)
536− cleanup();
535+ if(cleanup_flag)
536+ cleanup();
537537
538538 if(bstat)
539539 block_stats();
ext4.h+25−25
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 /**
3333 * @file ext4.h
3434 * @brief Ext4 high level operations (files, directories, mountpoints...).
35− * Client has to include only this file.
35+ * Client has to include only this file.
3636 */
3737
3838 #ifndef EXT4_H_
@@ -75,53 +75,53 @@ · 36 unmodified lines
7575 /********************************FILE SEEK FLAGS*****************************/
7676
7777 #ifndef SEEK_SET
78−#define SEEK_SET 0
78+#define SEEK_SET 0
7979 #endif
8080
8181 #ifndef SEEK_CUR
82−#define SEEK_CUR 1
82+#define SEEK_CUR 1
8383 #endif
8484
8585 #ifndef SEEK_END
86−#define SEEK_END 2
86+#define SEEK_END 2
8787 #endif
8888
8989 /********************************OS LOCK INFERFACE***************************/
9090
91−/**@brief OS dependent lock interface.*/
91+/**@brief OS dependent lock interface.*/
9292 struct ext4_lock {
9393
94− /**@brief Lock access to mountpoint*/
94+ /**@brief Lock access to mountpoint*/
9595 void (*lock)(void);
9696
97− /**@brief Unlock access to mountpoint*/
97+ /**@brief Unlock access to mountpoint*/
9898 void (*unlock)(void);
9999 };
100100
101101
102102 /********************************FILE DESCRIPTOR*****************************/
103103
104−/**@brief File descriptor*/
104+/**@brief File descriptor*/
105105 typedef struct ext4_file {
106106
107− /**@brief Pountpoint handle.*/
107+ /**@brief Pountpoint handle.*/
108108 struct ext4_mountpoint *mp;
109109
110− /**@brief File inode id*/
110+ /**@brief File inode id*/
111111 uint32_t inode;
112112
113− /**@brief Open flags.*/
113+ /**@brief Open flags.*/
114114 uint32_t flags;
115115
116− /**@brief File size.*/
116+ /**@brief File size.*/
117117 uint64_t fsize;
118118
119− /**@brief File position*/
119+ /**@brief File position*/
120120 uint64_t fpos;
121121 }ext4_file;
122122
123123 /*****************************DIRECTORY DESCRIPTOR***************************/
124−/**@brief Directory entry types. Copy from ext4_types.h*/
124+/**@brief Directory entry types. Copy from ext4_types.h*/
125125 enum {
126126 EXT4_DIRENTRY_UNKNOWN = 0,
127127 EXT4_DIRENTRY_REG_FILE,
@@ -146,10 +146,10 @@ typedef struct { · 18 unmodified lines
146146 }ext4_direntry;
147147
148148 typedef struct {
149− /**@brief File descriptor*/
150− ext4_file f;
151− /**@brief Current direntry.*/
152− ext4_direntry de;
149+ /**@brief File descriptor*/
150+ ext4_file f;
151+ /**@brief Current direntry.*/
152+ ext4_direntry de;
153153 }ext4_dir;
154154
155155 /********************************MOUNT OPERATIONS****************************/
@@ -167,8 +167,8 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc, · 11 unmodified lines
167167 const char *dev_name);
168168
169169 /**@brief Mount a block device with EXT4 partition to the mountpoint.
170− * @param dev_name block device name (@ref ext4_device_register)
171− * @param mount_point pount point, for example
170+ * @param dev_name block device name (@ref ext4_device_register)
171+ * @param mount_point pount point, for example
172172 * - /
173173 * - /my_partition/
174174 * - /my_second_partition/
@@ -177,7 +177,7 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc, · 2 unmodified lines
177177 int ext4_mount(const char * dev_name, char *mount_point);
178178
179179 /**@brief Umount operation.
180− * @param mount_point mount name
180+ * @param mount_point mount name
181181 * @return standard error code */
182182 int ext4_umount(char *mount_point);
183183
@@ -212,9 +212,9 @@ int ext4_mount_point_stats(const char *mount_point, · 28 unmodified lines
212212 int ext4_fremove(const char *path);
213213
214214 /**@brief File open function.
215− * @param filename, (has to start from mountpoint)
216− * /my_partition/my_file
217− * @param flags open file flags
215+ * @param filename, (has to start from mountpoint)
216+ * /my_partition/my_file
217+ * @param flags open file flags
218218 * |---------------------------------------------------------------|
219219 * | r or rb O_RDONLY |
220220 * |---------------------------------------------------------------|
@@ -229,7 +229,7 @@ int ext4_fremove(const char *path); · 8 unmodified lines
229229 * | a+ or ab+ or a+b O_RDWR|O_CREAT|O_APPEND |
230230 * |---------------------------------------------------------------|
231231 *
232− * @return standard error code*/
232+ * @return standard error code*/
233233 int ext4_fopen (ext4_file *f, const char *path, const char *flags);
234234
235235 /**@brief File close function.
lwext4/ext4.c+25−25
@@ -61,21 +61,21 @@ · 60 unmodified lines
6161 /**@brief Mount point descrpitor.*/
6262 struct ext4_mountpoint {
6363
64− /**@brief Mount point name (@ref ext4_mount)*/
64+ /**@brief Mount point name (@ref ext4_mount)*/
6565 const char *name;
6666
67− /**@brief Os dependent lock/unlock functions.*/
67+ /**@brief Os dependent lock/unlock functions.*/
6868 struct ext4_lock *os_locks;
6969
70− /**@brief Ext4 filesystem internals.*/
70+ /**@brief Ext4 filesystem internals.*/
7171 struct ext4_fs fs;
7272
73− /**@brief Dynamic alocation cache flag.*/
73+ /**@brief Dynamic alocation cache flag.*/
7474 bool cache_dynamic;
7575 };
7676
7777 /**@brief Block devices descriptor.*/
78−struct _ext4_devices {
78+struct _ext4_devices {
7979
8080 /**@brief Block device name (@ref ext4_device_register)*/
8181 const char *name;
@@ -87,11 +87,11 @@ struct _ext4_devices { · 5 unmodified lines
8787 struct ext4_bcache *bc;
8888 };
8989
90−/**@brief Block devices.*/
91−struct _ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];
90+/**@brief Block devices.*/
91+struct _ext4_devices _bdevices[CONFIG_EXT4_BLOCKDEVS_COUNT];
9292
9393
94−/**@brief Mountpoints.*/
94+/**@brief Mountpoints.*/
9595 struct ext4_mountpoint _mp[CONFIG_EXT4_MOUNTPOINTS_COUNT];
9696
9797
@@ -105,8 +105,8 @@ int ext4_device_register(struct ext4_blockdev *bd, struct ext4_bcache *bc, · 7 unmodified lines
105105 for (i = 0; i < CONFIG_EXT4_BLOCKDEVS_COUNT; ++i) {
106106 if(!_bdevices[i].name){
107107 _bdevices[i].name = dev_name;
108− _bdevices[i].bd = bd;
109− _bdevices[i].bc = bc;
108+ _bdevices[i].bd = bd;
109+ _bdevices[i].bc = bc;
110110 return EOK;
111111 }
112112 }
@@ -388,11 +388,11 @@ int ext4_mount(const char * dev_name, char *mount_point) · 275 unmodified lines
388388 }
389389
390390
391−int ext4_umount(char *mount_point)
391+int ext4_umount(char *mount_point)
392392 {
393− int i;
394− int r = EOK;
395− struct ext4_mountpoint *mp = 0;
393+ int i;
394+ int r = EOK;
395+ struct ext4_mountpoint *mp = 0;
396396
397397 for (i = 0; i < CONFIG_EXT4_MOUNTPOINTS_COUNT; ++i) {
398398 if(_mp[i].name){
@@ -502,7 +502,7 @@ static bool ext4_parse_flags(const char *flags, uint32_t *file_flags) · 103 unmodified lines
502502 }
503503
504504 if(!strcmp(flags, "a") || !strcmp(flags, "ab")){
505− *file_flags = O_WRONLY | O_CREAT | O_APPEND ;
505+ *file_flags = O_WRONLY | O_CREAT | O_APPEND;
506506 return true;
507507 }
508508
@@ -531,10 +531,10 @@ static int ext4_generic_open (ext4_file *f, const char *path, · 22 unmodified lines
531531 {
532532 struct ext4_mountpoint *mp = ext4_get_mount(path);
533533 struct ext4_directory_search_result result;
534− struct ext4_inode_ref ref;
535− bool is_goal = false;
536− uint8_t inode_type = EXT4_DIRECTORY_FILETYPE_DIR;
537− int r = ENOENT;
534+ struct ext4_inode_ref ref;
535+ bool is_goal = false;
536+ uint8_t inode_type = EXT4_DIRECTORY_FILETYPE_DIR;
537+ int r = ENOENT;
538538 uint32_t next_inode;
539539
540540 f->mp = 0;
@@ -585,7 +585,7 @@ static int ext4_generic_open (ext4_file *f, const char *path, · 44 unmodified lines
585585 break;
586586
587587 /*O_CREAT allows create new entry*/
588− struct ext4_inode_ref child_ref;
588+ struct ext4_inode_ref child_ref;
589589 r = ext4_fs_alloc_inode(&mp->fs, &child_ref, is_goal ? !file_expect : true);
590590 if(r != EOK)
591591 break;
@@ -790,7 +790,7 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt) · 198 unmodified lines
790790 uint32_t fblock_start;
791791 uint32_t fblock_cnt;
792792 struct ext4_block b;
793− uint8_t *u8_buf = buf;
793+ uint8_t *u8_buf = buf;
794794 struct ext4_inode_ref ref;
795795 uint32_t sblock;
796796 uint32_t sblock_end;
@@ -821,7 +821,7 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt) · 24 unmodified lines
821821
822822 block_size = ext4_sb_get_block_size(&f->mp->fs.sb);
823823 size = size > (f->fsize - f->fpos) ? (f->fsize - f->fpos) : size;
824− sblock = (f->fpos) / block_size;
824+ sblock = (f->fpos) / block_size;
825825 sblock_end = (f->fpos + size) / block_size;
826826 u = (f->fpos) % block_size;
827827
@@ -916,13 +916,13 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt) · 88 unmodified lines
916916 return r;
917917 }
918918
919−int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
919+int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt)
920920 {
921921 int r = EOK;
922922 uint32_t u;
923923 uint32_t fblock;
924924 struct ext4_block b;
925− uint8_t *u8_buf = buf;
925+ uint8_t *u8_buf = buf;
926926 struct ext4_inode_ref ref;
927927 uint32_t sblock;
928928 uint32_t sblock_end;
@@ -962,7 +962,7 @@ int ext4_fwrite(ext4_file *f, void *buf, uint32_t size, uint32_t *wcnt) · 33 unmodified lines
962962 if(f->fsize % block_size)
963963 file_blocks++;
964964
965− sblock = (f->fpos) / block_size;
965+ sblock = (f->fpos) / block_size;
966966
967967 u = (f->fpos) % block_size;
968968
lwext4/ext4_balloc.c+11−11
@@ -62,12 +62,12 @@ static uint32_t ext4_balloc_get_bgid_of_block(struct ext4_sblock *s, · 61 unmodified lines
6262 uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
6363 struct ext4_block_group_ref * bg_ref)
6464 {
65− uint32_t block_group_count = ext4_block_group_cnt(s);
65+ uint32_t block_group_count = ext4_block_group_cnt(s);
6666 uint32_t inode_table_first_block =
6767 ext4_bg_get_inode_table_first_block(bg_ref->block_group, s);
68− uint32_t block_size = ext4_sb_get_block_size(s);
68+ uint32_t block_size = ext4_sb_get_block_size(s);
6969
70− uint16_t inode_size = ext4_get16(s, inode_size);
70+ uint16_t inode_size = ext4_get16(s, inode_size);
7171 uint32_t inodes_per_group = ext4_get32(s, inodes_per_group);
7272
7373 uint32_t inode_table_bytes;
@@ -77,7 +77,7 @@ uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s, · 3 unmodified lines
7777 inode_table_bytes = inodes_per_group * inode_size;
7878 } else {
7979 /* Last block group could be smaller */
80− uint32_t inodes_count_total = ext4_get32(s, inodes_count);
80+ uint32_t inodes_count_total = ext4_get32(s, inodes_count);
8181 inode_table_bytes =
8282 (inodes_count_total - ((block_group_count - 1) *
8383 inodes_per_group)) * inode_size;
@@ -93,12 +93,12 @@ uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s, · 9 unmodified lines
9393
9494 int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref, uint32_t baddr)
9595 {
96− struct ext4_fs *fs = inode_ref->fs;
97− struct ext4_sblock *sb = &fs->sb;
96+ struct ext4_fs *fs = inode_ref->fs;
97+ struct ext4_sblock *sb = &fs->sb;
9898
9999
100100 uint32_t block_group = ext4_balloc_get_bgid_of_block(sb, baddr);
101− uint32_t index_in_group = ext4_fs_baddr2_index_in_group(sb, baddr);
101+ uint32_t index_in_group = ext4_fs_baddr2_index_in_group(sb, baddr);
102102
103103 /* Load block group reference */
104104 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) · 5 unmodified lines
110110 uint32_t bitmap_block_addr =
111111 ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
112112
113− struct ext4_block bitmap_block;
113+ struct ext4_block bitmap_block;
114114
115115 rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
116116 if (rc != EOK)
@@ -187,7 +187,7 @@ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref, uint32_t first, · 70 unmodified lines
187187 uint32_t bitmap_block_addr =
188188 ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
189189
190− struct ext4_block bitmap_block;
190+ struct ext4_block bitmap_block;
191191
192192 rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
193193 if (rc != EOK)
@@ -315,7 +315,7 @@ int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref, · 121 unmodified lines
315315 uint32_t bitmap_block_addr;
316316 uint32_t rel_block_idx = 0;
317317
318− struct ext4_block bitmap_block;
318+ struct ext4_block bitmap_block;
319319
320320 /* Find GOAL */
321321 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, · 228 unmodified lines
550550 ext4_bg_get_block_bitmap(bg_ref.block_group, sb);
551551
552552
553− struct ext4_block bitmap_block;
553+ struct ext4_block bitmap_block;
554554
555555 rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
556556 if (rc != EOK)
lwext4/ext4_balloc.h+21−21
@@ -49,39 +49,39 @@ · 48 unmodified lines
4949 #include <stdbool.h>
5050
5151
52−/**@brief Get first datablock in block group
53− * @param s superblock descriptor
54− * @param bg_ref block group reference
55− * @return block id of the first datablock in block group*/
52+/**@brief Get first datablock in block group
53+ * @param s superblock descriptor
54+ * @param bg_ref block group reference
55+ * @return block id of the first datablock in block group*/
5656 uint32_t ext4_balloc_get_first_data_block_in_group(struct ext4_sblock *s,
5757 struct ext4_block_group_ref * bg_ref);
5858
59−/**@brief Free block from inode.
60− * @param inode_ref inode reference
61− * @param baddr block address
62− * @return standard error code*/
59+/**@brief Free block from inode.
60+ * @param inode_ref inode reference
61+ * @param baddr block address
62+ * @return standard error code*/
6363 int ext4_balloc_free_block(struct ext4_inode_ref *inode_ref,
6464 uint32_t baddr);
6565
66−/**@brief Free blocks from inode.
67− * @param inode_ref inode reference
68− * @param baddr block address
69− * @return standard error code*/
66+/**@brief Free blocks from inode.
67+ * @param inode_ref inode reference
68+ * @param baddr block address
69+ * @return standard error code*/
7070 int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
7171 uint32_t first, uint32_t count);
7272
73−/**@brief Allocate block procedure.
74− * @param inode_ref inode reference
75− * @param baddr allocated block address
76− * @return standard error code*/
73+/**@brief Allocate block procedure.
74+ * @param inode_ref inode reference
75+ * @param baddr allocated block address
76+ * @return standard error code*/
7777 int ext4_balloc_alloc_block(struct ext4_inode_ref *inode_ref,
7878 uint32_t *baddr);
7979
80−/**@brief Try allocate selected block.
81− * @param inode_ref inode reference
82− * @param baddr block address to allocate
83− * @param free if baddr is not allocated
84− * @return standard error code*/
80+/**@brief Try allocate selected block.
81+ * @param inode_ref inode reference
82+ * @param baddr block address to allocate
83+ * @param free if baddr is not allocated
84+ * @return standard error code*/
8585 int ext4_balloc_try_alloc_block(struct ext4_inode_ref *inode_ref,
8686 uint32_t baddr, bool *free);
8787
lwext4/ext4_bcache.c+6−6
@@ -43,7 +43,7 @@ · 42 unmodified lines
4343 #include <stdlib.h>
4444
4545
46−int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
46+int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
4747 uint32_t itemsize)
4848 {
4949 ext4_assert(bc && cnt && itemsize);
@@ -104,7 +104,7 @@ int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt, · 54 unmodified lines
104104 return ENOMEM;
105105 }
106106
107−int ext4_bcache_fini_dynamic(struct ext4_bcache *bc)
107+int ext4_bcache_fini_dynamic(struct ext4_bcache *bc)
108108 {
109109 if(bc->refctr)
110110 free(bc->refctr);
@@ -195,8 +195,8 @@ int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b, · 84 unmodified lines
195195
196196 if(cache_id != bc->cnt){
197197 /*There was unreferenced block*/
198− bc->lba[cache_id] = b->lb_id;
199− bc->refctr[cache_id] = 1;
198+ bc->lba[cache_id] = b->lb_id;
199+ bc->refctr[cache_id] = 1;
200200 bc->lru_id[cache_id] = ++bc->lru_ctr;
201201
202202 /*Set valid cache data and id*/
@@ -245,8 +245,8 @@ int ext4_bcache_free (struct ext4_bcache *bc, struct ext4_block *b, · 42 unmodified lines
245245 if(!bc->refctr[b->cache_id] && !bc->free_delay[b->cache_id])
246246 bc->ref_blocks--;
247247
248− b->lb_id = 0;
249− b->data = 0;
248+ b->lb_id = 0;
249+ b->data = 0;
250250 b->cache_id = 0;
251251
252252 return EOK;
lwext4/ext4_bcache.h+62−62
@@ -42,110 +42,110 @@ · 41 unmodified lines
4242 #include <stdint.h>
4343 #include <stdbool.h>
4444
45−/**@brief Single block descriptor.*/
46−struct ext4_block {
47− /**@brief Dirty flag.*/
48− bool dirty;
45+/**@brief Single block descriptor.*/
46+struct ext4_block {
47+ /**@brief Dirty flag.*/
48+ bool dirty;
4949
50− /**@brief Logical block ID*/
51− uint64_t lb_id;
50+ /**@brief Logical block ID*/
51+ uint64_t lb_id;
5252
5353 /**@brief Cache id*/
54− uint32_t cache_id;
54+ uint32_t cache_id;
5555
56− /**@brief Data buffer.*/
57− uint8_t *data;
56+ /**@brief Data buffer.*/
57+ uint8_t *data;
5858 };
5959
6060
61−/**@brief Block cache descriptor.*/
62−struct ext4_bcache {
61+/**@brief Block cache descriptor.*/
62+struct ext4_bcache {
6363
64− /**@brief Item count in block cache*/
65− uint32_t cnt;
64+ /**@brief Item count in block cache*/
65+ uint32_t cnt;
6666
67− /**@brief Item size in block cache*/
68− uint32_t itemsize;
67+ /**@brief Item size in block cache*/
68+ uint32_t itemsize;
6969
70− /**@brief Last recently used counter.*/
71− uint32_t lru_ctr;
70+ /**@brief Last recently used counter.*/
71+ uint32_t lru_ctr;
7272
73− /**@brief Reference count table (cnt).*/
74− uint32_t *refctr;
73+ /**@brief Reference count table (cnt).*/
74+ uint32_t *refctr;
7575
76− /**@brief Last recently used ID table (cnt)*/
77− uint32_t *lru_id;
76+ /**@brief Last recently used ID table (cnt)*/
77+ uint32_t *lru_id;
7878
79− /**@brief Free delay mode table (cnt)*/
80− uint8_t *free_delay;
79+ /**@brief Free delay mode table (cnt)*/
80+ uint8_t *free_delay;
8181
82− /**@brief Logical block table (cnt).*/
83− uint64_t *lba;
82+ /**@brief Logical block table (cnt).*/
83+ uint64_t *lba;
8484
85− /**@brief Cache data buffers (cnt * itemsize)*/
86− uint8_t *data;
85+ /**@brief Cache data buffers (cnt * itemsize)*/
86+ uint8_t *data;
8787
88− /**@brief Currently referenced datablocks*/
89− uint32_t ref_blocks;
88+ /**@brief Currently referenced datablocks*/
89+ uint32_t ref_blocks;
9090
91− /**@brief Maximum referenced datablocks*/
92− uint32_t max_ref_blocks;
91+ /**@brief Maximum referenced datablocks*/
92+ uint32_t max_ref_blocks;
9393
9494 };
9595
96−/**@brief Static initializer of block cache structure.*/
96+/**@brief Static initializer of block cache structure.*/
9797 #define EXT4_BCACHE_STATIC_INSTANCE(__name, __cnt, __itemsize) \
98− static uint32_t __name##_refctr[(__cnt)]; \
99− static uint32_t __name##_lru_id[(__cnt)]; \
100− static uint8_t __name##_free_delay[(__cnt)]; \
101− static uint64_t __name##_lba[(__cnt)]; \
102− static uint8_t __name##_data[(__cnt) * (__itemsize)]; \
103− static struct ext4_bcache __name = { \
104− .cnt = __cnt, \
98+ static uint32_t __name##_refctr[(__cnt)]; \
99+ static uint32_t __name##_lru_id[(__cnt)]; \
100+ static uint8_t __name##_free_delay[(__cnt)]; \
101+ static uint64_t __name##_lba[(__cnt)]; \
102+ static uint8_t __name##_data[(__cnt) * (__itemsize)]; \
103+ static struct ext4_bcache __name = { \
104+ .cnt = __cnt, \
105105 .itemsize = __itemsize, \
106106 .lru_ctr = 0, \
107− .refctr = __name##_refctr, \
107+ .refctr = __name##_refctr, \
108108 .lru_id = __name##_lru_id, \
109− .lba = __name##_lba, \
109+ .lba = __name##_lba, \
110110 .free_delay= __name##_free_delay, \
111− .data = __name##_data, \
111+ .data = __name##_data, \
112112 }
113113
114114
115−/**@brief Dynamic initialization of block cache.
116− * @param bc block cache descriptor
117− * @param cnt items count in block cache
118− * @param itemsize single item size (in bytes)
119− * @return standard error code*/
120−int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
115+/**@brief Dynamic initialization of block cache.
116+ * @param bc block cache descriptor
117+ * @param cnt items count in block cache
118+ * @param itemsize single item size (in bytes)
119+ * @return standard error code*/
120+int ext4_bcache_init_dynamic(struct ext4_bcache *bc, uint32_t cnt,
121121 uint32_t itemsize);
122122
123−/**@brief Dynamic de-initialization of block cache.
124− * @param bc block cache descriptor
125− * @return standard error code*/
126−int ext4_bcache_fini_dynamic(struct ext4_bcache *bc);
123+/**@brief Dynamic de-initialization of block cache.
124+ * @param bc block cache descriptor
125+ * @return standard error code*/
126+int ext4_bcache_fini_dynamic(struct ext4_bcache *bc);
127127
128−/**@brief Allocate block from block cache memory.
128+/**@brief Allocate block from block cache memory.
129129 * Unreferenced block allocation is based on LRU
130130 * (Last Recently Used) algorithm.
131− * @param bc block cache descriptor
132− * @param b block to alloc
133− * @param is_new block is new (needs to be read)
131+ * @param bc block cache descriptor
132+ * @param b block to alloc
133+ * @param is_new block is new (needs to be read)
134134 * @return standard error code*/
135135 int ext4_bcache_alloc(struct ext4_bcache *bc, struct ext4_block *b,
136136 bool *is_new);
137137
138−/**@brief Free block from cache memory (decrement reference counter).
139− * @param bc block cache descriptor
140− * @param b block to free
138+/**@brief Free block from cache memory (decrement reference counter).
139+ * @param bc block cache descriptor
140+ * @param b block to free
141141 * @return standard error code*/
142142 int ext4_bcache_free (struct ext4_bcache *bc, struct ext4_block *b,
143143 uint8_t free_delay);
144144
145145
146−/**@brief Return a full status of block cache.
147− * @param bc block cache descriptor
148− * @return full status*/
146+/**@brief Return a full status of block cache.
147+ * @param bc block cache descriptor
148+ * @return full status*/
149149 bool ext4_bcache_is_full(struct ext4_bcache *bc);
150150
151151 #endif /* EXT4_BCACHE_H_ */
lwext4/ext4_bitmap.h+21−21
@@ -42,50 +42,50 @@ · 41 unmodified lines
4242 #include <stdint.h>
4343 #include <stdbool.h>
4444
45−/**@brief Set bitmap bit.
46− * @param bmap bitmap
47− * @param bit bit to set*/
45+/**@brief Set bitmap bit.
46+ * @param bmap bitmap
47+ * @param bit bit to set*/
4848 static inline void ext4_bmap_bit_set(uint8_t *bmap, uint32_t bit)
4949 {
5050 *(bmap + (bit >> 3)) |= (1 << (bit & 7));
5151 }
5252
53−/**@brief Clear bitmap bit.
54− * @param bmap bitmap buffer
55− * @param bit bit to clear*/
53+/**@brief Clear bitmap bit.
54+ * @param bmap bitmap buffer
55+ * @param bit bit to clear*/
5656 static inline void ext4_bmap_bit_clr(uint8_t *bmap, uint32_t bit)
5757 {
5858 *(bmap + (bit >> 3)) &= ~(1 << (bit & 7));
5959 }
6060
6161
62−/**@brief Check if the bitmap bit is set.
63− * @param bmap bitmap buffer
64− * @param bit bit to check*/
62+/**@brief Check if the bitmap bit is set.
63+ * @param bmap bitmap buffer
64+ * @param bit bit to check*/
6565 static inline bool ext4_bmap_is_bit_set(uint8_t *bmap, uint32_t bit)
6666 {
6767 return (*(bmap + (bit >> 3)) & (1 << (bit & 7)));
6868 }
6969
70−/**@brief Check if the bitmap bit is clear.
71− * @param bmap bitmap buffer
72− * @param bit bit to check*/
70+/**@brief Check if the bitmap bit is clear.
71+ * @param bmap bitmap buffer
72+ * @param bit bit to check*/
7373 static inline bool ext4_bmap_is_bit_clr(uint8_t *bmap, uint32_t bit)
7474 {
7575 return !ext4_bmap_is_bit_set(bmap, bit);
7676 }
7777
78−/**@brief Free range of bits in bitmap.
79− * @param bmap bitmap buffer
80− * @param sbit start bit
81− * @param bcnt bit count*/
78+/**@brief Free range of bits in bitmap.
79+ * @param bmap bitmap buffer
80+ * @param sbit start bit
81+ * @param bcnt bit count*/
8282 void ext4_bmap_bits_free(uint8_t *bmap, uint32_t sbit, uint32_t bcnt);
8383
84−/**@brief Find first clear bit in bitmap.
85− * @param sbit start bit of search
86− * @param ebit end bit of search
87− * @param bit_id output parameter (first free bit)
88− * @return standard error code*/
84+/**@brief Find first clear bit in bitmap.
85+ * @param sbit start bit of search
86+ * @param ebit end bit of search
87+ * @param bit_id output parameter (first free bit)
88+ * @return standard error code*/
8989 int ext4_bmap_bit_find_clr(uint8_t *bmap, uint32_t sbit, uint32_t ebit,
9090 uint32_t *bit_id);
9191
lwext4/ext4_blockdev.c+16−16
@@ -44,7 +44,7 @@ · 43 unmodified lines
4444
4545
4646
47−int ext4_block_init(struct ext4_blockdev *bdev)
47+int ext4_block_init(struct ext4_blockdev *bdev)
4848 {
4949 int rc;
5050 ext4_assert(bdev);
@@ -58,7 +58,7 @@ int ext4_block_init(struct ext4_blockdev *bdev) · 7 unmodified lines
5858
5959 bdev->flags |= EXT4_BDEV_INITIALIZED;
6060
61− return EOK;
61+ return EOK;
6262 }
6363
6464 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) · 3 unmodified lines
6868 return EOK;
6969 }
7070
71−void ext4_block_set_lb_size(struct ext4_blockdev *bdev, uint64_t lb_bsize)
71+void ext4_block_set_lb_size(struct ext4_blockdev *bdev, uint64_t lb_bsize)
7272 {
7373 /*Logical block size has to be multiply of physical */
7474 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) · 3 unmodified lines
7878
7979 }
8080
81−int ext4_block_fini(struct ext4_blockdev *bdev)
81+int ext4_block_fini(struct ext4_blockdev *bdev)
8282 {
8383 ext4_assert(bdev);
8484
@@ -89,7 +89,7 @@ int ext4_block_fini(struct ext4_blockdev *bdev) · 4 unmodified lines
8989 }
9090
9191
92−int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
92+int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
9393 uint64_t lba)
9494 {
9595 uint64_t pba;
@@ -164,7 +164,7 @@ int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b, · 68 unmodified lines
164164 return EOK;
165165 }
166166
167−int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b)
167+int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b)
168168 {
169169 uint64_t pba;
170170 uint32_t pb_cnt;
@@ -206,7 +206,7 @@ int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b) · 35 unmodified lines
206206 return EOK;
207207 }
208208
209−int ext4_blocks_get_direct(struct ext4_blockdev *bdev, void *buf,
209+int ext4_blocks_get_direct(struct ext4_blockdev *bdev, void *buf,
210210 uint64_t lba, uint32_t cnt)
211211 {
212212 uint64_t pba;
@@ -221,7 +221,7 @@ int ext4_blocks_get_direct(struct ext4_blockdev *bdev, void *buf, · 8 unmodified lines
221221 return bdev->bread(bdev, buf, pba, pb_cnt * cnt);
222222 }
223223
224−int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf,
224+int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf,
225225 uint64_t lba, uint32_t cnt)
226226 {
227227 uint64_t pba;
@@ -238,7 +238,7 @@ int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf, · 10 unmodified lines
238238 }
239239
240240
241−int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off,
241+int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off,
242242 const void *buf, uint32_t len)
243243 {
244244 uint64_t block_idx;
@@ -247,7 +247,7 @@ int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off, · 2 unmodified lines
247247 uint32_t unalg;
248248 int r = EOK;
249249
250− const uint8_t *p = (void *)buf;
250+ const uint8_t *p = (void *)buf;
251251
252252 ext4_assert(bdev && buf);
253253
@@ -258,7 +258,7 @@ int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off, · 4 unmodified lines
258258 block_end = block_idx + len / bdev->ph_bsize;
259259
260260 if(!(block_end < bdev->ph_bcnt))
261− return EINVAL; /*Ups. Out of range operation*/
261+ return EINVAL; /*Ups. Out of range operation*/
262262
263263 /*OK lets deal with the first possible unaligned block*/
264264 unalg = (off & (bdev->ph_bsize - 1));
@@ -317,7 +317,7 @@ int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off, · 52 unmodified lines
317317
318318
319319
320−int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf,
320+int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf,
321321 uint32_t len)
322322 {
323323 uint64_t block_idx;
@@ -326,7 +326,7 @@ int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf, · 2 unmodified lines
326326 uint32_t unalg;
327327 int r = EOK;
328328
329− uint8_t *p = (void *)buf;
329+ uint8_t *p = (void *)buf;
330330
331331 ext4_assert(bdev && buf);
332332
@@ -337,7 +337,7 @@ int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf, · 4 unmodified lines
337337 block_end = block_idx + len / bdev->ph_bsize;
338338
339339 if(!(block_end < bdev->ph_bcnt))
340− return EINVAL; /*Ups. Out of range operation*/
340+ return EINVAL; /*Ups. Out of range operation*/
341341
342342 /*OK lets deal with the first possible unaligned block*/
343343 unalg = (off & (bdev->ph_bsize - 1));
@@ -365,7 +365,7 @@ int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf, · 21 unmodified lines
365365 if(r != EOK)
366366 return r;
367367
368− p += bdev->ph_bsize * blen;
368+ p += bdev->ph_bsize * blen;
369369 len -= bdev->ph_bsize * blen;
370370
371371 block_idx += blen;
@@ -383,7 +383,7 @@ int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off, void *buf, · 11 unmodified lines
383383 return r;
384384 }
385385
386−int ext4_block_delay_cache_flush(struct ext4_blockdev *bdev,
386+int ext4_block_delay_cache_flush(struct ext4_blockdev *bdev,
387387 uint8_t on_off)
388388 {
389389 int r;
lwext4/ext4_blockdev.h+102−102
@@ -44,73 +44,73 @@ · 43 unmodified lines
4444 #include <stdbool.h>
4545 #include <stdint.h>
4646
47−/**@brief Initialization status flag*/
48−#define EXT4_BDEV_INITIALIZED (1 << 0)
47+/**@brief Initialization status flag*/
48+#define EXT4_BDEV_INITIALIZED (1 << 0)
4949
5050
51−/**@brief Definiton of the simple block device.*/
52−struct ext4_blockdev {
51+/**@brief Definiton of the simple block device.*/
52+struct ext4_blockdev {
5353
54− /**@brief Open device function
55− * @param bdev block device.*/
56− int (*open)(struct ext4_blockdev *bdev);
54+ /**@brief Open device function
55+ * @param bdev block device.*/
56+ int (*open)(struct ext4_blockdev *bdev);
5757
58− /**@brief Block read function.
59− * @param bdev block device
60− * @param buf output buffer
61− * @param blk_id block id
62− * @param blk_cnt block count*/
63− int (*bread)(struct ext4_blockdev *bdev, void *buf,
58+ /**@brief Block read function.
59+ * @param bdev block device
60+ * @param buf output buffer
61+ * @param blk_id block id
62+ * @param blk_cnt block count*/
63+ int (*bread)(struct ext4_blockdev *bdev, void *buf,
6464 uint64_t blk_id, uint32_t blk_cnt);
6565
66− /**@brief Block write function.
67− * @param buf input buffer
68− * @param blk_id block id
69− * @param blk_cnt block count*/
70− int (*bwrite)(struct ext4_blockdev *bdev, const void *buf,
66+ /**@brief Block write function.
67+ * @param buf input buffer
68+ * @param blk_id block id
69+ * @param blk_cnt block count*/
70+ int (*bwrite)(struct ext4_blockdev *bdev, const void *buf,
7171 uint64_t blk_id, uint32_t blk_cnt);
7272
73− /**@brief Close device function.
74− * @param bdev block device.*/
75− int (*close)(struct ext4_blockdev *bdev);
73+ /**@brief Close device function.
74+ * @param bdev block device.*/
75+ int (*close)(struct ext4_blockdev *bdev);
7676
7777 /**@brief Block cache.*/
7878 struct ext4_bcache *bc;
7979
80− /**@brief Block size (bytes): physical*/
81− uint32_t ph_bsize;
80+ /**@brief Block size (bytes): physical*/
81+ uint32_t ph_bsize;
8282
83− /**@brief Block count: physical.*/
84− uint64_t ph_bcnt;
83+ /**@brief Block count: physical.*/
84+ uint64_t ph_bcnt;
8585
86− /**@brief Block size buffer: physical.*/
87− uint8_t *ph_bbuf;
86+ /**@brief Block size buffer: physical.*/
87+ uint8_t *ph_bbuf;
8888
89− /**@brief Block size (bytes) logical*/
90− uint32_t lg_bsize;
89+ /**@brief Block size (bytes) logical*/
90+ uint32_t lg_bsize;
9191
92− /**@brief Block count: phisical.*/
93− uint64_t lg_bcnt;
92+ /**@brief Block count: phisical.*/
93+ uint64_t lg_bcnt;
9494
95− /**@brief Flags of te block device.*/
96− uint8_t flags;
95+ /**@brief Flags of te block device.*/
96+ uint8_t flags;
9797
9898 /**@brief Cache flush delay mode flag.*/
99− uint8_t cache_flush_delay;
99+ uint8_t cache_flush_delay;
100100
101101 /**@brief Physical read counter*/
102− uint32_t bread_ctr;
102+ uint32_t bread_ctr;
103103
104104 /**@brief Physical write counter*/
105− uint32_t bwrite_ctr;
105+ uint32_t bwrite_ctr;
106106 };
107107
108108
109−/**@brief Static initialization fo the block device.*/
109+/**@brief Static initialization fo the block device.*/
110110 #define EXT4_BLOCKDEV_STATIC_INSTANCE(__name, __bsize, __bcnt, __open, \
111− __bread, __bwrite, __close) \
112− static uint8_t __name##_ph_bbuf[(__bsize)]; \
113− static struct ext4_blockdev __name = { \
111+ __bread, __bwrite, __close) \
112+ static uint8_t __name##_ph_bbuf[(__bsize)]; \
113+ static struct ext4_blockdev __name = { \
114114 .open = __open, \
115115 .bread = __bread, \
116116 .bwrite = __bwrite, \
@@ -120,93 +120,93 @@ struct ext4_blockdev { · 3 unmodified lines
120120 .ph_bbuf = __name##_ph_bbuf, \
121121 }
122122
123−/**@brief Block device initialization.
124− * @param bdev block device descriptor
125− * @param bg_bsize logical block size
126− * @param bdev block device descriptor
127− * @return standard error code*/
128−int ext4_block_init(struct ext4_blockdev *bdev);
123+/**@brief Block device initialization.
124+ * @param bdev block device descriptor
125+ * @param bg_bsize logical block size
126+ * @param bdev block device descriptor
127+ * @return standard error code*/
128+int ext4_block_init(struct ext4_blockdev *bdev);
129129
130130
131−/**@brief Binds a bcache to block device.
132− * @param bdev block device descriptor
133− * @param bc block cache descriptor
134− * @return standard error code*/
131+/**@brief Binds a bcache to block device.
132+ * @param bdev block device descriptor
133+ * @param bc block cache descriptor
134+ * @return standard error code*/
135135 int ext4_block_bind_bcache(struct ext4_blockdev *bdev,
136136 struct ext4_bcache *bc);
137137
138−/**@brief Close block device
139− * @param bdev block device descriptor
140− * @return standard error code*/
141−int ext4_block_fini(struct ext4_blockdev *bdev);
138+/**@brief Close block device
139+ * @param bdev block device descriptor
140+ * @return standard error code*/
141+int ext4_block_fini(struct ext4_blockdev *bdev);
142142
143143
144−/**@brief Set logical block size in block device.
145− * @param bdev block device descriptor
146− * @param lb_size ligical block size (in bytes)
147− * @return standard error code*/
148−void ext4_block_set_lb_size(struct ext4_blockdev *bdev,
144+/**@brief Set logical block size in block device.
145+ * @param bdev block device descriptor
146+ * @param lb_size ligical block size (in bytes)
147+ * @return standard error code*/
148+void ext4_block_set_lb_size(struct ext4_blockdev *bdev,
149149 uint64_t lb_bsize);
150150
151−/**@brief Block get function (through cache).
152− * @param bdev block device descriptor
153− * @param b block descriptor
154− * @param lba logical block address
155− * @return standard error code*/
156−int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
151+/**@brief Block get function (through cache).
152+ * @param bdev block device descriptor
153+ * @param b block descriptor
154+ * @param lba logical block address
155+ * @return standard error code*/
156+int ext4_block_get(struct ext4_blockdev *bdev, struct ext4_block *b,
157157 uint64_t lba);
158158
159−/**@brief Block set procedure (through cache).
160− * @param bdev block device descriptor
161− * @param b block descriptor
162− * @return standard error code*/
163−int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b);
159+/**@brief Block set procedure (through cache).
160+ * @param bdev block device descriptor
161+ * @param b block descriptor
162+ * @return standard error code*/
163+int ext4_block_set(struct ext4_blockdev *bdev, struct ext4_block *b);
164164
165165
166−/**@brief Block read procedure (without cache)
167− * @param bdev block device descriptor
168− * @param buf output buffer
169− * @param lba logical block adderss
170− * @return standard error code*/
166+/**@brief Block read procedure (without cache)
167+ * @param bdev block device descriptor
168+ * @param buf output buffer
169+ * @param lba logical block adderss
170+ * @return standard error code*/
171171 int ext4_blocks_get_direct(struct ext4_blockdev *bdev, void *buf,
172172 uint64_t lba, uint32_t cnt);
173173
174174
175−/**@brief Block write procedure (without cache)
176− * @param bdev block device descriptor
177− * @param buf output buffer
178− * @param lba logical block address
179− * @return standard error code*/
180−int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf,
175+/**@brief Block write procedure (without cache)
176+ * @param bdev block device descriptor
177+ * @param buf output buffer
178+ * @param lba logical block address
179+ * @return standard error code*/
180+int ext4_blocks_set_direct(struct ext4_blockdev *bdev, const void *buf,
181181 uint64_t lba, uint32_t cnt);
182182
183−/**@brief Write to block device (by direct adress).
184− * @param bdev block device descriptor
185− * @param off byte offset in block device
186− * @param buf input buffer
187− * @param len length of the write nuffer
188− * @return EOK when sucess*/
189−int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off,
183+/**@brief Write to block device (by direct adress).
184+ * @param bdev block device descriptor
185+ * @param off byte offset in block device
186+ * @param buf input buffer
187+ * @param len length of the write nuffer
188+ * @return EOK when sucess*/
189+int ext4_block_writebytes(struct ext4_blockdev *bdev, uint64_t off,
190190 const void *buf, uint32_t len);
191191
192192
193193
194−/**@brief Read freom block device (by direct adress).
195− * @param bdev block device descriptor
196− * @param off byte offset in block device
197− * @param buf input buffer
198− * @param len length of the write nuffer
199− * @return EOK when sucess*/
200−int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off,
194+/**@brief Read freom block device (by direct adress).
195+ * @param bdev block device descriptor
196+ * @param off byte offset in block device
197+ * @param buf input buffer
198+ * @param len length of the write nuffer
199+ * @return EOK when sucess*/
200+int ext4_block_readbytes(struct ext4_blockdev *bdev, uint64_t off,
201201 void *buf, uint32_t len);
202202
203−/**@brief Enable/disable delayed cache flush mode.
204− * @param bdev block device descriptor
205− * @param on_off
206− * !0 - ENABLE
207− * 0 - DISABLE (all delayed cache buffers will be flushed)
208− * @return standard error code*/
209−int ext4_block_delay_cache_flush(struct ext4_blockdev *bdev, uint8_t on_off);
203+/**@brief Enable/disable delayed cache flush mode.
204+ * @param bdev block device descriptor
205+ * @param on_off
206+ * !0 - ENABLE
207+ * 0 - DISABLE (all delayed cache buffers will be flushed)
208+ * @return standard error code*/
209+int ext4_block_delay_cache_flush(struct ext4_blockdev *bdev, uint8_t on_off);
210210
211211 #endif /* EXT4_BLOCKDEV_H_ */
212212
lwext4/ext4_config.h+9−9
@@ -42,51 +42,51 @@ · 41 unmodified lines
4242 #endif
4343
4444
45−/**@brief Enable directory indexing feature (EXT3 feature)*/
45+/**@brief Enable directory indexing feature (EXT3 feature)*/
4646 #ifndef CONFIG_DIR_INDEX_ENABLE
4747 #define CONFIG_DIR_INDEX_ENABLE 1
4848 #endif
4949
50−/**@brief Enable extents feature (EXT4 feature)*/
50+/**@brief Enable extents feature (EXT4 feature)*/
5151 #ifndef CONFIG_EXTENT_ENABLE
5252 #define CONFIG_EXTENT_ENABLE 1
5353 #endif
5454
5555
5656
57−/**@brief Include error codes from ext4_errno or sandard library.*/
57+/**@brief Include error codes from ext4_errno or sandard library.*/
5858 #ifndef CONFIG_HAVE_OWN_ERRNO
5959 #define CONFIG_HAVE_OWN_ERRNO 1
6060 #endif
6161
6262
63−/**@brief Debug printf enable (stdout)*/
63+/**@brief Debug printf enable (stdout)*/
6464 #ifndef CONFIG_DEBUG_PRINTF
6565 #define CONFIG_DEBUG_PRINTF 1
6666 #endif
6767
68−/**@brief Assert printf enable (stdout)*/
68+/**@brief Assert printf enable (stdout)*/
6969 #ifndef CONFIG_DEBUG_ASSERT
7070 #define CONFIG_DEBUG_ASSERT 1
7171 #endif
7272
73−/**@brief Statistics of block device*/
73+/**@brief Statistics of block device*/
7474 #ifndef CONFIG_BLOCK_DEV_ENABLE_STATS
7575 #define CONFIG_BLOCK_DEV_ENABLE_STATS 1
7676 #endif
7777
78−/**@brief Cache size of block device.*/
78+/**@brief Cache size of block device.*/
7979 #ifndef CONFIG_BLOCK_DEV_CACHE_SIZE
8080 #define CONFIG_BLOCK_DEV_CACHE_SIZE 8
8181 #endif
8282
8383
84−/**@brief Ilosc urzadzen blokowych.*/
84+/**@brief Ilosc urzadzen blokowych.*/
8585 #ifndef CONFIG_EXT4_BLOCKDEVS_COUNT
8686 #define CONFIG_EXT4_BLOCKDEVS_COUNT 2
8787 #endif
8888
89−/**@brief Ilosc punktow montowania systemu plikow*/
89+/**@brief Ilosc punktow montowania systemu plikow*/
9090 #ifndef CONFIG_EXT4_MOUNTPOINTS_COUNT
9191 #define CONFIG_EXT4_MOUNTPOINTS_COUNT 2
9292 #endif
lwext4/ext4_debug.h+20−20
@@ -43,67 +43,67 @@ · 42 unmodified lines
4343 #include <stdio.h>
4444
4545 /**@brief Debug mask: ext4_blockdev.c*/
46−#define EXT4_DEBUG_BLOCKDEV (1 << 0)
46+#define EXT4_DEBUG_BLOCKDEV (1 << 0)
4747
4848 /**@brief Debug mask: ext4_fs.c*/
49−#define EXT4_DEBUG_FS (1 << 1)
49+#define EXT4_DEBUG_FS (1 << 1)
5050
5151 /**@brief Debug mask: ext4_balloc.c*/
52−#define EXT4_DEBUG_BALLOC (1 << 2)
52+#define EXT4_DEBUG_BALLOC (1 << 2)
5353
5454 /**@brief Debug mask: ext4_bitmap.c*/
55−#define EXT4_DEBUG_BITMAP (1 << 3)
55+#define EXT4_DEBUG_BITMAP (1 << 3)
5656
5757 /**@brief Debug mask: ext4_dir_idx.c*/
58−#define EXT4_DEBUG_DIR_IDX (1 << 4)
58+#define EXT4_DEBUG_DIR_IDX (1 << 4)
5959
6060 /**@brief Debug mask: ext4_dir.c*/
61−#define EXT4_DEBUG_DIR (1 << 5)
61+#define EXT4_DEBUG_DIR (1 << 5)
6262
6363 /**@brief Debug mask: ext4_ialloc.c*/
64−#define EXT4_DEBUG_IALLOC (1 << 6)
64+#define EXT4_DEBUG_IALLOC (1 << 6)
6565
6666 /**@brief Debug mask: ext4_inode.c*/
67−#define EXT4_DEBUG_INODE (1 << 7)
67+#define EXT4_DEBUG_INODE (1 << 7)
6868
6969 /**@brief Debug mask: ext4_super.c*/
70−#define EXT4_DEBUG_SUPER (1 << 8)
70+#define EXT4_DEBUG_SUPER (1 << 8)
7171
7272 /**@brief Debug mask: ext4_bcache.c*/
73−#define EXT4_DEBUG_BCACHE (1 << 9)
73+#define EXT4_DEBUG_BCACHE (1 << 9)
7474
7575 /**@brief Debug mask: ext4_extents.c*/
7676 #define EXT4_DEBUG_EXTENTS (1 << 10)
7777
7878
7979
80−/**@brief All debug printf enabled.*/
81−#define EXT4_DEBUG_ALL (0xFFFFFFFF)
80+/**@brief All debug printf enabled.*/
81+#define EXT4_DEBUG_ALL (0xFFFFFFFF)
8282
83−/**@brief Global mask debug settings.
84− * @brief m new debug mask.*/
83+/**@brief Global mask debug settings.
84+ * @brief m new debug mask.*/
8585 void ext4_dmask_set(uint32_t m);
8686
87−/**@brief Global debug mask get.
88− * @return debug mask*/
87+/**@brief Global debug mask get.
88+ * @return debug mask*/
8989 uint32_t ext4_dmask_get(void);
9090
9191
9292 #if CONFIG_DEBUG_PRINTF
93−/**@brief Debug printf.*/
94−#define ext4_dprintf(m, ...) do { \
93+/**@brief Debug printf.*/
94+#define ext4_dprintf(m, ...) do { \
9595 (m & ext4_dmask_get()) ? printf(__VA_ARGS__) : (void)0; \
9696 fflush(stdout); \
9797 }while(0)
9898 #else
99−#define ext4_dprintf(m, ...)
99+#define ext4_dprintf(m, ...)
100100 #endif
101101
102102
103103
104104 #if CONFIG_DEBUG_ASSERT
105105 /**@brief Debug asseration.*/
106−#define ext4_assert(_v) do { \
106+#define ext4_assert(_v) do { \
107107 if(!(_v)){ \
108108 printf("Assertion failed:\nmodule: %s\nfunc: %s\nline: %d\n", \
109109 __FILE__, __FUNCTION__, __LINE__); \
lwext4/ext4_dir.c+3−3
@@ -439,8 +439,8 @@ int ext4_dir_find_entry(struct ext4_directory_search_result *result, · 438 unmodified lines
439439
440440 /* Entry was not found */
441441
442− result->block.lb_id = 0;
443− result->dentry = NULL;
442+ result->block.lb_id = 0;
443+ result->dentry = NULL;
444444
445445 return ENOENT;
446446 }
@@ -513,7 +513,7 @@ int ext4_dir_try_insert_entry(struct ext4_sblock *sb, · 66 unmodified lines
513513
514514 /* Initialize pointers, stop means to upper bound */
515515 struct ext4_directory_entry_ll *dentry = (void *)target_block->data;
516− struct ext4_directory_entry_ll *stop =
516+ struct ext4_directory_entry_ll *stop =
517517 (void *)(target_block->data + block_size);
518518
519519 /*
lwext4/ext4_dir_idx.c+3−3
@@ -89,7 +89,7 @@ uint8_t ext4_dir_dx_root_info_get_indirect_levels( · 88 unmodified lines
8989 return root_info->indirect_levels;
9090 }
9191
92−void ext4_dir_dx_root_info_set_indirect_levels(
92+void ext4_dir_dx_root_info_set_indirect_levels(
9393 struct ext4_directory_dx_root_info *root_info, uint8_t lvl)
9494 {
9595 root_info->indirect_levels = lvl;
@@ -430,7 +430,7 @@ static int ext4_dir_dx_next_block(struct ext4_inode_ref *inode_ref, · 334 unmodified lines
430430
431431
432432
433−int ext4_dir_dx_find_entry(struct ext4_directory_search_result * result,
433+int ext4_dir_dx_find_entry(struct ext4_directory_search_result * result,
434434 struct ext4_inode_ref *inode_ref, size_t name_len, const char *name)
435435 {
436436 /* Load direct block 0 (index root) */
@@ -799,7 +799,7 @@ static int ext4_dir_dx_split_index(struct ext4_inode_ref *inode_ref, · 362 unmodified lines
799799 if (rc != EOK)
800800 return rc;
801801
802− struct ext4_directory_dx_node *new_node = (void *)new_block.data;
802+ struct ext4_directory_dx_node *new_node = (void *)new_block.data;
803803 struct ext4_directory_dx_entry *new_entries = new_node->entries;
804804
805805 memset(&new_node->fake, 0, sizeof(struct ext4_fake_directory_entry));
lwext4/ext4_errno.h+35−35
@@ -41,41 +41,41 @@ · 40 unmodified lines
4141 #ifndef CONFIG_HAVE_OWN_ERRNO
4242 #include <errno.h>
4343 #else
44−#define EPERM 1 /* Operation not permitted */
45−#define ENOENT 2 /* No such file or directory */
46−#define ESRCH 3 /* No such process */
47−#define EINTR 4 /* Interrupted system call */
48−#define EIO 5 /* I/O error */
49−#define ENXIO 6 /* No such device or address */
50−#define E2BIG 7 /* Argument list too long */
51−#define ENOEXEC 8 /* Exec format error */
52−#define EBADF 9 /* Bad file number */
53−#define ECHILD 10 /* No child processes */
54−#define EAGAIN 11 /* Try again */
55−#define ENOMEM 12 /* Out of memory */
56−#define EACCES 13 /* Permission denied */
57−#define EFAULT 14 /* Bad address */
58−#define ENOTBLK 15 /* Block device required */
59−#define EBUSY 16 /* Device or resource busy */
60−#define EEXIST 17 /* File exists */
61−#define EXDEV 18 /* Cross-device link */
62−#define ENODEV 19 /* No such device */
63−#define ENOTDIR 20 /* Not a directory */
64−#define EISDIR 21 /* Is a directory */
65−#define EINVAL 22 /* Invalid argument */
66−#define ENFILE 23 /* File table overflow */
67−#define EMFILE 24 /* Too many open files */
68−#define ENOTTY 25 /* Not a typewriter */
69−#define ETXTBSY 26 /* Text file busy */
70−#define EFBIG 27 /* File too large */
71−#define ENOSPC 28 /* No space left on device */
72−#define ESPIPE 29 /* Illegal seek */
73−#define EROFS 30 /* Read-only file system */
74−#define EMLINK 31 /* Too many links */
75−#define EPIPE 32 /* Broken pipe */
76−#define EDOM 33 /* Math argument out of domain of func */
77−#define ERANGE 34 /* Math result not representable */
78−#define ENOTSUP 95 /* Not supported */
44+#define EPERM 1 /* Operation not permitted */
45+#define ENOENT 2 /* No such file or directory */
46+#define ESRCH 3 /* No such process */
47+#define EINTR 4 /* Interrupted system call */
48+#define EIO 5 /* I/O error */
49+#define ENXIO 6 /* No such device or address */
50+#define E2BIG 7 /* Argument list too long */
51+#define ENOEXEC 8 /* Exec format error */
52+#define EBADF 9 /* Bad file number */
53+#define ECHILD 10 /* No child processes */
54+#define EAGAIN 11 /* Try again */
55+#define ENOMEM 12 /* Out of memory */
56+#define EACCES 13 /* Permission denied */
57+#define EFAULT 14 /* Bad address */
58+#define ENOTBLK 15 /* Block device required */
59+#define EBUSY 16 /* Device or resource busy */
60+#define EEXIST 17 /* File exists */
61+#define EXDEV 18 /* Cross-device link */
62+#define ENODEV 19 /* No such device */
63+#define ENOTDIR 20 /* Not a directory */
64+#define EISDIR 21 /* Is a directory */
65+#define EINVAL 22 /* Invalid argument */
66+#define ENFILE 23 /* File table overflow */
67+#define EMFILE 24 /* Too many open files */
68+#define ENOTTY 25 /* Not a typewriter */
69+#define ETXTBSY 26 /* Text file busy */
70+#define EFBIG 27 /* File too large */
71+#define ENOSPC 28 /* No space left on device */
72+#define ESPIPE 29 /* Illegal seek */
73+#define EROFS 30 /* Read-only file system */
74+#define EMLINK 31 /* Too many links */
75+#define EPIPE 32 /* Broken pipe */
76+#define EDOM 33 /* Math argument out of domain of func */
77+#define ERANGE 34 /* Math result not representable */
78+#define ENOTSUP 95 /* Not supported */
7979 #endif
8080
8181 #ifndef EOK
lwext4/ext4_fs.c+10−10
@@ -384,8 +384,8 @@ static int ext4_fs_init_inode_table(struct ext4_block_group_ref *bg_ref) · 383 unmodified lines
384384 {
385385 struct ext4_sblock *sb = &bg_ref->fs->sb;
386386
387− uint32_t inode_size = ext4_get32(sb, inode_size);
388− uint32_t block_size = ext4_sb_get_block_size(sb);
387+ uint32_t inode_size = ext4_get32(sb, inode_size);
388+ uint32_t block_size = ext4_sb_get_block_size(sb);
389389 uint32_t inodes_per_block = block_size / inode_size;
390390 uint32_t inodes_in_group = ext4_inodes_in_group_cnt(sb, bg_ref->index);
391391 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, · 278 unmodified lines
670670 ext4_inode_set_uid(inode, 0);
671671 ext4_inode_set_gid(inode, 0);
672672 ext4_inode_set_size(inode, 0);
673− ext4_inode_set_access_time(inode, 0);
673+ ext4_inode_set_access_time(inode, 0);
674674 ext4_inode_set_change_inode_time(inode, 0);
675675 ext4_inode_set_modification_time(inode, 0);
676− ext4_inode_set_deletion_time(inode, 0);
676+ ext4_inode_set_deletion_time(inode, 0);
677677 ext4_inode_set_blocks_count(&fs->sb, inode, 0);
678678 ext4_inode_set_flags(inode, 0);
679679 ext4_inode_set_generation(inode, 0);
@@ -737,7 +737,7 @@ int ext4_fs_free_inode(struct ext4_inode_ref *inode_ref) · 57 unmodified lines
737737 uint32_t block_size = ext4_sb_get_block_size(&fs->sb);
738738 uint32_t count = block_size / sizeof(uint32_t);
739739
740− struct ext4_block block;
740+ struct ext4_block block;
741741
742742 /* 2) Double indirect */
743743 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) · 24 unmodified lines
768768 }
769769
770770 /* 3) Tripple indirect */
771− struct ext4_block subblock;
771+ struct ext4_block subblock;
772772 fblock = ext4_inode_get_indirect_block(inode_ref->inode, 2);
773773 if (fblock != 0) {
774774 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, · 196 unmodified lines
971971 return EOK;
972972 }
973973
974− struct ext4_block block;
974+ struct ext4_block block;
975975
976976 /*
977977 * 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, · 87 unmodified lines
10651065
10661066 uint32_t new_block_addr;
10671067
1068− struct ext4_block block;
1069− struct ext4_block new_block;
1068+ struct ext4_block block;
1069+ struct ext4_block new_block;
10701070
10711071 /* Is needed to allocate indirect block on the i-node level */
10721072 if (current_block == 0) {
@@ -1224,7 +1224,7 @@ int ext4_fs_release_inode_block(struct ext4_inode_ref *inode_ref, · 151 unmodified lines
12241224 * Navigate through other levels, until we find the block number
12251225 * or find null reference meaning we are dealing with sparse file
12261226 */
1227− struct ext4_block block;
1227+ struct ext4_block block;
12281228
12291229 while (level > 0) {
12301230
lwext4/ext4_hash.h+8−8
@@ -41,14 +41,14 @@ · 40 unmodified lines
4141
4242 #include <stdint.h>
4343
44−/**@brief Directory entry name hash function.
45− * @param name entry name
46− * @param len entry name length
47− * @param hash_seed (from superblock)
48− * @param hash version (from superblock)
49− * @param hash_minor output value
50− * @param hash_major output value
51− * @return standard error code*/
44+/**@brief Directory entry name hash function.
45+ * @param name entry name
46+ * @param len entry name length
47+ * @param hash_seed (from superblock)
48+ * @param hash version (from superblock)
49+ * @param hash_minor output value
50+ * @param hash_major output value
51+ * @return standard error code*/
5252 int ext2_htree_hash(const char *name, int len,
5353 const uint32_t *hash_seed, int hash_version,
5454 uint32_t *hash_major, uint32_t *hash_minor);
lwext4/ext4_ialloc.c+2−2
@@ -86,7 +86,7 @@ int ext4_ialloc_free_inode(struct ext4_fs *fs, uint32_t index, bool is_dir) · 85 unmodified lines
8686 uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(
8787 bg_ref.block_group, sb);
8888
89− struct ext4_block bitmap_block;
89+ struct ext4_block bitmap_block;
9090 rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
9191 if (rc != EOK)
9292 return rc;
@@ -173,7 +173,7 @@ int ext4_ialloc_alloc_inode(struct ext4_fs *fs, uint32_t *index, bool is_dir) · 80 unmodified lines
173173 uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(
174174 bg_ref.block_group, sb);
175175
176− struct ext4_block bitmap_block;
176+ struct ext4_block bitmap_block;
177177 rc = ext4_block_get(fs->bdev, &bitmap_block, bitmap_block_addr);
178178 if (rc != EOK)
179179 return rc;
lwext4/ext4_inode.c+5−5
@@ -69,7 +69,7 @@ uint32_t ext4_inode_get_mode(struct ext4_sblock *sb, struct ext4_inode *inode) · 68 unmodified lines
6969 return v;
7070 }
7171
72−void ext4_inode_set_mode(struct ext4_sblock *sb, struct ext4_inode *inode,
72+void ext4_inode_set_mode(struct ext4_sblock *sb, struct ext4_inode *inode,
7373 uint32_t mode)
7474 {
7575 inode->mode = to_le16((mode << 16) >> 16);
@@ -83,7 +83,7 @@ uint32_t ext4_inode_get_uid(struct ext4_inode *inode) · 7 unmodified lines
8383 return to_le32(inode->uid);
8484 }
8585
86−void ext4_inode_set_uid(struct ext4_inode *inode, uint32_t uid)
86+void ext4_inode_set_uid(struct ext4_inode *inode, uint32_t uid)
8787 {
8888 inode->uid = to_le32(uid);
8989 }
@@ -154,7 +154,7 @@ uint32_t ext4_inode_get_gid(struct ext4_inode *inode) · 64 unmodified lines
154154 }
155155 void ext4_inode_set_gid(struct ext4_inode *inode, uint32_t gid)
156156 {
157− inode->gid = to_le32(gid);
157+ inode->gid = to_le32(gid);
158158 }
159159
160160 uint16_t ext4_inode_get_links_count(struct ext4_inode *inode)
@@ -234,14 +234,14 @@ uint32_t ext4_inode_get_flags(struct ext4_inode *inode) · 73 unmodified lines
234234 }
235235 void ext4_inode_set_flags(struct ext4_inode *inode, uint32_t flags)
236236 {
237− inode->flags = to_le32(flags);
237+ inode->flags = to_le32(flags);
238238 }
239239
240240 uint32_t ext4_inode_get_generation(struct ext4_inode *inode)
241241 {
242242 return to_le32(inode->generation);
243243 }
244−void ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen)
244+void ext4_inode_set_generation(struct ext4_inode *inode, uint32_t gen)
245245 {
246246 inode->generation = to_le32(gen);
247247 }
lwext4/ext4_super.c+4−4
@@ -59,8 +59,8 @@ uint32_t ext4_block_group_cnt(struct ext4_sblock *s) · 58 unmodified lines
5959 uint32_t ext4_blocks_in_group_cnt(struct ext4_sblock *s, uint32_t bgid)
6060 {
6161 uint32_t block_group_count = ext4_block_group_cnt(s);
62− uint32_t blocks_per_group = ext4_get32(s, blocks_per_group);
63− uint64_t total_blocks = ext4_sb_get_blocks_cnt(s);
62+ uint32_t blocks_per_group = ext4_get32(s, blocks_per_group);
63+ uint64_t total_blocks = ext4_sb_get_blocks_cnt(s);
6464
6565 if (bgid < block_group_count - 1)
6666 return blocks_per_group;
@@ -82,13 +82,13 @@ uint32_t ext4_inodes_in_group_cnt(struct ext4_sblock *s, uint32_t bgid) · 15 unmodified lines
8282 return (total_inodes - ((block_group_count - 1) * inodes_per_group));
8383 }
8484
85−int ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s)
85+int ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s)
8686 {
8787 return ext4_block_writebytes(bdev, EXT4_SUPERBLOCK_OFFSET,
8888 s, EXT4_SUPERBLOCK_SIZE);
8989 }
9090
91−int ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s)
91+int ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s)
9292 {
9393 return ext4_block_readbytes(bdev, EXT4_SUPERBLOCK_OFFSET,
9494 s, EXT4_SUPERBLOCK_SIZE);
lwext4/ext4_super.h+2−2
@@ -165,13 +165,13 @@ uint32_t ext4_inodes_in_group_cnt(struct ext4_sblock *s, uint32_t bgid); · 164 unmodified lines
165165 * @param bdev block device descriptor.
166166 * @param s superblock descruptor
167167 * @return Standard error code */
168−int ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s);
168+int ext4_sb_write(struct ext4_blockdev *bdev, struct ext4_sblock *s);
169169
170170 /**@brief Superblock read.
171171 * @param bdev block device descriptor.
172172 * @param s superblock descruptor
173173 * @return Standard error code */
174−int ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s);
174+int ext4_sb_read(struct ext4_blockdev *bdev, struct ext4_sblock *s);
175175
176176 /**@brief Superblock simple validation.
177177 * @param s superblock dsecriptor
lwext4/ext4_types.h+39−39
@@ -230,8 +230,8 @@ struct ext4_sblock { · 229 unmodified lines
230230 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
231231
232232 struct ext4_fs {
233− struct ext4_blockdev *bdev;
234− struct ext4_sblock sb;
233+ struct ext4_blockdev*bdev;
234+ struct ext4_sblock sb;
235235
236236 uint64_t inode_block_limits[4];
237237 uint64_t inode_blocks_per_level[4];
@@ -270,11 +270,11 @@ struct ext4_bgroup { · 32 unmodified lines
270270 } ;
271271
272272 struct ext4_block_group_ref {
273− struct ext4_block block;
274− struct ext4_bgroup *block_group;
275− struct ext4_fs *fs;
276− uint32_t index;
277− bool dirty;
273+ struct ext4_block block;
274+ struct ext4_bgroup *block_group;
275+ struct ext4_fs *fs;
276+ uint32_t index;
277+ bool dirty;
278278 };
279279
280280 #define EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE 32
@@ -384,8 +384,8 @@ struct ext4_inode { · 103 unmodified lines
384384 #define EXT4_INODE_ROOT_INDEX 2
385385
386386 struct ext4_inode_ref {
387− struct ext4_block block;
388− struct ext4_inode *inode;
387+ struct ext4_block block;
388+ struct ext4_inode *inode;
389389 struct ext4_fs *fs;
390390 uint32_t index;
391391 bool dirty;
@@ -420,15 +420,15 @@ struct ext4_directory_entry_ll { · 28 unmodified lines
420420 } __attribute__((packed)) ;
421421
422422 struct ext4_directory_iterator {
423− struct ext4_inode_ref *inode_ref;
424− struct ext4_block current_block;
425− uint64_t current_offset;
423+ struct ext4_inode_ref *inode_ref;
424+ struct ext4_block current_block;
425+ uint64_t current_offset;
426426 struct ext4_directory_entry_ll *current;
427427 };
428428
429429 struct ext4_directory_search_result {
430− struct ext4_block block;
431− struct ext4_directory_entry_ll *dentry;
430+ struct ext4_block block;
431+ struct ext4_directory_entry_ll *dentry;
432432 };
433433
434434 /* Structures for indexed directory */
@@ -478,7 +478,7 @@ struct ext4_directory_dx_node { · 43 unmodified lines
478478 };
479479
480480 struct ext4_directory_dx_block {
481− struct ext4_block block;
481+ struct ext4_block block;
482482 struct ext4_directory_dx_entry *entries;
483483 struct ext4_directory_dx_entry *position;
484484 } ;
@@ -526,31 +526,31 @@ struct ext4_extent_header { · 41 unmodified lines
526526 } ;
527527
528528 struct ext4_extent_path {
529− struct ext4_block block;
530− uint16_t depth;
529+ struct ext4_block block;
530+ uint16_t depth;
531531 struct ext4_extent_header *header;
532− struct ext4_extent_index *index;
533− struct ext4_extent *extent;
532+ struct ext4_extent_index *index;
533+ struct ext4_extent *extent;
534534 } ;
535535
536536 #define EXT4_EXTENT_MAGIC 0xF30A
537537
538−#define EXT4_EXTENT_FIRST(header) \
538+#define EXT4_EXTENT_FIRST(header) \
539539 ((struct ext4_extent *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
540540
541−#define EXT4_EXTENT_FIRST_INDEX(header) \
541+#define EXT4_EXTENT_FIRST_INDEX(header) \
542542 ((struct ext4_extent_index *) (((void *) (header)) + sizeof(struct ext4_extent_header)))
543543
544544
545545 /* EXT3 HTree directory indexing */
546−#define EXT2_HTREE_LEGACY 0
547−#define EXT2_HTREE_HALF_MD4 1
548−#define EXT2_HTREE_TEA 2
549−#define EXT2_HTREE_LEGACY_UNSIGNED 3
550−#define EXT2_HTREE_HALF_MD4_UNSIGNED 4
551−#define EXT2_HTREE_TEA_UNSIGNED 5
546+#define EXT2_HTREE_LEGACY 0
547+#define EXT2_HTREE_HALF_MD4 1
548+#define EXT2_HTREE_TEA 2
549+#define EXT2_HTREE_LEGACY_UNSIGNED 3
550+#define EXT2_HTREE_HALF_MD4_UNSIGNED 4
551+#define EXT2_HTREE_TEA_UNSIGNED 5
552552
553−#define EXT2_HTREE_EOF 0x7FFFFFFF
553+#define EXT2_HTREE_EOF 0x7FFFFFFF
554554
555555
556556 struct ext4_hash_info {
@@ -578,7 +578,7 @@ static inline uint64_t to_le64(uint64_t n) · 21 unmodified lines
578578
579579 static inline uint32_t to_le32(uint32_t n)
580580 {
581− return ((n & 0xff) << 24) |
581+ return ((n & 0xff) << 24) |
582582 ((n & 0xff00) << 8) |
583583 ((n & 0xff0000) >> 8) |
584584 ((n & 0xff000000) >> 24);
@@ -586,27 +586,27 @@ static inline uint32_t to_le32(uint32_t n) · 1 unmodified line
586586
587587 static inline uint16_t to_le16(uint16_t n)
588588 {
589− return ((n & 0xff) << 8) |
589+ return ((n & 0xff) << 8) |
590590 ((n & 0xff00) >> 8);
591591 }
592592
593593
594594 #else
595−#define to_le64(_n) _n
596−#define to_le32(_n) _n
597−#define to_le16(_n) _n
595+#define to_le64(_n) _n
596+#define to_le32(_n) _n
597+#define to_le16(_n) _n
598598 #endif
599599
600600 /****************************Access macros to ext4 structures*****************/
601601
602−#define ext4_get32(s, f) to_le32((s)->f)
603−#define ext4_get16(s, f) to_le16((s)->f)
604−#define ext4_get8(s, f) (s)->f
602+#define ext4_get32(s, f) to_le32((s)->f)
603+#define ext4_get16(s, f) to_le16((s)->f)
604+#define ext4_get8(s, f) (s)->f
605605
606606
607−#define ext4_set32(s, f, v) do { (s)->f = to_le32(v); }while(0)
608−#define ext4_set16(s, f, v) do { (s)->f = to_le16(v); }while(0)
609−#define ext4_set8 (s, f, v) do { (s)->f = (v); }while(0)
607+#define ext4_set32(s, f, v) do { (s)->f = to_le32(v); }while(0)
608+#define ext4_set16(s, f, v) do { (s)->f = to_le16(v); }while(0)
609+#define ext4_set8 (s, f, v) do { (s)->f = (v); }while(0)
610610
611611 #endif /* EXT4_TYPES_H_ */
612612
readme.txt+4−4
@@ -53,7 +53,7 @@ FEATURE_INCOMPAT (able to mount with unsupported feature): · 52 unmodified lines
5353 - DIR_PREALLOC: no
5454 - IMAGIC_INODES: no
5555 - HAS_JOURNAL: no
56− - EXT_ATTR: no
56+ - EXT_ATTR: no
5757 - RESIZE_INODE: no
5858 - DIR_INDEX: yes
5959
@@ -67,8 +67,8 @@ FEATURE_RO (able to mount in read only with unsupported feature): · 7 unmodified lines
6767 - EXTRA_ISIZE: yes
6868
6969 Supported filetypes:
70− - FIFO: no
71− - CHARDEV: no
70+ - FIFO: no
71+ - CHARDEV: no
7272 - DIRECTORY: yes
7373 - BLOCKDEV: no
7474 - FILE: yes
@@ -94,7 +94,7 @@ lwext4 project tree · 19 unmodified lines
9494
9595 +toolchain - specific toolchain cmake files
9696
97−+ext4.h - lwext4 client library header
97++ext4.h - lwext4 client library header
9898 CMakeLists.txt - CMake config file
9999 ext_images.7z - ext2/3/4 100MB images
100100 Makefile - helper makefile to call cmake
toolchain/bf518.cmake+7−12
@@ -3,20 +3,15 @@ SET(CMAKE_SYSTEM_NAME Generic) · 2 unmodified lines
33 set(CMAKE_SYSTEM_PROCESSOR bf518)
44
55 # Toolchain settings
6−set(CMAKE_C_COMPILER bfin-elf-gcc)
7−set(CMAKE_CXX_COMPILER bfin-elf-g++)
6+set(CMAKE_C_COMPILER bfin-elf-gcc)
7+set(CMAKE_CXX_COMPILER bfin-elf-g++)
88 set(AS bfin-elf--gcc)
9−set(AR bfin-elf-ar)
10−set(OBJCOPY bfin-elf-objcopy)
11−set(OBJDUMP bfin-elf-objdump)
9+set(AR bfin-elf-ar)
10+set(OBJCOPY bfin-elf-objcopy)
11+set(OBJDUMP bfin-elf-objdump)
1212 set(SIZE bfin-elf-size)
1313
14−set(CMAKE_C_FLAGS "-mcpu=bf518 -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
15−set(CMAKE_CXX_FLAGS "-mcpu=bf518 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
14+set(CMAKE_C_FLAGS "-mcpu=bf518 -Os -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
15+set(CMAKE_CXX_FLAGS "-mcpu=bf518 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
1616 set(CMAKE_ASM_FLAGS "-mcpu=bf518 -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
1717 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mcpu=bf592" CACHE INTERNAL "exe link flags")
18−
19−
20−
21−
22−
toolchain/cortex-m3.cmake+8−8
@@ -3,16 +3,16 @@ SET(CMAKE_SYSTEM_NAME Generic) · 2 unmodified lines
33 set(CMAKE_SYSTEM_PROCESSOR cortex-m3)
44
55 # Toolchain settings
6−set(CMAKE_C_COMPILER arm-none-eabi-gcc)
7−set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
8−set(AS arm-none-eabi-as)
9−set(AR arm-none-eabi-ar)
10−set(OBJCOPY arm-none-eabi-objcopy)
11−set(OBJDUMP arm-none-eabi-objdump)
6+set(CMAKE_C_COMPILER arm-none-eabi-gcc)
7+set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
8+set(AS arm-none-eabi-as)
9+set(AR arm-none-eabi-ar)
10+set(OBJCOPY arm-none-eabi-objcopy)
11+set(OBJDUMP arm-none-eabi-objdump)
1212 set(SIZE arm-none-eabi-size)
1313
14−set(CMAKE_C_FLAGS "-mthumb -mcpu=cortex-m3 -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
15−set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m3 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
14+set(CMAKE_C_FLAGS "-mthumb -mcpu=cortex-m3 -Os -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
15+set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m3 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
1616 set(CMAKE_ASM_FLAGS "-mthumb -mcpu=cortex-m3" CACHE INTERNAL "asm compiler flags")
1717 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mthumb -mcpu=cortex-m3" CACHE INTERNAL "exe link flags")
1818
toolchain/cortex-m4.cmake+8−8
@@ -3,16 +3,16 @@ SET(CMAKE_SYSTEM_NAME Generic) · 2 unmodified lines
33 set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
44
55 # Toolchain settings
6−set(CMAKE_C_COMPILER arm-none-eabi-gcc)
7−set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
8−set(AS arm-none-eabi-as)
9−set(AR arm-none-eabi-ar)
10−set(OBJCOPY arm-none-eabi-objcopy)
11−set(OBJDUMP arm-none-eabi-objdump)
6+set(CMAKE_C_COMPILER arm-none-eabi-gcc)
7+set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
8+set(AS arm-none-eabi-as)
9+set(AR arm-none-eabi-ar)
10+set(OBJCOPY arm-none-eabi-objcopy)
11+set(OBJDUMP arm-none-eabi-objdump)
1212 set(SIZE arm-none-eabi-size)
1313
14−set(CMAKE_C_FLAGS "-mthumb -mcpu=cortex-m4 -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
15−set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m4 -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
14+set(CMAKE_C_FLAGS "-mthumb -mcpu=cortex-m4 -Os -fno-builtin -Wall -std=gnu99 -fdata-sections -ffunction-sections" CACHE INTERNAL "c compiler flags")
15+set(CMAKE_CXX_FLAGS "-mthumb -mcpu=cortex-m4 -Os -fno-builtin -Wall -fdata-sections -ffunction-sections" CACHE INTERNAL "cxx compiler flags")
1616 set(CMAKE_ASM_FLAGS "-mthumb -mcpu=cortex-m4" CACHE INTERNAL "asm compiler flags")
1717 set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -Wl,--gc-sections -mthumb -mcpu=cortex-m4" CACHE INTERNAL "exe link flags")
1818

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t