@@ -196,6 +196,10 @@ class FatVolume {
196
196
uint32_t dataStartBlock () const {
197
197
return m_dataStartBlock;
198
198
}
199
+ /* * \return The sector number for the start of file data. */
200
+ uint32_t dataStartSector () const {
201
+ return m_dataStartBlock;
202
+ }
199
203
/* * \return The number of File Allocation Tables. */
200
204
uint8_t fatCount () {
201
205
return 2 ;
@@ -204,6 +208,10 @@ class FatVolume {
204
208
uint32_t fatStartBlock () const {
205
209
return m_fatStartBlock;
206
210
}
211
+ /* * \return The sector number for the start of the first FAT. */
212
+ uint32_t fatStartSector () const {
213
+ return m_fatStartBlock;
214
+ }
207
215
/* * \return The FAT type of the volume. Values are 12, 16 or 32. */
208
216
uint8_t fatType () const {
209
217
return m_fatType;
@@ -233,6 +241,10 @@ class FatVolume {
233
241
* the value false is returned for failure.
234
242
*/
235
243
bool init (uint8_t part);
244
+ /* * \return The cluster number of last cluster in the volume. */
245
+ uint32_t lastCluster () const {
246
+ return m_lastCluster;
247
+ }
236
248
/* * \return The number of entries in the root directory for FAT16 volumes. */
237
249
uint16_t rootDirEntryCount () const {
238
250
return m_rootDirEntryCount;
@@ -242,10 +254,18 @@ class FatVolume {
242
254
uint32_t rootDirStart () const {
243
255
return m_rootDirStart;
244
256
}
257
+ /* * \return The volume's cluster size in sectors. */
258
+ uint8_t sectorsPerCluster () const {
259
+ return m_blocksPerCluster;
260
+ }
245
261
/* * \return The number of blocks in the volume */
246
262
uint32_t volumeBlockCount () const {
247
263
return blocksPerCluster ()*clusterCount ();
248
264
}
265
+ /* * \return The number of sectors in the volume */
266
+ uint32_t volumeSectorCount () const {
267
+ return sectorsPerCluster ()*clusterCount ();
268
+ }
249
269
/* * Wipe all data from the volume.
250
270
* \param[in] pr print stream for status dots.
251
271
* \return true for success else false.
@@ -357,7 +377,8 @@ class FatVolume {
357
377
}
358
378
// ------------------------------------------------------------------------------
359
379
bool allocateCluster (uint32_t current, uint32_t * next);
360
- bool allocContiguous (uint32_t count, uint32_t * firstCluster);
380
+ bool allocContiguous (uint32_t count,
381
+ uint32_t * firstCluster, uint32_t startCluster = 0 );
361
382
uint8_t blockOfCluster (uint32_t position) const {
362
383
return (position >> 9 ) & m_clusterBlockMask;
363
384
}
0 commit comments