@@ -94,7 +94,7 @@ class SDFSImpl : public FSImpl
9494
9595 FileImplPtr open (const char * path, OpenMode openMode, AccessMode accessMode) override ;
9696
97- bool exists (const char * path) {
97+ bool exists (const char * path) override {
9898 return _mounted ? _fs.exists (path) : false ;
9999 }
100100
@@ -104,7 +104,7 @@ class SDFSImpl : public FSImpl
104104 return _mounted ? _fs.rename (pathFrom, pathTo) : false ;
105105 }
106106
107- bool info (FSInfo & info) override {
107+ bool info64 (FSInfo64 & info) override {
108108 if (!_mounted) {
109109 DEBUGV (" SDFS::info: FS not mounted\n " );
110110 return false ;
@@ -113,8 +113,28 @@ class SDFSImpl : public FSImpl
113113 info.blockSize = _fs.vol ()->blocksPerCluster () * 512 ;
114114 info.pageSize = 0 ; // TODO ?
115115 info.maxPathLength = 255 ; // TODO ?
116- info.totalBytes =_fs.vol ()->volumeBlockCount () * 512 ;
117- info.usedBytes = info.totalBytes - (_fs.vol ()->freeClusterCount () * _fs.vol ()->blocksPerCluster () * 512 );
116+ info.totalBytes =_fs.vol ()->volumeBlockCount () * 512LL ;
117+ info.usedBytes = info.totalBytes - (_fs.vol ()->freeClusterCount () * _fs.vol ()->blocksPerCluster () * 512LL );
118+ return true ;
119+ }
120+
121+ bool info (FSInfo& info) override {
122+ FSInfo64 i;
123+ if (!info64 (i)) {
124+ return false ;
125+ }
126+ info.blockSize = i.blockSize ;
127+ info.pageSize = i.pageSize ;
128+ info.maxOpenFiles = i.maxOpenFiles ;
129+ info.maxPathLength = i.maxPathLength ;
130+ #ifdef DEBUG_ESP_PORT
131+ if (i.totalBytes > (uint64_t )SIZE_MAX) {
132+ // This catches both total and used cases, since used must always be < total.
133+ DEBUG_ESP_PORT.printf_P (PSTR (" WARNING: SD card size overflow (%lld>= 4GB). Please update source to use info64().\n " ), i.totalBytes );
134+ }
135+ #endif
136+ info.totalBytes = (size_t )i.totalBytes ;
137+ info.usedBytes = (size_t )i.usedBytes ;
118138 return true ;
119139 }
120140
0 commit comments