Skip to content

wrapper SDFS.info(FSInfo& info) is overflowed for SD Cards > 4GB #6082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luc-github opened this issue May 13, 2019 · 1 comment · Fixed by #6154
Closed

wrapper SDFS.info(FSInfo& info) is overflowed for SD Cards > 4GB #6082

luc-github opened this issue May 13, 2019 · 1 comment · Fixed by #6154
Assignees
Milestone

Comments

@luc-github
Copy link
Contributor

Basic Infos

  • [ x] This issue complies with the issue POLICY doc.
  • [ x] I have read the documentation at readthedocs and the issue is not addressed there.
  • [x ] I have tested that the issue is present in current master branch (aka latest git).
  • [x ] I have searched the issue tracker for a similar issue.
  • [ x] If there is a stack dump, I have decoded it.
  • [x ] I have filled out all fields below.

Platform

  • Hardware: ESP-12
  • Core Version: latest git / 2.5.1
  • Development Env: Arduino IDE
  • Operating System: Windows

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: ck
  • Flash Frequency: 40Mhz
  • CPU Frequency: 160MHz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Because storage is using size_t instead of uint64_t so size over 4GB are incorrects
size_t is ok for SPIFFS, which is the original usage for info(FSInfo& info), but now if used on SD in must be uint64_t for SD, but this may lead to some others compatibilities issues if used on SPIFFS, because lot of functions currently use size_t and several others does not support uint64_t.

FYR On ESP32 the struct usage originaly done to add additional parameters in transparent way was dropped to use independant functions instead, each one using proper type :
SPIFFS:

class SPIFFSFS : public FS
{
...
    size_t totalBytes();
    size_t usedBytes();

For SDFS:

class SDFS : 
....
sdcard_type_t cardType();
uint64_t cardSize();
uint64_t totalBytes();
uint64_t usedBytes();

Sorry I do not have solution to offer because this issue need a mitigation between compatibility and features.
But I hope it give clear base description to help for a decision.

@earlephilhower earlephilhower added this to the 2.6.0 milestone May 13, 2019
@earlephilhower
Copy link
Collaborator

earlephilhower commented May 13, 2019

I see two options:
. fsinfo64 (and make fsinfo entries return min(MAX_SIZE_T, fsinfo64().field)`
. No need to preserve binary size/ABI, only source, so change them to uint64_t

@d-a-v, @devyte, thoughts?

@earlephilhower earlephilhower self-assigned this May 13, 2019
earlephilhower added a commit to earlephilhower/Arduino that referenced this issue May 27, 2019
Fixes esp8266#6082

Add an info64() call which returns used and total sizes as 64 bit
quantities.  A default wrapper that just copies the 32-bit values is
included for LittleFS/SPIFFS which can't hit those capacities.
earlephilhower added a commit that referenced this issue May 30, 2019
Fixes #6082

Add an info64() call which returns used and total sizes as 64 bit
quantities.  A default wrapper that just copies the 32-bit values is
included for LittleFS/SPIFFS which can't hit those capacities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants