Functions | |
palStatus_t | pal_fsMkDir (const char *pathName) |
This function attempts to create a directory named pathName . More... | |
palStatus_t | pal_fsRmDir (const char *pathName) |
This function deletes a directory. More... | |
palStatus_t | pal_fsFopen (const char *pathName, pal_fsFileMode_t mode, palFileDescriptor_t *fd) |
This function opens the file whose name is specified in the parameter pathName and associates it with a stream that can be identified in future operations by the fd pointer returned. More... | |
palStatus_t | pal_fsFclose (palFileDescriptor_t *fd) |
This function closes an open file object. More... | |
palStatus_t | pal_fsFread (palFileDescriptor_t *fd, void *buffer, size_t numOfBytes, size_t *numberOfBytesRead) |
This function reads an array of bytes from the stream and stores it in the block of memory specified by buffer . The position indicator of the stream is advanced by the total amount of bytes read. More... | |
palStatus_t | pal_fsFwrite (palFileDescriptor_t *fd, const void *buffer, size_t numOfBytes, size_t *numberOfBytesWritten) |
This function starts to write data from buffer to the file at the position pointed by the read/write pointer. More... | |
palStatus_t | pal_fsFseek (palFileDescriptor_t *fd, off_t offset, pal_fsOffset_t whence) |
This function moves the file read/write pointer without any read/write operation to the file. More... | |
palStatus_t | pal_fsFtell (palFileDescriptor_t *fd, off_t *pos) |
This function gets the current read/write pointer of a file. More... | |
palStatus_t | pal_fsUnlink (const char *pathName) |
This function deletes a single file from the file system. More... | |
palStatus_t | pal_fsRmFiles (const char *pathName) |
This function deletes all files and folders in a specified folder from the file system. Flat remove only. More... | |
palStatus_t | pal_fsCpFolder (const char *pathNameSrc, char *pathNameDest) |
This function copies all files from the source folder to the destination folder. Flat copy only. More... | |
palStatus_t | pal_fsSetMountPoint (pal_fsStorageID_t dataID, const char *Path) |
This function sets the mount directory for the given storage ID (primary or secondary). More... | |
palStatus_t | pal_fsGetMountPoint (pal_fsStorageID_t dataID, size_t length, char *Path) |
This function gets the mount directory for the given storage ID (primary or secondary). More... | |
palStatus_t | pal_fsFormat (pal_fsStorageID_t dataID) |
This function formats a given SD partition. More... | |
bool | pal_fsIsPrivatePartition (pal_fsStorageID_t dataID) |
This function will return whether a given partition is used only by PAL or not. More... | |
void | pal_fsCleanup (void) |
This function will perform clean up on all file system resources. More... | |
void pal_fsCleanup | ( | void | ) |
This function will perform clean up on all file system resources.
palStatus_t pal_fsCpFolder | ( | const char * | pathNameSrc, |
char * | pathNameDest | ||
) |
This function copies all files from the source folder to the destination folder. Flat copy only.
[in] | pathNameSrc | A pointer to a null-terminated string that specifies the source folder. |
[in] | pathNameDest | A pointer to a null-terminated string that specifies the destination folder. The folder MUST already exist. |
palError_t
.palStatus_t pal_fsFclose | ( | palFileDescriptor_t * | fd | ) |
This function closes an open file object.
[in] | fd | A pointer to the open file object structure to be closed. |
palError_t
.palStatus_t pal_fsFopen | ( | const char * | pathName, |
pal_fsFileMode_t | mode, | ||
palFileDescriptor_t * | fd | ||
) |
This function opens the file whose name is specified in the parameter pathName
and associates it with a stream that can be identified in future operations by the fd
pointer returned.
[out] | fd | The file descriptor to the file entered in the pathName . |
[in] | *pathName | A pointer to the null-terminated string that specifies the file name to open or create. |
[in] | mode | A mode flag that specifies the type of access and open method for the file. |
palError_t
.Example
palStatus_t pal_fsFormat | ( | pal_fsStorageID_t | dataID | ) |
This function formats a given SD partition.
[in] | dataID | The ID of the partition to be formatted. |
palError_t
. partitionID
.palStatus_t pal_fsFread | ( | palFileDescriptor_t * | fd, |
void * | buffer, | ||
size_t | numOfBytes, | ||
size_t * | numberOfBytesRead | ||
) |
This function reads an array of bytes from the stream and stores it in the block of memory specified by buffer
. The position indicator of the stream is advanced by the total amount of bytes read.
[in] | fd | A pointer to the open file object structure. |
[in] | buffer | The buffer to store the read data. |
[in] | numOfBytes | The number of bytes to read. |
[out] | numberOfBytesRead | The number of bytes read. |
palError_t
.numberOfBytesRead
should be checked to detect end of the file. If numberOfBytesRead
is less than numOfBytes
, the read/write pointer has reached the end of the file during the read operation or there is an error. palStatus_t pal_fsFseek | ( | palFileDescriptor_t * | fd, |
off_t | offset, | ||
pal_fsOffset_t | whence | ||
) |
This function moves the file read/write pointer without any read/write operation to the file.
[in] | fd | A pointer to the open file object structure. |
[in] | offset | The byte offset from the top of the file to set the read/write pointer. |
[out] | whence | Where the offset is relative to. |
palError_t
.whence
options are: Example
palStatus_t pal_fsFtell | ( | palFileDescriptor_t * | fd, |
off_t * | pos | ||
) |
This function gets the current read/write pointer of a file.
[in] | fd | A pointer to the open file object structure. |
[out] | pos | A pointer to a variable that receives the current file position. |
palError_t
. palStatus_t pal_fsFwrite | ( | palFileDescriptor_t * | fd, |
const void * | buffer, | ||
size_t | numOfBytes, | ||
size_t * | numberOfBytesWritten | ||
) |
This function starts to write data from buffer
to the file at the position pointed by the read/write pointer.
[in] | fd | A pointer to the open file object structure. |
[in] | buffer | A pointer to the data to be written. |
[in] | numOfBytes | The number of bytes to write. |
[out] | numberOfBytesWritten | The number of bytes written. |
palError_t
.numberOfBytesWritten
should be checked to detect the whether the disk is full. If numberOfBytesWritten
is less than numOfBytes
, the volume got full during the write operation. palStatus_t pal_fsGetMountPoint | ( | pal_fsStorageID_t | dataID, |
size_t | length, | ||
char * | Path | ||
) |
This function gets the mount directory for the given storage ID (primary or secondary).
The function copies the path to a buffer pre-allocated by the user.
[in] | dataID | Pointer to the target storage. |
[in] | length | The length of the buffer. |
[out] | Path | A pointer to a pre-allocated buffer with size PAL_MAX_FOLDER_DEPTH_CHAR + 1 chars. The plus 1 is to account for the '\0' terminator at the end of the buffer |
palError_t
. bool pal_fsIsPrivatePartition | ( | pal_fsStorageID_t | dataID | ) |
This function will return whether a given partition is used only by PAL or not.
[in] | dataID | - the ID of the data to be cleared. |
palStatus_t pal_fsMkDir | ( | const char * | pathName | ) |
This function attempts to create a directory named pathName
.
[in] | *pathName | A pointer to the null-terminated string that specifies the directory name to create. |
palError_t
.PAL_ERR_FS_rmdir
.Example
palStatus_t pal_fsRmDir | ( | const char * | pathName | ) |
This function deletes a directory.
[in] | *pathName | A pointer to the null-terminated string that specifies the directory name to be deleted. |
palError_t
./
.Example
palStatus_t pal_fsRmFiles | ( | const char * | pathName | ) |
This function deletes all files and folders in a specified folder from the file system. Flat remove only.
[in] | pathName | A pointer to a null-terminated string that specifies the folder. |
palError_t
./
. palStatus_t pal_fsSetMountPoint | ( | pal_fsStorageID_t | dataID, |
const char * | Path | ||
) |
This function sets the mount directory for the given storage ID (primary or secondary).
[in] | dataID | Pointer to the target storage. |
[in] | Path | A pointer to a null-terminated string that specifies the root folder. |
palError_t
.NULL
, the ESFS root folder is set to default PAL_SOURCE_FOLDER. /
. palStatus_t pal_fsUnlink | ( | const char * | pathName | ) |
This function deletes a single file from the file system.
[in] | pathName | A pointer to a null-terminated string that specifies the file to be removed. |
palError_t
.