Dropped LFSR_TYPE_UNKNOWN
Returning the actual on-disk file type is probably more useful for users
as this gives them more information.
I was originally concerned about collisions with future internal types,
LFS_TYPE_TRAVERSAL, etc, needed for internal opened-list tracking, but
it turns out we can avoid problems by starting internal types at 0x80,
since on-disk file types are only 7-bits.
Code changes:
code stack
before: 33710 2592
after: 33694 (-0.0%) 2592 (+0.0%)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user