littlefs-project / littlefs

A little fail-safe filesystem designed for microcontrollers
BSD 3-Clause "New" or "Revised" License
4.92k stars 774 forks source link

Option to remove directory support #900

Open wync140 opened 7 months ago

wync140 commented 7 months ago

A very nice feature for code space constrained targets would be being able to remove directory support. Many targets do not need any directories beyond root. If the directory support could be removed the code space could be shrunk by a good amount.

geky commented 7 months ago

Hi @wync140, thanks for creating an issue.

This has been raised before, and would be a good to explore, but it's been low priority.

I think the code savings would be smaller than expected. You can't get rid of the root directory, so much of the directory logic would still be needed. And lfs_mkdir is standalone so it should already be dropped if you compile with --gc-sections and don't call the function.

At best it could remove quite a bit of logic from lfs_dir_find, but that's currently only a 392 byte function.

Still, it would be worthwhile to explore at some point.