SdFs
Public Member Functions | Static Public Member Functions | Friends | List of all members
FsVolume Class Reference

FsVolume class. More...

#include <FsVolume.h>

Inheritance diagram for FsVolume:
Inheritance graph
[legend]

Public Member Functions

bool begin (BlockDevice *blockDev)
 
bool chdir ()
 
bool chdir (const char *path)
 
void chvol ()
 
uint32_t clusterCount ()
 
uint32_t dataStartSector () const
 
void end ()
 
bool exists (const char *path)
 
bool exists (const String &path)
 
uint32_t fatStartSector () const
 
uint8_t fatType () const
 
uint32_t freeClusterCount ()
 
void ls (print_t *pr)
 
void ls (print_t *pr, uint8_t flags)
 
void ls (print_t *pr, const char *path, uint8_t flags)
 
void ls ()
 
void ls (uint8_t flags)
 
void ls (const char *path, uint8_t flags=0)
 
bool mkdir (const char *path, bool pFlag=true)
 
bool mkdir (const String &path, bool pFlag=true)
 
FsFile open (const char *path, uint8_t oflag=O_READ)
 
FsFile open (const String &path, uint8_t oflag=O_READ)
 
bool remove (const char *path)
 
bool remove (const String &path)
 
bool rename (const char *oldPath, const char *newPath)
 
bool rmdir (const char *path)
 
bool rmdir (const String &path)
 
uint32_t sectorsPerCluster () const
 

Static Public Member Functions

static FsVolumecwv ()
 

Friends

class FsFile
 

Detailed Description

FsVolume class.

Member Function Documentation

bool FsVolume::begin ( BlockDevice blockDev)

Initialize an FatVolume object.

Parameters
[in]blockDevDevice block driver.
Returns
The value true is returned for success and the value false is returned for failure.
bool FsVolume::chdir ( )
inline

Set volume working directory to root.

Returns
true for success else false.
bool FsVolume::chdir ( const char *  path)
inline

Set volume working directory.

Parameters
[in]pathPath for volume working directory.
Returns
true for success or false for failure.
void FsVolume::chvol ( )
inline

Change global working volume to this volume.

uint32_t FsVolume::clusterCount ( )
inline
Returns
The total number of clusters in the volume.
static FsVolume* FsVolume::cwv ( )
inlinestatic
Returns
current working volume.
uint32_t FsVolume::dataStartSector ( ) const
inline
Returns
The logical sector number for the start of file data.
void FsVolume::end ( )
inline

free dynamic memory and end access to volume

bool FsVolume::exists ( const char *  path)
inline

Test for the existence of a file in a directory

Parameters
[in]pathPath of the file to be tested for.
Returns
true if the file exists else false.
bool FsVolume::exists ( const String &  path)
inline

Test for the existence of a file in a directory

Parameters
[in]pathPath of the file to be tested for.
Returns
true if the file exists else false.
uint32_t FsVolume::fatStartSector ( ) const
inline
Returns
The logical sector number for the start of the first FAT.
uint8_t FsVolume::fatType ( ) const
inline
Returns
Partition type, FAT_TYPE_EXFAT, FAT_TYPE_FAT32, FAT_TYPE_FAT16, or zero for error.
uint32_t FsVolume::freeClusterCount ( )
inline
Returns
the free cluster count.
void FsVolume::ls ( print_t *  pr)
inline

List directory contents.

Parameters
[in]prPrint object.
void FsVolume::ls ( print_t *  pr,
uint8_t  flags 
)
inline

List directory contents.

Parameters
[in]prPrint object.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

void FsVolume::ls ( print_t *  pr,
const char *  path,
uint8_t  flags 
)

List the directory contents of a directory.

Parameters
[in]prPrint stream for list.
[in]pathdirectory to list.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

void FsVolume::ls ( )
inline

List directory contents.

void FsVolume::ls ( uint8_t  flags)
inline

List directory contents.

Parameters
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

void FsVolume::ls ( const char *  path,
uint8_t  flags = 0 
)
inline

List the directory contents of a directory to Serial.

Parameters
[in]pathdirectory to list.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

bool FsVolume::mkdir ( const char *  path,
bool  pFlag = true 
)
inline

Make a subdirectory in the volume root directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the subdirectory.
[in]pFlagCreate missing parent directories if true.
Returns
The value true is returned for success and the value false is returned for failure.
bool FsVolume::mkdir ( const String &  path,
bool  pFlag = true 
)
inline

Make a subdirectory in the volume root directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the subdirectory.
[in]pFlagCreate missing parent directories if true.
Returns
The value true is returned for success and the value false is returned for failure.
FsFile FsVolume::open ( const char *  path,
uint8_t  oflag = O_READ 
)

open a file

Parameters
[in]pathlocation of file to be opened.
[in]oflagopen mode flags.
Returns
a File object.
FsFile FsVolume::open ( const String &  path,
uint8_t  oflag = O_READ 
)

open a file

Parameters
[in]pathlocation of file to be opened.
[in]oflagopen mode flags.
Returns
a File object.
bool FsVolume::remove ( const char *  path)
inline

Remove a file from the volume root directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the file.
Returns
The value true is returned for success and the value false is returned for failure.
bool FsVolume::remove ( const String &  path)
inline

Remove a file from the volume root directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the file.
Returns
The value true is returned for success and the value false is returned for failure.
bool FsVolume::rename ( const char *  oldPath,
const char *  newPath 
)
inline

Rename a file or subdirectory.

Parameters
[in]oldPathPath name to the file or subdirectory to be renamed.
[in]newPathNew 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
The value true is returned for success and the value false is returned for failure.
bool FsVolume::rmdir ( const char *  path)
inline

Remove a subdirectory from the volume's root directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the subdirectory.

The subdirectory file will be removed only if it is empty.

Returns
The value true is returned for success and the value false is returned for failure.
bool FsVolume::rmdir ( const String &  path)
inline

Remove a subdirectory from the volume's root directory.

Parameters
[in]pathA path with a valid 8.3 DOS name for the subdirectory.

The subdirectory file will be removed only if it is empty.

Returns
The value true is returned for success and the value false is returned for failure.
uint32_t FsVolume::sectorsPerCluster ( ) const
inline
Returns
The volume's cluster size in sectors.

The documentation for this class was generated from the following files: