@@ -94,7 +94,7 @@ class SDFSImpl : public FSImpl
94
94
95
95
FileImplPtr open (const char * path, OpenMode openMode, AccessMode accessMode) override ;
96
96
97
- bool exists (const char * path) {
97
+ bool exists (const char * path) override {
98
98
return _mounted ? _fs.exists (path) : false ;
99
99
}
100
100
@@ -104,7 +104,7 @@ class SDFSImpl : public FSImpl
104
104
return _mounted ? _fs.rename (pathFrom, pathTo) : false ;
105
105
}
106
106
107
- bool info (FSInfo & info) override {
107
+ bool info64 (FSInfo64 & info) override {
108
108
if (!_mounted) {
109
109
DEBUGV (" SDFS::info: FS not mounted\n " );
110
110
return false ;
@@ -113,8 +113,28 @@ class SDFSImpl : public FSImpl
113
113
info.blockSize = _fs.vol ()->blocksPerCluster () * 512 ;
114
114
info.pageSize = 0 ; // TODO ?
115
115
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 ;
118
138
return true ;
119
139
}
120
140
0 commit comments