Integration class for the FatLib library.
More...
#include <FatVolume.h>
|
int | attrib (const char *path) |
|
bool | attrib (const char *path, uint8_t bits) |
|
bool | begin (FsBlockDevice *dev, bool setCwv=true, uint8_t part=1, uint32_t volStart=0) |
|
uint16_t | bytesPerCluster () const |
|
uint8_t | bytesPerClusterShift () const |
|
uint16_t | bytesPerSector () const |
|
uint8_t | bytesPerSectorShift () const |
|
uint8_t * | cacheClear () |
|
bool | chdir () |
|
bool | chdir (const char *path) |
|
bool | chdir (const String &path) |
|
void | chvol () |
|
uint32_t | clusterCount () const |
|
uint32_t | dataStartSector () const |
|
int8_t | dbgFat (uint32_t n, uint32_t *v) |
|
uint16_t | dirEntriesPerCluster () const |
|
uint8_t * | end () |
|
bool | exists (const char *path) |
|
bool | exists (const String &path) |
|
uint8_t | fatCount () const |
|
uint32_t | fatStartSector () const |
|
uint8_t | fatType () const |
|
int32_t | freeClusterCount () |
|
bool | init (FsBlockDevice *dev, uint8_t part=1, uint32_t volStart=0) |
|
bool | isBusy () |
|
bool | ls (const char *path, uint8_t flags=0) |
|
bool | ls (print_t *pr, const char *path, uint8_t flags) |
|
bool | ls (print_t *pr, uint8_t flags=0) |
|
bool | ls (uint8_t flags=0) |
|
bool | mkdir (const char *path, bool pFlag=true) |
|
bool | mkdir (const String &path, bool pFlag=true) |
|
File32 | open (const char *path, oflag_t oflag=0X00) |
|
File32 | open (const String &path, oflag_t oflag=0X00) |
|
bool | remove (const char *path) |
|
bool | remove (const String &path) |
|
bool | rename (const char *oldPath, const char *newPath) |
|
bool | rename (const String &oldPath, const String &newPath) |
|
bool | rmdir (const char *path) |
|
bool | rmdir (const String &path) |
|
uint16_t | rootDirEntryCount () const |
|
uint32_t | rootDirStart () const |
|
uint16_t | sectorMask () const |
|
uint8_t | sectorsPerCluster () const |
|
uint8_t | sectorsPerClusterShift () const |
|
uint32_t | sectorsPerFat () const |
|
bool | truncate (const char *path, uint32_t length) |
|
bool | truncate (const String &path, uint32_t length) |
|
uint32_t | volumeSectorCount () const |
|
Integration class for the FatLib library.
◆ attrib() [1/2]
int FatVolume::attrib |
( |
const char * |
path | ) |
|
|
inline |
Get file's user settable attributes.
- Parameters
-
- Returns
- user settable file attributes for success else -1.
◆ attrib() [2/2]
bool FatVolume::attrib |
( |
const char * |
path, |
|
|
uint8_t |
bits |
|
) |
| |
|
inline |
Set file's user settable attributes.
- Parameters
-
[in] | path | path to file. |
[in] | bits | bit-wise or of selected attributes: FS_ATTRIB_READ_ONLY, FS_ATTRIB_HIDDEN, FS_ATTRIB_SYSTEM, FS_ATTRIB_ARCHIVE. |
- Returns
- true for success or false for failure.
◆ begin()
bool FatVolume::begin |
( |
FsBlockDevice * |
dev, |
|
|
bool |
setCwv = true , |
|
|
uint8_t |
part = 1 , |
|
|
uint32_t |
volStart = 0 |
|
) |
| |
|
inline |
Initialize an FatVolume object.
- Parameters
-
[in] | dev | Device block driver. |
[in] | setCwv | Set current working volume if true. |
[in] | part | partition to initialize. |
[in] | volStart | Start sector of volume if part is zero. |
- Returns
- true for success or false for failure.
◆ bytesPerCluster()
uint16_t FatPartition::bytesPerCluster |
( |
| ) |
const |
|
inlineinherited |
- Returns
- Number of bytes in a cluster.
◆ bytesPerClusterShift()
uint8_t FatPartition::bytesPerClusterShift |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The shift count required to multiply by bytesPerCluster.
◆ bytesPerSector()
uint16_t FatPartition::bytesPerSector |
( |
| ) |
const |
|
inlineinherited |
- Returns
- Number of bytes per sector.
◆ bytesPerSectorShift()
uint8_t FatPartition::bytesPerSectorShift |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The shift count required to multiply by bytesPerCluster.
◆ cacheClear()
uint8_t * FatPartition::cacheClear |
( |
| ) |
|
|
inlineinherited |
Clear the cache and returns a pointer to the cache. Not for normal apps.
- Returns
- A pointer to the cache buffer or zero if an error occurs.
◆ chdir() [1/3]
bool FatVolume::chdir |
( |
| ) |
|
|
inline |
Set volume working directory to root.
- Returns
- true for success or false for failure.
◆ chdir() [2/3]
bool FatVolume::chdir |
( |
const char * |
path | ) |
|
Set volume working directory.
- Parameters
-
[in] | path | Path for volume working directory. |
- Returns
- true for success or false for failure.
◆ chdir() [3/3]
bool FatVolume::chdir |
( |
const String & |
path | ) |
|
|
inline |
Set volume working directory.
- Parameters
-
[in] | path | Path for volume working directory. |
- Returns
- true for success or false for failure.
◆ chvol()
void FatVolume::chvol |
( |
| ) |
|
|
inline |
Change global current working volume to this volume.
◆ clusterCount()
uint32_t FatPartition::clusterCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The total number of clusters in the volume.
◆ dataStartSector()
uint32_t FatPartition::dataStartSector |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The logical sector number for the start of file data.
◆ dbgFat()
int8_t FatPartition::dbgFat |
( |
uint32_t |
n, |
|
|
uint32_t * |
v |
|
) |
| |
|
inlineinherited |
Debug access to FAT table
- Parameters
-
[in] | n | cluster number. |
[out] | v | value of entry |
- Returns
- -1 error, 0 EOC, else 1.
◆ dirEntriesPerCluster()
uint16_t FatPartition::dirEntriesPerCluster |
( |
| ) |
const |
|
inlineinherited |
- Returns
- Number of directory entries per sector.
◆ end()
uint8_t * FatPartition::end |
( |
| ) |
|
|
inlineinherited |
End access to volume
- Returns
- pointer to sector size buffer for format.
◆ exists() [1/2]
bool FatVolume::exists |
( |
const char * |
path | ) |
|
|
inline |
Test for the existence of a file.
- Parameters
-
[in] | path | Path of the file to be tested for. |
- Returns
- true if the file exists else false.
◆ exists() [2/2]
bool FatVolume::exists |
( |
const String & |
path | ) |
|
|
inline |
Test for the existence of a file.
- Parameters
-
[in] | path | Path of the file to be tested for. |
- Returns
- true if the file exists else false.
◆ fatCount()
uint8_t FatPartition::fatCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of File Allocation Tables.
◆ fatStartSector()
uint32_t FatPartition::fatStartSector |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The logical sector number for the start of the first FAT.
◆ fatType()
uint8_t FatPartition::fatType |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The FAT type of the volume. Values are 12, 16 or 32.
◆ freeClusterCount()
int32_t FatPartition::freeClusterCount |
( |
| ) |
|
|
inherited |
- Returns
- free cluster count or -1 if an error occurs.
◆ init()
bool FatPartition::init |
( |
FsBlockDevice * |
dev, |
|
|
uint8_t |
part = 1 , |
|
|
uint32_t |
volStart = 0 |
|
) |
| |
|
inherited |
Initialize a FAT partition.
- Parameters
-
[in] | dev | FsBlockDevice for this partition. |
[in] | part | The partition to be used. Legal values for part are 1-4 to use the corresponding partition on a device formatted with a MBR, Master Boot Record, or zero if the device is formatted as a super floppy with the FAT boot sector in sector volStart. |
[in] | volStart | location of volume if part is zero. |
- Returns
- true for success or false for failure.
◆ isBusy()
bool FatPartition::isBusy |
( |
| ) |
|
|
inlineinherited |
Check for FsBlockDevice busy.
- Returns
- true if busy else false.
◆ ls() [1/4]
bool FatVolume::ls |
( |
const char * |
path, |
|
|
uint8_t |
flags = 0 |
|
) |
| |
|
inline |
List the directory contents of a directory to Serial.
- Parameters
-
[in] | path | directory to list. |
[in] | flags | The inclusive OR of |
LS_DATE - Print file modification date
LS_SIZE - Print file size.
LS_R - Recursive list of subdirectories.
- Returns
- true for success or false for failure.
◆ ls() [2/4]
bool FatVolume::ls |
( |
print_t * |
pr, |
|
|
const char * |
path, |
|
|
uint8_t |
flags |
|
) |
| |
|
inline |
List the contents of a directory.
- Parameters
-
[in] | pr | Print stream for list. |
[in] | path | directory to list. |
[in] | flags | The inclusive OR of |
LS_DATE - Print file modification date
LS_SIZE - Print file size.
LS_R - Recursive list of subdirectories.
- Returns
- true for success or false for failure.
◆ ls() [3/4]
bool FatVolume::ls |
( |
print_t * |
pr, |
|
|
uint8_t |
flags = 0 |
|
) |
| |
|
inline |
List the directory contents of the volume root directory.
- Parameters
-
[in] | pr | Print stream for list. |
[in] | flags | The inclusive OR of |
LS_DATE - Print file modification date
LS_SIZE - Print file size.
LS_R - Recursive list of subdirectories.
- Returns
- true for success or false for failure.
◆ ls() [4/4]
bool FatVolume::ls |
( |
uint8_t |
flags = 0 | ) |
|
|
inline |
List the directory contents of the root directory to Serial.
- Parameters
-
[in] | flags | The inclusive OR of |
LS_DATE - Print file modification date
LS_SIZE - Print file size.
LS_R - Recursive list of subdirectories.
- Returns
- true for success or false for failure.
◆ mkdir() [1/2]
bool FatVolume::mkdir |
( |
const char * |
path, |
|
|
bool |
pFlag = true |
|
) |
| |
|
inline |
Make a subdirectory in the volume root directory.
- Parameters
-
[in] | path | A path with a valid name for the subdirectory. |
[in] | pFlag | Create missing parent directories if true. |
- Returns
- true for success or false for failure.
◆ mkdir() [2/2]
bool FatVolume::mkdir |
( |
const String & |
path, |
|
|
bool |
pFlag = true |
|
) |
| |
|
inline |
Make a subdirectory in the volume root directory.
- Parameters
-
[in] | path | A path with a valid name for the subdirectory. |
[in] | pFlag | Create missing parent directories if true. |
- Returns
- true for success or false for failure.
◆ open() [1/2]
File32 FatVolume::open |
( |
const char * |
path, |
|
|
oflag_t |
oflag = 0X00 |
|
) |
| |
|
inline |
open a file
- Parameters
-
[in] | path | location of file to be opened. |
[in] | oflag | open flags. |
- Returns
- a File32 object.
◆ open() [2/2]
File32 FatVolume::open |
( |
const String & |
path, |
|
|
oflag_t |
oflag = 0X00 |
|
) |
| |
|
inline |
open a file
- Parameters
-
[in] | path | location of file to be opened. |
[in] | oflag | open flags. |
- Returns
- a File32 object.
◆ remove() [1/2]
bool FatVolume::remove |
( |
const char * |
path | ) |
|
|
inline |
Remove a file from the volume root directory.
- Parameters
-
[in] | path | A path with a valid name for the file. |
- Returns
- true for success or false for failure.
◆ remove() [2/2]
bool FatVolume::remove |
( |
const String & |
path | ) |
|
|
inline |
Remove a file from the volume root directory.
- Parameters
-
[in] | path | A path with a valid name for the file. |
- Returns
- true for success or false for failure.
◆ rename() [1/2]
bool FatVolume::rename |
( |
const char * |
oldPath, |
|
|
const char * |
newPath |
|
) |
| |
|
inline |
Rename a file or subdirectory.
- Parameters
-
[in] | oldPath | Path name to the file or subdirectory to be renamed. |
[in] | newPath | New path name of the file or subdirectory. |
The newPath object must not exist before the rename call.
The file to be renamed must not be open. The directory entry may be moved and file system corruption could occur if the file is accessed by a file object that was opened before the rename() call.
- Returns
- true for success or false for failure.
◆ rename() [2/2]
bool FatVolume::rename |
( |
const String & |
oldPath, |
|
|
const String & |
newPath |
|
) |
| |
|
inline |
Rename a file or subdirectory.
- Parameters
-
[in] | oldPath | Path name to the file or subdirectory to be renamed. |
[in] | newPath | New path name of the file or subdirectory. |
The newPath object must not exist before the rename call.
The file to be renamed must not be open. The directory entry may be moved and file system corruption could occur if the file is accessed by a file object that was opened before the rename() call.
- Returns
- true for success or false for failure.
◆ rmdir() [1/2]
bool FatVolume::rmdir |
( |
const char * |
path | ) |
|
|
inline |
Remove a subdirectory from the volume's working directory.
- Parameters
-
[in] | path | A path with a valid name for the subdirectory. |
The subdirectory file will be removed only if it is empty.
- Returns
- true for success or false for failure.
◆ rmdir() [2/2]
bool FatVolume::rmdir |
( |
const String & |
path | ) |
|
|
inline |
Remove a subdirectory from the volume's working directory.
- Parameters
-
[in] | path | A path with a valid name for the subdirectory. |
The subdirectory file will be removed only if it is empty.
- Returns
- true for success or false for failure.
◆ rootDirEntryCount()
uint16_t FatPartition::rootDirEntryCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of entries in the root directory for FAT16 volumes.
◆ rootDirStart()
uint32_t FatPartition::rootDirStart |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The logical sector number for the start of the root directory on FAT16 volumes or the first cluster number on FAT32 volumes.
◆ sectorMask()
uint16_t FatPartition::sectorMask |
( |
| ) |
const |
|
inlineinherited |
- Returns
- Mask for sector offset.
◆ sectorsPerCluster()
uint8_t FatPartition::sectorsPerCluster |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The volume's cluster size in sectors.
◆ sectorsPerClusterShift()
uint8_t FatPartition::sectorsPerClusterShift |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The shift count required to multiply by sectorsPerCluster.
◆ sectorsPerFat()
uint32_t FatPartition::sectorsPerFat |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of sectors in one FAT.
◆ truncate() [1/2]
bool FatVolume::truncate |
( |
const char * |
path, |
|
|
uint32_t |
length |
|
) |
| |
|
inline |
Truncate a file to a specified length. The current file position will be at the new EOF.
- Parameters
-
[in] | path | A path with a valid name for the file. |
[in] | length | The desired length for the file. |
- Returns
- true for success or false for failure.
◆ truncate() [2/2]
bool FatVolume::truncate |
( |
const String & |
path, |
|
|
uint32_t |
length |
|
) |
| |
|
inline |
Truncate a file to a specified length. The current file position will be at the new EOF.
- Parameters
-
[in] | path | A path with a valid name for the file. |
[in] | length | The desired length for the file. |
- Returns
- true for success or false for failure.
◆ volumeSectorCount()
uint32_t FatPartition::volumeSectorCount |
( |
| ) |
const |
|
inlineinherited |
- Returns
- The number of sectors in the volume
The documentation for this class was generated from the following files:
- ArduinoSdFat/libraries/SdFat/src/FatLib/FatVolume.h
- ArduinoSdFat/libraries/SdFat/src/FatLib/FatVolume.cpp