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

initlize struct lfs_diskoff disk = {0} #855

Closed mdahamshi closed 10 months ago

mdahamshi commented 1 year ago

so we don't use it uninitlized in first run

geky-bot commented 1 year ago
Tests passed ✓, Code: 16678 B (+0.1%), Stack: 1432 B (+0.0%), Structs: 788 B (+0.0%) | | Code | Stack | Structs | | Coverage | |:--|-----:|------:|--------:|:--|---------:| | Default | 16678 B (+0.1%) | 1432 B (+0.0%) | 788 B (+0.0%) | Lines | 2316/2496 lines (+0.0%) | | Readonly | 6126 B (+0.0%) | 448 B (+0.0%) | 788 B (+0.0%) | Branches | 1184/1506 branches (-0.0%) | | Threadsafe | 17506 B (+0.1%) | 1432 B (+0.0%) | 796 B (+0.0%) | | **Benchmarks** | | Multiversion | 16754 B (+0.1%) | 1432 B (+0.0%) | 792 B (+0.0%) | Readed | 29369693876 B (+0.0%) | | Migrate | 18362 B (+0.1%) | 1736 B (+0.0%) | 792 B (+0.0%) | Proged | 1482874766 B (+0.0%) | | Error-asserts | 17310 B (+0.0%) | 1424 B (+0.0%) | 788 B (+0.0%) | Erased | 1568888832 B (+0.0%) |
geky commented 11 months ago

Hi @mdahamshi, thanks for creating a PR.

It's worth noting that this struct does not get used unless the top-bit of the tag is set, which only happens when we initialize the struct's contents.

But we can bring this in to at least silence the warning.

geky-bot commented 11 months ago
Tests passed ✓, Code: 16678 B (+0.1%), Stack: 1432 B (+0.0%), Structs: 788 B (+0.0%) | | Code | Stack | Structs | | Coverage | |:--|-----:|------:|--------:|:--|---------:| | Default | 16678 B (+0.1%) | 1432 B (+0.0%) | 788 B (+0.0%) | Lines | 2316/2496 lines (+0.0%) | | Readonly | 6126 B (+0.0%) | 448 B (+0.0%) | 788 B (+0.0%) | Branches | 1184/1506 branches (-0.0%) | | Threadsafe | 17506 B (+0.1%) | 1432 B (+0.0%) | 796 B (+0.0%) | | **Benchmarks** | | Multiversion | 16754 B (+0.1%) | 1432 B (+0.0%) | 792 B (+0.0%) | Readed | 29369693876 B (+0.0%) | | Migrate | 18362 B (+0.1%) | 1736 B (+0.0%) | 792 B (+0.0%) | Proged | 1482874766 B (+0.0%) | | Error-asserts | 17310 B (+0.0%) | 1424 B (+0.0%) | 788 B (+0.0%) | Erased | 1568888832 B (+0.0%) |
geky commented 10 months ago

Thanks again for this, and everyone else who reported/proposed a fix. Sorry about taking so long to merge. There was some integration issues in the dependent littlefs-fuse I wanted to fix before making another release.