littlefs-project / littlefs

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

Mounting a loop device from c. #944

Open shalevv123 opened 4 months ago

shalevv123 commented 4 months ago

Does littleFS c interface support mounting a loop device to a directory? Somewhat like how you would mount a device in Linux using the mount function. I know that littleFS-fuse does something similar but is there a support for this behavior without having to copy selected functions from the littleFS-fuse repo?

geky commented 4 months ago

I'm not really sure why this hasn't crossed my mind before. It would be easy enough to move lfs_fuse_bd into this repo (lfs_blkbd?).

The only concern is dealing with too many OS idiosyncrasies, but I guess with lfs_filebd already containing untestable Windows stuff the cat's already out of the bag.

If people want additional block devices specific to embedded OSes, for example, things can explode quickly. Though if there's interest in that we could make a separate repo to collect various bd impls.


Just to be clear, lfs_filebd and lfs_fuse_bd are basically the same, just with lfs_fuse_bd infering the block size/count via ioctl + BLKSSZGET + BLKGETSIZE64.