Mistake on this page? Email us
pal_fileSystem.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright 2016-2019 ARM Ltd.
3 //
4 // SPDX-License-Identifier: Apache-2.0
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // ----------------------------------------------------------------------------
18 
19 #ifndef PAL_FILE_SYSTEM_H
20 #define PAL_FILE_SYSTEM_H
21 
22 #ifndef _PAL_H
23  #error "Please do not include this file directly, use pal.h instead"
24 #endif
25 
117 #define PAL_MAX_FILE_NAME_SIZE 8
118 #define PAL_MAX_FILE_NAME_SUFFIX 3
119 #define PAL_MAX_FOLDER_DEPTH_CHAR 66
120 #define PAL_MAX_FILE_AND_FOLDER_LENGTH (PAL_MAX_FILE_NAME_SIZE + PAL_MAX_FILE_NAME_SUFFIX + PAL_MAX_FOLDER_DEPTH_CHAR + 1)
121 #define PAL_MAX_FULL_FILE_NAME (PAL_MAX_FILE_NAME_SUFFIX + PAL_MAX_FOLDER_DEPTH_CHAR + 1)
122 
123 typedef uintptr_t palFileDescriptor_t;
124 
132 typedef enum {
138 
140 
142 typedef enum {
155 typedef enum {
160 
161 
185 palStatus_t pal_fsMkDir(const char *pathName);
186 
214 palStatus_t pal_fsRmDir(const char *pathName);
215 
216 
260 palStatus_t pal_fsFopen(const char *pathName, pal_fsFileMode_t mode,
261  palFileDescriptor_t *fd);
262 
275 
276 
295 palStatus_t pal_fsFread(palFileDescriptor_t *fd, void * buffer,
296  size_t numOfBytes, size_t *numberOfBytesRead);
297 
313 palStatus_t pal_fsFwrite(palFileDescriptor_t *fd, const void * buffer,
314  size_t numOfBytes, size_t *numberOfBytesWritten);
315 
316 
347  pal_fsOffset_t whence);
348 
359 
370 palStatus_t pal_fsUnlink(const char *pathName);
371 
381 palStatus_t pal_fsRmFiles(const char *pathName);
382 
394 palStatus_t pal_fsCpFolder(const char *pathNameSrc, char *pathNameDest);
395 
407 palStatus_t pal_fsSetMountPoint(pal_fsStorageID_t dataID, const char *Path);
408 
421 palStatus_t pal_fsGetMountPoint(pal_fsStorageID_t dataID, size_t length, char *Path);
422 
434 
445 
446 
449 void pal_fsCleanup(void);
450 
451 
455 #endif//test
Open for reading and writing. The stream is positioned at the beginning of the file, same as "r+ ".
Definition: pal_fileSystem.h:145
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...
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.
void pal_fsCleanup(void)
This function will perform clean up on all file system resources.
palStatus_t pal_fsFormat(pal_fsStorageID_t dataID)
This function formats a given SD partition.
Open file for reading only. The stream is positioned at the beginning of the file, same as "r".
Definition: pal_fileSystem.h:144
Definition: pal_fileSystem.h:148
palStatus_t pal_fsMkDir(const char *pathName)
This function attempts to create a directory named pathName.
The current position indicator.
Definition: pal_fileSystem.h:135
Must be last value. .
Definition: pal_fileSystem.h:158
Definition: pal_fileSystem.h:143
uintptr_t palFileDescriptor_t
Pointer to a generic File Descriptor object.
Definition: pal_fileSystem.h:123
pal_fsOffset_t
Enum for fseek() relative options.
Definition: pal_fileSystem.h:132
Open for reading and writing exclusively. The stream is positioned at the beginning of the file...
Definition: pal_fileSystem.h:146
Primary partition. .
Definition: pal_fileSystem.h:156
palStatus_t pal_fsUnlink(const char *pathName)
This function deletes a single file from the file system.
End of file.
Definition: pal_fileSystem.h:136
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...
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...
Open for reading and writing exclusively. The stream is positioned at the beginning of the file...
Definition: pal_fileSystem.h:147
palStatus_t pal_fsFtell(palFileDescriptor_t *fd, off_t *pos)
This function gets the current read/write pointer of a file.
Definition: pal_fileSystem.h:133
pal_fsStorageID_t
Enum for partition access.
Definition: pal_fileSystem.h:155
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 ...
pal_fsFileMode_t
Enum for fopen() permission options.
Definition: pal_fileSystem.h:142
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).
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).
palStatus_t pal_fsRmDir(const char *pathName)
This function deletes a directory.
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 ...
Relative to the start of the file.
Definition: pal_fileSystem.h:134
Secondary partition. .
Definition: pal_fileSystem.h:157
bool pal_fsIsPrivatePartition(pal_fsStorageID_t dataID)
This function will return whether a given partition is used only by PAL or not.
Definition: pal_fileSystem.h:137
int32_t palStatus_t
Definition: pal_types.h:55
palStatus_t pal_fsFclose(palFileDescriptor_t *fd)
This function closes an open file object.