Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Loading...
Searching...
No Matches
FsVolume Class Reference

FsVolume class. More...

#include <FsVolume.h>

Inherited by SdBase< FsVolume >.

Public Member Functions

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

Protected Attributes

newalign_t m_volMem [FS_ALIGN_DIM(ExFatVolume, FatVolume)]
 

Private Member Functions

 FsVolume (const FsVolume &from)
 
FsVolumeoperator= (const FsVolume &from)
 

Static Private Member Functions

static FsVolumecwv ()
 

Private Attributes

FatVolumem_fVol = nullptr
 
ExFatVolumem_xVol = nullptr
 
BlockDevicem_blockDev
 

Static Private Attributes

static FsVolumem_cwv = nullptr
 

Friends

class FsBaseFile
 

Detailed Description

FsVolume class.

Constructor & Destructor Documentation

◆ FsVolume() [1/2]

FsVolume::FsVolume ( )
inline

◆ ~FsVolume()

FsVolume::~FsVolume ( )
inline

◆ FsVolume() [2/2]

FsVolume::FsVolume ( const FsVolume from)
private

Member Function Documentation

◆ begin()

bool FsVolume::begin ( BlockDevice blockDev)

Initialize an FatVolume object.

Parameters
[in]blockDevDevice block driver.
Returns
true for success or false for failure.

◆ blocksPerCluster()

uint32_t FsVolume::blocksPerCluster ( )
inline

◆ bytesPerCluster()

uint32_t FsVolume::bytesPerCluster ( ) const
inline
Returns
the number of bytes in a cluster.

◆ chdir() [1/3]

bool FsVolume::chdir ( )
inline

Set volume working directory to root.

Returns
true for success or false for failure.

◆ chdir() [2/3]

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.

◆ chdir() [3/3]

bool FsVolume::chdir ( const String &  path)
inline

Set volume working directory.

Parameters
[in]pathPath for volume working directory.
Returns
true for success or false for failure.

◆ chvol()

void FsVolume::chvol ( )
inline

Change global working volume to this volume.

◆ clusterCount()

uint32_t FsVolume::clusterCount ( ) const
inline
Returns
The total number of clusters in the volume.

◆ cwv()

static FsVolume * FsVolume::cwv ( )
inlinestaticprivate

◆ dataStartSector()

uint32_t FsVolume::dataStartSector ( ) const
inline
Returns
The logical sector number for the start of file data.

◆ end()

void FsVolume::end ( )
inline

free dynamic memory and end access to volume

◆ exists() [1/2]

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.

◆ exists() [2/2]

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.

◆ fatStartSector()

uint32_t FsVolume::fatStartSector ( ) const
inline
Returns
The logical sector number for the start of the first FAT.

◆ fatType()

uint8_t FsVolume::fatType ( ) const
inline
Returns
Partition type, FAT_TYPE_EXFAT, FAT_TYPE_FAT32, FAT_TYPE_FAT16, or zero for error.

◆ freeClusterCount()

uint32_t FsVolume::freeClusterCount ( ) const
inline
Returns
the free cluster count.

◆ isBusy()

bool FsVolume::isBusy ( )
inline

Check for BlockDevice busy.

Returns
true if busy else false.

◆ ls() [1/6]

bool FsVolume::ls ( )
inline

List directory contents.

Returns
true for success or false for failure.

◆ ls() [2/6]

bool 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.

Returns
true for success or false for failure.
true for success or false for failure.

◆ ls() [3/6]

bool FsVolume::ls ( print_t pr)
inline

List directory contents.

Parameters
[in]prPrint object.
Returns
true for success or false for failure.

◆ ls() [4/6]

bool 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.

Returns
true for success or false for failure.

◆ ls() [5/6]

bool 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.

Returns
true for success or false for failure.

◆ ls() [6/6]

bool 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.

Returns
true for success or false for failure.

◆ mkdir() [1/2]

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
true for success or false for failure.

◆ mkdir() [2/2]

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
true for success or false for failure.

◆ open() [1/2]

FsFile FsVolume::open ( const char *  path,
oflag_t  oflag = O_RDONLY 
)

open a file

Parameters
[in]pathlocation of file to be opened.
[in]oflagopen flags.
Returns
a FsBaseFile object.

◆ open() [2/2]

FsFile FsVolume::open ( const String &  path,
oflag_t  oflag = O_RDONLY 
)

open a file

Parameters
[in]pathlocation of file to be opened.
[in]oflagopen flags.
Returns
a FsBaseFile object.

◆ operator=()

FsVolume & FsVolume::operator= ( const FsVolume from)
private

◆ remove() [1/2]

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
true for success or false for failure.

◆ remove() [2/2]

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
true for success or false for failure.

◆ rename() [1/2]

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
true for success or false for failure.

◆ rename() [2/2]

bool FsVolume::rename ( const String &  oldPath,
const String &  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
true for success or false for failure.

◆ rmdir() [1/2]

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
true for success or false for failure.

◆ rmdir() [2/2]

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
true for success or false for failure.

◆ sectorsPerCluster()

uint32_t FsVolume::sectorsPerCluster ( ) const
inline
Returns
The volume's cluster size in sectors.

Friends And Related Symbol Documentation

◆ FsBaseFile

friend class FsBaseFile
friend

FsBaseFile allowed access to private members.

Member Data Documentation

◆ m_blockDev

BlockDevice* FsVolume::m_blockDev
private

◆ m_cwv

FsVolume * FsVolume::m_cwv = nullptr
staticprivate

Copyright (c) 2011-2020 Bill Greiman This file is part of the SdFat library for SD memory cards.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

◆ m_fVol

FatVolume* FsVolume::m_fVol = nullptr
private

◆ m_volMem

newalign_t FsVolume::m_volMem[FS_ALIGN_DIM(ExFatVolume, FatVolume)]
protected

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
true for success or false for failure.

◆ m_xVol

ExFatVolume* FsVolume::m_xVol = nullptr
private

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