Contains file and directory function prototypes for libosa.
More...
|
#define | OSA_OWNER_READ 0x0400 |
| Bit masks that define properties of a file or directory.
|
|
#define | OSA_OWNER_WRITE 0x0200 |
|
#define | OSA_OWNER_EXECUTE 0x0100 |
|
#define | OSA_GROUP_READ 0x0040 |
|
#define | OSA_GROUP_WRITE 0x0020 |
|
#define | OSA_GROUP_EXECUTE 0x0010 |
|
#define | OSA_OTHER_READ 0x0004 |
|
#define | OSA_OTHER_WRITE 0x0002 |
|
#define | OSA_OTHER_EXECUTE 0x0001 |
|
#define | OSA_PERM_ALL 0x0777 |
|
|
typedef void | OsaDir |
| Abstract type to represent a directory handle.
|
|
◆ OsaDirEntType
Enumerator |
---|
OSA_DT_FILE | Entry is a directory.
|
OSA_DT_UNKNOWN | Entry is a regular file.
Entry is unknown type (Linux only)
|
◆ osa_mkdir()
int osa_mkdir |
( |
const char * |
path, |
|
|
int |
mode |
|
) |
| |
Create a directory at the given 'path' with the given 'mode'. The path can be a full path including device/mount point, or it can be a relative path. On Linux, the current path will be based on where the application is executed from. On MQX the current path will be the root of the device unless a call to osa_chdir() is made to change it. Current paths can be different for each process on Linux and each thread on MQX.
- Parameters
-
path | The path and name of the directory to make |
mode | The directory mode. This should be a combination of bit modes defined above. |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_OUT_OF_MEMORY | Out of memory (MQX only) |
ERRCODE_PERMISSION_DENIED | Permission denied |
ERRCODE_PARAMETER_EXISTS | Directory exists |
ERRCODE_OUT_OF_SPACE | No space left on device |
ERRCODE_INVALID_ARGUMENT | Invalid input parameters |
ERRCODE_GENERAL_ERROR | An error occurred creating the directory |
◆ osa_chdir()
int osa_chdir |
( |
const char * |
path | ) |
|
Change the current working directory for the executing process or thread to 'path'. On Linux, this directory can be unique for the entire process (all threads) and on MQX it can be unique for each thread.
- Parameters
-
path | The directory path to change to |
- Warning
- This function has non-expected behavior on MQX and should be avoided until corrected.
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_OUT_OF_MEMORY | Out of memory (MQX only) |
ERRCODE_PERMISSION_DENIED | Permission denied |
ERRCODE_INVALID_ARGUMENT | Invalid input parameters |
ERRCODE_GENERAL_ERROR | An error occurred creating the directory |
◆ osa_opendir()
OsaDir* osa_opendir |
( |
const char * |
dirname | ) |
|
Open a directory at path 'dirname' and return a pointer to an object for reading.
- Parameters
-
dirname | The path and name of the directory to open. This can be absolute or relative to current working directory. |
- Returns
- Valid pointer on success or NULL on failure.
◆ osa_closedir()
int osa_closedir |
( |
OsaDir * |
dirp | ) |
|
Close the pointer object to an open directory and release any memory associated with it.
- Parameters
-
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_INVALID_ARGUMENT | Invalid input parameter |
◆ osa_readdir()
Read a single directory entry for the directory object pointed to by 'dirp' and return the data in 'entry'.
- Parameters
-
dirp | Directory pointer |
entry | Output parameter to store directory entry contents. This must be a valid pointer to an object. |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_END_OF_DIRECTORY | End of directory reached |
ERRCODE_GENERAL_ERROR | An error occurred reading the directory |
◆ osa_unlink()
int osa_unlink |
( |
const char * |
path | ) |
|
Remove a file or directory from the filesystem.
- Parameters
-
path | Path to the file or directory |
- Return values
-
ERRCODE_NO_ERROR | Function succeeded |
ERRCODE_PERMISSION_DENIED | Permission Denied |
ERRCODE_BUSY | Entry is being accessed |
ERRCODE_NOT_FOUND | Entry name not found |
ERRCODE_INVALID_ARGUMENT | The path did not contain a valid device |
ERRCODE_GENERAL | An error occurred deleting the entry |