Skip to content

Commit b82cfcc

Browse files
authored
Merge pull request #11193 from michalpasztamobica/fat_stat
FATFileSystem::stat() enabled for all compilers
2 parents 8767ab4 + 406fcdc commit b82cfcc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

features/storage/TESTS/filesystem/fat_filesystem/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ void test_read_write()
8282
err = file.close();
8383
TEST_ASSERT_EQUAL(0, err);
8484

85+
struct stat st;
86+
err = fs.stat("test_read_write.dat", &st);
87+
TEST_ASSERT_EQUAL(TEST_SIZE, st.st_size);
88+
8589
err = file.open(&fs, "test_read_write.dat", O_RDONLY);
8690
TEST_ASSERT_EQUAL(0, err);
8791
size = file.read(buffer, TEST_SIZE);

features/storage/filesystem/fat/FATFileSystem.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,15 +517,12 @@ int FATFileSystem::stat(const char *path, struct stat *st)
517517
return fat_error_remap(res);
518518
}
519519

520-
/* ARMCC doesnt support stat(), and these symbols are not defined by the toolchain. */
521-
#ifdef TOOLCHAIN_GCC
522520
st->st_size = f.fsize;
523521
st->st_mode = 0;
524522
st->st_mode |= (f.fattrib & AM_DIR) ? S_IFDIR : S_IFREG;
525523
st->st_mode |= (f.fattrib & AM_RDO) ?
526524
(S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) :
527525
(S_IRWXU | S_IRWXG | S_IRWXO);
528-
#endif /* TOOLCHAIN_GCC */
529526
unlock();
530527

531528
return 0;

0 commit comments

Comments
 (0)