diff --git a/lfs.c b/lfs.c index 9fa01993..b8dbc755 100644 --- a/lfs.c +++ b/lfs.c @@ -9607,11 +9607,7 @@ static int lfsr_stat_(lfs_t *lfs, const lfsr_mdir_t *mdir, lfsr_tag_t tag, lfsr_data_t name, struct lfs_info *info) { // get file type from the tag - if (tag == LFSR_TAG_REG || tag == LFSR_TAG_DIR) { - info->type = lfsr_tag_subtype(tag); - } else { - info->type = LFS_TYPE_UNKNOWN; - } + info->type = lfsr_tag_subtype(tag); // read the file name LFS_ASSERT(lfsr_data_size(name) <= LFS_NAME_MAX); diff --git a/lfs.h b/lfs.h index 8c22b885..1f2804c8 100644 --- a/lfs.h +++ b/lfs.h @@ -114,7 +114,6 @@ enum lfs_error { // File types enum lfs_type { // file types - LFS_TYPE_UNKNOWN = 0, LFS_TYPE_REG = 1, LFS_TYPE_DIR = 2, diff --git a/tests/test_incompat.toml b/tests/test_incompat.toml index 6e24febd..de053c3d 100644 --- a/tests/test_incompat.toml +++ b/tests/test_incompat.toml @@ -359,11 +359,11 @@ code = ''' // mount lfsr_mount(&lfs, CFG) => 0; - // our file should appear as unknown + // our file should appear as an unknown type struct lfs_info info; lfsr_stat(&lfs, "b", &info) => 0; assert(strcmp(info.name, "b") == 0); - assert(info.type == LFS_TYPE_UNKNOWN); + assert(info.type == 0x13); assert(info.size == 0); lfsr_dir_t dir; @@ -382,7 +382,7 @@ code = ''' assert(info.size == strlen("hi a!")); lfsr_dir_read(&lfs, &dir, &info) => 0; assert(strcmp(info.name, "b") == 0); - assert(info.type == LFS_TYPE_UNKNOWN); + assert(info.type == 0x13); assert(info.size == 0); lfsr_dir_read(&lfs, &dir, &info) => 0; assert(strcmp(info.name, "c") == 0);