Mistake on this page? Email us
pal_fileSystem.h File Reference

PAL file system. This file contains the file system APIs and is part of the PAL service API. More...

Go to the source code of this file.

Macros

#define PAL_MAX_FILE_NAME_SIZE   8
 Max length for file name received by user. More...
 
#define PAL_MAX_FILE_NAME_SUFFIX   3
 Max length for file name suffix. More...
 
#define PAL_MAX_FOLDER_DEPTH_CHAR   66
 Max folder length in chars. More...
 
#define PAL_MAX_FILE_AND_FOLDER_LENGTH   (PAL_MAX_FILE_NAME_SIZE + PAL_MAX_FILE_NAME_SUFFIX + PAL_MAX_FOLDER_DEPTH_CHAR + 1)
 Maximum combined file and folder name length. Plus 1 is for the period that separates file name and file suffix. More...
 
#define PAL_MAX_FULL_FILE_NAME   (PAL_MAX_FILE_NAME_SUFFIX + PAL_MAX_FOLDER_DEPTH_CHAR + 1)
 Maximum combined file name. Plus 1 is for the period that separates file name and file suffix. More...
 

Typedefs

typedef uintptr_t palFileDescriptor_t
 Pointer to a generic File Descriptor object. More...
 

Enumerations

enum  pal_fsOffset_t {
  PAL_FS_OFFSET_KEEP_FIRST = 0, PAL_FS_OFFSET_SEEKSET, PAL_FS_OFFSET_SEEKCUR, PAL_FS_OFFSET_SEEKEND,
  PAL_FS_OFFSET_KEEP_LAST
}
 Enum for fseek() relative options. More...
 
enum  pal_fsFileMode_t {
  PAL_FS_FLAG_KEEP_FIRST = 0, PAL_FS_FLAG_READONLY, PAL_FS_FLAG_READWRITE, PAL_FS_FLAG_READWRITEEXCLUSIVE,
  PAL_FS_FLAG_READWRITETRUNC, PAL_FS_FLAG_KEEP_LAST
}
 Enum for fopen() permission options. More...
 
enum  pal_fsStorageID_t { PAL_FS_PARTITION_PRIMARY = 0, PAL_FS_PARTITION_SECONDARY, PAL_FS_PARTITION_LAST }
 Enum for partition access. More...
 

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

Detailed Description

PAL file system. This file contains the file system APIs and is part of the PAL service API.

It provides APIs to create and remove directories as well as open, read and write to files.

Enumeration Type Documentation

Enum for partition access.

Enumerator
PAL_FS_PARTITION_PRIMARY 

Primary partition.
.

PAL_FS_PARTITION_SECONDARY 

Secondary partition.
.

PAL_FS_PARTITION_LAST 

Must be last value.
.