Milos RTOS v0.3.4a
Real Time Operating System
Directory functions
Collaboration diagram for Directory functions:

Functions

__FILE_RES __dirCreate (__CONST __PSTRING name)
 Creates a new directory.
__FILE_RES __dirOpen (__PDIR dir, __CONST __PSTRING name)
 Opens an existing directory.
__FILE_RES __dirRead (__PDIR dir, __PFILEINFO fi)
 Reads a directory entry.

Detailed Description

Directory functions


Function Documentation

Creates a new directory.

Parameters:
nameName of the directory (string, null-terminated).
Returns:
Any of the following values.
  • FR_OK (0) The function succeeded.
  • FR_NO_PATH Could not find the path.
  • FR_INVALID_NAME The path name is invalid.
  • FR_INVALID_DRIVE The drive number is invalid.
  • FR_DENIED The directory cannot be created due to directory table or disk is full.
  • FR_EXIST A file or directory that has same name is already existing.
  • FR_NOT_READY The disk drive cannot work due to no medium in the drive or any other reason.
  • FR_WRITE_PROTECTED The medium is write protected.
  • FR_DISK_ERR The function failed due to an error in the disk function.
  • FR_INT_ERR The function failed due to a wrong FAT structure or an internal error.
  • FR_NOT_ENABLED The logical drive has no work area.
  • FR_NO_FILESYSTEM There is no valid FAT volume on the drive.

Definition at line 304 of file fat.c.

{
    return f_mkdir(name);
}

Opens an existing directory.

From FatFS documentation: The f_opendir function opens an exsisting directory and creates the directory object for subsequent calls. The directory object structure can be discarded at any time without any procedure.

Parameters:
dirPointer to the blank directory object to be opened.
namePointer to the null-terminated string that specifies the directory name to be opened.
Returns:
Any of the following values.
  • FR_OK (0) The function succeeded and the directory object is created. It is used for subsequent calls to read the directory entries.
  • FR_NO_PATH Could not find the path.
  • FR_INVALID_NAME The path name is invalid.
  • FR_INVALID_DRIVE The drive number is invalid.
  • FR_NOT_READY The disk drive cannot work due to no medium in the drive or any other reason.
  • FR_DISK_ERR The function failed due to an error in the disk function.
  • FR_INT_ERR The function failed due to a wrong FAT structure or an internal error.
  • FR_NOT_ENABLED The logical drive has no work area.
  • FR_NO_FILESYSTEM There is no valid FAT volume on the drive.

Definition at line 333 of file fat.c.

{
    return f_opendir(dir, name);
}

Reads a directory entry.

From FatFS documentation: The f_readdir function reads directory entries in sequence. All items in the directory can be read by calling f_readdir function repeatedly. When all directory entries have been read and no item to read, the function returns a null string into f_name[] member without any error. When a null pointer is given to the FileInfo, the read index of the directory object will be rewinded. When LFN feature is enabled, lfname and lfsize in the file information structure must be initialized with valid value prior to use the f_readdir function. The lfname is a pointer to the string buffer to return the long file name. The lfsize is the size of the string buffer in unit of character. If either the size of read buffer or LFN working buffer is insufficient for the LFN or the object has no LFN, a null string will be returned to the LFN read buffer. If the LFN contains any charactrer that cannot be converted to OEM code, a null string will be returned but this is not the case on Unicode API configuration. When lfname is a NULL, nothing of the LFN is returned. When the object has no LFN, any small capitals can be contained in the SFN. When relative path feature is enabled (_FS_RPATH == 1), "." and ".." entries are not filtered out and it will appear in the read entries.

Parameters:
dirPointer to the open directory (__dirOpen() function).
fiPointer to an __FILEINFO structure to receive the file/directory info.
Returns:
Any of the following values:
  • FR_OK (0) The function succeeded.
  • FR_NOT_READY The disk drive cannot work due to no medium in the drive or any other reason.
  • FR_DISK_ERR The function failed due to an error in the disk function.
  • FR_INT_ERR The function failed due to a wrong FAT structure or an internal error.
  • FR_INVALID_OBJECT The directory object is invalid.

Definition at line 368 of file fat.c.

{
    return f_readdir(dir, fi);
}
 All Data Structures Files Functions Variables Typedefs Defines