littlefs icon indicating copy to clipboard operation
littlefs copied to clipboard

Support attribute enumeration for files and directories

Open mikee47 opened this issue 3 years ago • 5 comments

This PR provides some additional attribute enumeration features.

  • Add lfs_statcfg, lfs_dir_readcfg functions

    Extends regular lfs_stat by querying set of attribute at the same time. Improves performance when generating directory listings.

  • Add lfs_file_getattr, lfs_file_setattr, lfs_file_removeattr

    Supports attribute manipulation on open files. Important for updating things like security descriptors, timestamps, etc.

    Note: Includes checks for registered attributes. Attempting to remove registered attributes fails. This could be handled by marking registered attribute as dirty.

  • Add lfs_file_enumattr() function

    Allows file attributes to be efficiently enumerated, required for filesystem backup, etc.

  • Support opening handle to directory

    Allows attributes to be accessed more efficiently, and enumerated

mikee47 avatar Jan 29 '22 11:01 mikee47

Note: These changes are part of the Sming LittleFS library, used by Sming.

mikee47 avatar Feb 19 '22 08:02 mikee47

look like some feature is also implemented in: https://github.com/littlefs-project/littlefs/pull/636

xiaoxiang781216 avatar Apr 11 '22 03:04 xiaoxiang781216

Hi, yes, sorry this PR did not go in this release, due to time I was only looking at PRs with smaller scopes this release. I'm slow to bring in new APIs since they need to be supported for quite a while for backwards compatibility reasons.

This looks like a very interesting PR, thank @mikee47 for putting it together.

In particular I will need to see how it interacts with https://github.com/littlefs-project/littlefs/pull/580 and https://github.com/littlefs-project/littlefs/pull/513 (though https://github.com/littlefs-project/littlefs/pull/513 may come in much later due to being an API breaking change)

geky avatar Apr 14 '22 02:04 geky