diff options
author | Reiko Asakura | 2020-07-21 15:10:11 -0400 |
---|---|---|
committer | Reiko Asakura | 2020-07-21 15:10:11 -0400 |
commit | 16f304f919c7a23e615ca1c045fc98a53ae01824 (patch) | |
tree | 9716d989df32a044d8fad807eaf669b06946a025 /include/user/kernel/iofilemgr/dirent.h | |
parent | Add doc and remove unneeded include (diff) | |
download | vds-libraries-16f304f919c7a23e615ca1c045fc98a53ae01824.tar.gz |
Refactor userland SceIofilemgr headers
Diffstat (limited to 'include/user/kernel/iofilemgr/dirent.h')
-rw-r--r-- | include/user/kernel/iofilemgr/dirent.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/user/kernel/iofilemgr/dirent.h b/include/user/kernel/iofilemgr/dirent.h new file mode 100644 index 0000000..e343910 --- /dev/null +++ b/include/user/kernel/iofilemgr/dirent.h @@ -0,0 +1,58 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ + +#include <psp2/kernel/iofilemgr/stat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Describes a single directory entry */ +typedef struct SceIoDirent { + SceIoStat d_stat; //!< File status + char d_name[256]; //!< File name (not file path) + void *d_private; //!< Reserved (set to 0) + int dummy; //!< Padding +} SceIoDirent; + +/** + * Open a directory + * + * @par Example: + * @code + * int dfd; + * dfd = sceIoDopen("device:/"); + * if(dfd >= 0) + * { Do something with the file descriptor } + * @endcode + * @param dirname - The directory to open for reading. + * @return If >= 0 then a valid file descriptor, otherwise a Sony error code. + */ +SceUID sceIoDopen(const char *dirname); + +/** + * Close an opened directory file descriptor + * + * @param fd - Already opened file descriptor (using ::sceIoDopen) + * @return < 0 on error + */ +int sceIoDclose(SceUID fd); + +/** + * Reads an entry from an opened file descriptor. + * + * @param fd - Already opened file descriptor (using ::sceIoDopen) + * @param buf - Pointer to a ::SceIoDirent structure to hold the file information + * + * @return Read status + * - 0 - No more directory entries left + * - > 0 - More directory entries to go + * - < 0 - Error + */ +int sceIoDread(SceUID fd, SceIoDirent *buf); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ */ |