Directory Access and Management.
More...
◆ dir_open()
This API function will open an existing dir
in a location specified by the parameter path
, on the logical drive identified by the drive number found also in the path
parameter. The directory data structure specific to the particular file system implementation fs_specific_dir
, and dir
structure will be initialized too.
- Parameters
-
[in,out] | dir | A pointer to the directory data structure, that acts as the directory identifier. See dir_t, structure for detailed explanation. |
[in] | fs_specific_dir | A pointer to the directory data structure specific to the particular file system. See fs_dir_t structure for detailed explanation. |
[in] | path | A null terminated string, that specifies the absolute path to the directory that needs to be opened. It should contain the the logical drive identifying drive number and semicolon at the beginning of the string, eg "3:/" . If it does not, the default logical drive, 0 :, will be assumed. |
- Return values
-
FSS_OK | If the directory was opened successfully, |
FSS_GENERAL_ERROR | If too many directories or files are opened already, if directory identified by the dir paramater does not exist on the logical drive identified by the parameter path , etc. |
- Precondition
- A logical drive must be mounted to the file system to the location specified by the
path
See file_system_mount function for detailed explanation.
- Postcondition
- Other directory access APIs can now be called, using the
dir
structure as identifier, allowing various operations with the opened directory.
- Note
- Maximum 10 files and/or directories can be opened at one time. See FS_MAX_OBJECTS.
◆ dir_close()
This API function will close an open dir
object.
- Parameters
-
[in,out] | dir | A pointer to the directory data structure, that acts as the opened directory identifier. See dir_t, structure for detailed explanation. |
- Return values
-
FSS_OK | If the directory was closed successfully, |
FSS_GENERAL_ERROR | If the dir was not opened, or if there was an error on the physical drive linked to the logical drive, etc. |
- Precondition
- The
dir
must be opened first, before calling this function. See dir_open, function for detailed explanation.
◆ dir_read()
This API function will read an directory entry, from the opened dir
.
- Parameters
-
[in] | dir | A pointer to the directory data structure, that acts as the opened directory identifier. See dir_t, structure for detailed explanation. |
[in] | file_information | A pointer to the structure, where the read directory entry will be stored. |
- Return values
-
FSS_OK | If the directory entry was read successfully. |
FSS_END_OF_DIRECTORY | If read directory was null . |
FSS_GENERAL_ERROR | If the dir was not opened, or if there was an error on the physical drive linked to the logical drive, etc. |
- Precondition
- The
dir
must be opened first, before calling this function. See dir_open, function for detailed explanation.
◆ dir_rewind()
This API function will will move read/write offset of the opened dir
, to the beginning of the opened dir
.
- Parameters
-
[in] | dir | A pointer to the directory data structure, that acts as the opened directory identifier. See dir_t, structure for detailed explanation. |
- Return values
-
FSS_OK | If read/write offset of the dir was moved to the desired offset successfully. |
FSS_GENERAL_ERROR | If the dir was not opened, or if there was an error on the physical drive linked to the logical drive, etc. |
- Precondition
- The
dir
must be opened first, before calling this function. See dir_open, function for detailed explanation.