Skip to content

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

Closed
@luc-github

Description

@luc-github

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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions