From 648ee989cc6ac04ba07f5a8942f6ab711f62d6b4 Mon Sep 17 00:00:00 2001 From: Reiko Asakura Date: Wed, 20 Jan 2021 14:11:05 -0500 Subject: Rename iofilemgr headers --- include/common/kernel/iofilemgr/async.h | 21 ------- include/common/kernel/iofilemgr/dirent.h | 23 ------- include/common/kernel/iofilemgr/stat.h | 48 -------------- include/common/kernel/iofilemgr_async.h | 21 +++++++ include/common/kernel/iofilemgr_dirent.h | 23 +++++++ include/common/kernel/iofilemgr_stat.h | 48 ++++++++++++++ include/kernel/kernel/iofilemgr/async.h | 93 --------------------------- include/kernel/kernel/iofilemgr/dirent.h | 82 ------------------------ include/kernel/kernel/iofilemgr/stat.h | 101 ------------------------------ include/kernel/kernel/iofilemgr_async.h | 93 +++++++++++++++++++++++++++ include/kernel/kernel/iofilemgr_dirent.h | 82 ++++++++++++++++++++++++ include/kernel/kernel/iofilemgr_stat.h | 101 ++++++++++++++++++++++++++++++ include/user/kernel/iofilemgr/async.h | 104 ------------------------------- include/user/kernel/iofilemgr/dirent.h | 82 ------------------------ include/user/kernel/iofilemgr/stat.h | 101 ------------------------------ include/user/kernel/iofilemgr/syscall.h | 79 ----------------------- include/user/kernel/iofilemgr_async.h | 104 +++++++++++++++++++++++++++++++ include/user/kernel/iofilemgr_dirent.h | 82 ++++++++++++++++++++++++ include/user/kernel/iofilemgr_stat.h | 101 ++++++++++++++++++++++++++++++ include/user/kernel/iofilemgr_syscall.h | 79 +++++++++++++++++++++++ 20 files changed, 734 insertions(+), 734 deletions(-) delete mode 100644 include/common/kernel/iofilemgr/async.h delete mode 100644 include/common/kernel/iofilemgr/dirent.h delete mode 100644 include/common/kernel/iofilemgr/stat.h create mode 100644 include/common/kernel/iofilemgr_async.h create mode 100644 include/common/kernel/iofilemgr_dirent.h create mode 100644 include/common/kernel/iofilemgr_stat.h delete mode 100644 include/kernel/kernel/iofilemgr/async.h delete mode 100644 include/kernel/kernel/iofilemgr/dirent.h delete mode 100644 include/kernel/kernel/iofilemgr/stat.h create mode 100644 include/kernel/kernel/iofilemgr_async.h create mode 100644 include/kernel/kernel/iofilemgr_dirent.h create mode 100644 include/kernel/kernel/iofilemgr_stat.h delete mode 100644 include/user/kernel/iofilemgr/async.h delete mode 100644 include/user/kernel/iofilemgr/dirent.h delete mode 100644 include/user/kernel/iofilemgr/stat.h delete mode 100644 include/user/kernel/iofilemgr/syscall.h create mode 100644 include/user/kernel/iofilemgr_async.h create mode 100644 include/user/kernel/iofilemgr_dirent.h create mode 100644 include/user/kernel/iofilemgr_stat.h create mode 100644 include/user/kernel/iofilemgr_syscall.h (limited to 'include') diff --git a/include/common/kernel/iofilemgr/async.h b/include/common/kernel/iofilemgr/async.h deleted file mode 100644 index b0c0feb..0000000 --- a/include/common/kernel/iofilemgr/async.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ -#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SceIoAsyncParam { - int result; // [out] result of the IO operation (e.g. UID, read/wrote size, error code) - int unk_04; // [out] - int unk_08; // [in] - int unk_0C; // [out] - int unk_10; // [out] - int unk_14; // [out] -} SceIoAsyncParam; - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/common/kernel/iofilemgr/dirent.h b/include/common/kernel/iofilemgr/dirent.h deleted file mode 100644 index 1e28c22..0000000 --- a/include/common/kernel/iofilemgr/dirent.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ -#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ - -#include -#include - -#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; - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/common/kernel/iofilemgr/stat.h b/include/common/kernel/iofilemgr/stat.h deleted file mode 100644 index 4afea74..0000000 --- a/include/common/kernel/iofilemgr/stat.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ -#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Filetypes and Protection bits */ -#define SCE_STM_FMT (0xf << 12) -#define SCE_STM_FREG (0x2 << 12) /* regular file */ -#define SCE_STM_FDIR (0x1 << 12) /* directory */ -#define SCE_STM_ISREG(m) (((m) & SCE_STM_FMT) == SCE_STM_FREG) -#define SCE_STM_ISDIR(m) (((m) & SCE_STM_FMT) == SCE_STM_FDIR) - -/* for SceMode */ -#define SCE_STM_RWU 00600 -#define SCE_STM_RU 00400 -#define SCE_STM_RWO 00006 -#define SCE_STM_RO 00004 - -/* for chstat cbit */ -#define SCE_CST_MODE 0x0001 -#define SCE_CST_ATTR 0x0000 /* not supported */ -#define SCE_CST_SIZE 0x0004 -#define SCE_CST_CT 0x0008 -#define SCE_CST_AT 0x0010 -#define SCE_CST_MT 0x0020 - -/** - * See sceIoChstat(), sceIoGetstat(), sceIoChstatByFd(), sceIoGetstatByFd() - */ -typedef struct SceIoStat { - SceIoMode st_mode; //!< File access mode - unsigned int st_attr; //!< Device-specific attribute - SceOff st_size; //!< File size - SceDateTime st_ctime; //!< File creation time - SceDateTime st_atime; //!< File last accessed time - SceDateTime st_mtime; //!< File last modified time - unsigned int st_private[6]; //!< Reserved -} SceIoStat; - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/common/kernel/iofilemgr_async.h b/include/common/kernel/iofilemgr_async.h new file mode 100644 index 0000000..b0c0feb --- /dev/null +++ b/include/common/kernel/iofilemgr_async.h @@ -0,0 +1,21 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SceIoAsyncParam { + int result; // [out] result of the IO operation (e.g. UID, read/wrote size, error code) + int unk_04; // [out] + int unk_08; // [in] + int unk_0C; // [out] + int unk_10; // [out] + int unk_14; // [out] +} SceIoAsyncParam; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/common/kernel/iofilemgr_dirent.h b/include/common/kernel/iofilemgr_dirent.h new file mode 100644 index 0000000..1e28c22 --- /dev/null +++ b/include/common/kernel/iofilemgr_dirent.h @@ -0,0 +1,23 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ + +#include +#include + +#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; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/common/kernel/iofilemgr_stat.h b/include/common/kernel/iofilemgr_stat.h new file mode 100644 index 0000000..4afea74 --- /dev/null +++ b/include/common/kernel/iofilemgr_stat.h @@ -0,0 +1,48 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Filetypes and Protection bits */ +#define SCE_STM_FMT (0xf << 12) +#define SCE_STM_FREG (0x2 << 12) /* regular file */ +#define SCE_STM_FDIR (0x1 << 12) /* directory */ +#define SCE_STM_ISREG(m) (((m) & SCE_STM_FMT) == SCE_STM_FREG) +#define SCE_STM_ISDIR(m) (((m) & SCE_STM_FMT) == SCE_STM_FDIR) + +/* for SceMode */ +#define SCE_STM_RWU 00600 +#define SCE_STM_RU 00400 +#define SCE_STM_RWO 00006 +#define SCE_STM_RO 00004 + +/* for chstat cbit */ +#define SCE_CST_MODE 0x0001 +#define SCE_CST_ATTR 0x0000 /* not supported */ +#define SCE_CST_SIZE 0x0004 +#define SCE_CST_CT 0x0008 +#define SCE_CST_AT 0x0010 +#define SCE_CST_MT 0x0020 + +/** + * See sceIoChstat(), sceIoGetstat(), sceIoChstatByFd(), sceIoGetstatByFd() + */ +typedef struct SceIoStat { + SceIoMode st_mode; //!< File access mode + unsigned int st_attr; //!< Device-specific attribute + SceOff st_size; //!< File size + SceDateTime st_ctime; //!< File creation time + SceDateTime st_atime; //!< File last accessed time + SceDateTime st_mtime; //!< File last modified time + unsigned int st_private[6]; //!< Reserved +} SceIoStat; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/kernel/kernel/iofilemgr/async.h b/include/kernel/kernel/iofilemgr/async.h deleted file mode 100644 index 4584bb7..0000000 --- a/include/kernel/kernel/iofilemgr/async.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ -#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Async IO operations are scheduled automatically, similar to FIOS2. - * You can make calls to sceIoOpenAsync(), sceIoReadAsync(), - * sceIoCloseAsync() right after each other, they will be put in a schedule - * and performed automatically. - * - * All async IO functions return UID of operation handle, not file descriptor UID. - */ - -/** - * Cancel an asynchronous operation. - * - * @param opHandle - The operation handle to perform cancel on. - * - * @return < 0 on error. If operation has been canceled(finished) already, returns 0x80010002 - */ -int sceIoCancel(SceUID opHandle); - -/** - * Complete an asynchronous operation. - * - * @param opHandle - The operation handle to complete. - * - * @return < 0 on error. - */ -int sceIoComplete(SceUID opHandle); - -/** - * Wait until asynchronous operation has been finished. - * - * @param opHandle - The operation handle to wait for. - * - * @return < 0 on error. - */ -inline -int sceIoWaitAsync(SceUID opHandle) -{ - int ret = sceKernelWaitEvent(opHandle, 1, NULL, NULL, NULL); - if (ret == 0) - return sceIoComplete(opHandle); - else - return ret; -} - -/** - * Wait until asynchronous operation has been finished with callbacks. - * - * @param opHandle - The operation handle to wait for. - * - * @return < 0 on error. - */ -inline -int sceIoWaitAsyncCB(SceUID opHandle) -{ - int ret = sceKernelWaitEventCB(opHandle, 1, NULL, NULL, NULL); - if (ret == 0) - return sceIoComplete(opHandle); - else - return ret; -} - -/** - * Poll asynchronous operation status. - * - * @param opHandle - The operation handle to poll status for. - * - * @return < 0 on error or if operation is not finished. - */ -inline -int sceIoPollAsync(SceUID opHandle) -{ - int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); - if (ret == 0) - return sceIoComplete(opHandle); - else - return ret; -} - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/kernel/kernel/iofilemgr/dirent.h b/include/kernel/kernel/iofilemgr/dirent.h deleted file mode 100644 index 4bfc584..0000000 --- a/include/kernel/kernel/iofilemgr/dirent.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ -#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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); - -/** - * Open a directory (asynchronous) - * - * @param dirname - The directory to open for reading. - * @param asyncParam - parameters related to async operation. - * - * @return If >= 0 then a valid op handle, otherwise a Sony error code. - */ -SceUID sceIoDopenAsync(const char *dirname, SceIoAsyncParam* asyncParam); - -/** - * Reads an entry from an opened file descriptor (asynchronous) - * - * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) - * @param dir - Pointer to a ::SceIoDirent structure to hold the file information - * @param asyncParam - parameters related to async operation. - * - * @return If >= 0 then a valid op handle, otherwise a Sony error code. - */ -SceUID sceIoDreadAsync(SceUID fd, SceIoDirent *dir, SceIoAsyncParam* asyncParam); - -/** - * Close an opened directory file descriptor (asynchronous) - * - * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) - * @param asyncParam - parameters related to async operation. - * - * @return If >= 0 then a valid op handle, otherwise a Sony error code. - */ -SceUID sceIoDcloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/kernel/kernel/iofilemgr/stat.h b/include/kernel/kernel/iofilemgr/stat.h deleted file mode 100644 index c9096e2..0000000 --- a/include/kernel/kernel/iofilemgr/stat.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ -#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Change the status of a file. - * - * @param name - The path to the file. - * @param buf - A pointer to a ::SceIoStat structure. - * @param cbit - Bitmask defining which bits to change. - * - * @return < 0 on error. - */ -int sceIoChstat(const char *name, const SceIoStat *buf, unsigned int cbit); - -/** - * Get the status of a file. - * - * @param name - The path to the file. - * @param buf - A pointer to a ::SceIoStat structure. - * - * @return < 0 on error. - */ -int sceIoGetstat(const char *name, SceIoStat *buf); - -/** - * Get the status of a file descriptor. - * - * @param fd - The file descriptor. - * @param buf - A pointer to a ::SceIoStat structure. - * - * @return < 0 on error. - */ -int sceIoGetstatByFd(SceUID fd, SceIoStat *buf); - -/** - * Change the status of a file descriptor. - * - * @param fd - The file descriptor. - * @param buf - A pointer to an io_stat_t structure. - * @param cbit - Bitmask defining which bits to change. - * - * @return < 0 on error. - */ -int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit); - -/** - * Make a directory file (asynchronous) - * - * @param dir - The path to the directory - * @param mode - Access mode (One or more ::SceIoAccessMode). - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoMkdirAsync(const char *dir, SceMode mode, SceIoAsyncParam* asyncParam); - -/** - * Remove a directory file (asynchronous) - * - * @param path - Removes a directory file pointed by the string path - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoRmdirAsync(const char *path, SceIoAsyncParam* asyncParam); - -/** - * Get the status of a file (asynchronous) - * - * @param file - The path to the file. - * @param stat - A pointer to a ::SceIoStat structure. - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoGetstatAsync(const char *file, SceIoStat *stat, SceIoAsyncParam* asyncParam); - -/** - * Change the status of a file (asynchronous) - * - * @param file - The path to the file. - * @param stat - A pointer to a ::SceIoStat structure. - * @param bits - Bitmask defining which bits to change. - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoChstatAsync(const char *file, SceIoStat *stat, int bits, SceIoAsyncParam* asyncParam); - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/kernel/kernel/iofilemgr_async.h b/include/kernel/kernel/iofilemgr_async.h new file mode 100644 index 0000000..4584bb7 --- /dev/null +++ b/include/kernel/kernel/iofilemgr_async.h @@ -0,0 +1,93 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Async IO operations are scheduled automatically, similar to FIOS2. + * You can make calls to sceIoOpenAsync(), sceIoReadAsync(), + * sceIoCloseAsync() right after each other, they will be put in a schedule + * and performed automatically. + * + * All async IO functions return UID of operation handle, not file descriptor UID. + */ + +/** + * Cancel an asynchronous operation. + * + * @param opHandle - The operation handle to perform cancel on. + * + * @return < 0 on error. If operation has been canceled(finished) already, returns 0x80010002 + */ +int sceIoCancel(SceUID opHandle); + +/** + * Complete an asynchronous operation. + * + * @param opHandle - The operation handle to complete. + * + * @return < 0 on error. + */ +int sceIoComplete(SceUID opHandle); + +/** + * Wait until asynchronous operation has been finished. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsync(SceUID opHandle) +{ + int ret = sceKernelWaitEvent(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Wait until asynchronous operation has been finished with callbacks. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsyncCB(SceUID opHandle) +{ + int ret = sceKernelWaitEventCB(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Poll asynchronous operation status. + * + * @param opHandle - The operation handle to poll status for. + * + * @return < 0 on error or if operation is not finished. + */ +inline +int sceIoPollAsync(SceUID opHandle) +{ + int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/kernel/kernel/iofilemgr_dirent.h b/include/kernel/kernel/iofilemgr_dirent.h new file mode 100644 index 0000000..4bfc584 --- /dev/null +++ b/include/kernel/kernel/iofilemgr_dirent.h @@ -0,0 +1,82 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * 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); + +/** + * Open a directory (asynchronous) + * + * @param dirname - The directory to open for reading. + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDopenAsync(const char *dirname, SceIoAsyncParam* asyncParam); + +/** + * Reads an entry from an opened file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param dir - Pointer to a ::SceIoDirent structure to hold the file information + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDreadAsync(SceUID fd, SceIoDirent *dir, SceIoAsyncParam* asyncParam); + +/** + * Close an opened directory file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDcloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/kernel/kernel/iofilemgr_stat.h b/include/kernel/kernel/iofilemgr_stat.h new file mode 100644 index 0000000..c9096e2 --- /dev/null +++ b/include/kernel/kernel/iofilemgr_stat.h @@ -0,0 +1,101 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Change the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstat(const char *name, const SceIoStat *buf, unsigned int cbit); + +/** + * Get the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstat(const char *name, SceIoStat *buf); + +/** + * Get the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstatByFd(SceUID fd, SceIoStat *buf); + +/** + * Change the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to an io_stat_t structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit); + +/** + * Make a directory file (asynchronous) + * + * @param dir - The path to the directory + * @param mode - Access mode (One or more ::SceIoAccessMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoMkdirAsync(const char *dir, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Remove a directory file (asynchronous) + * + * @param path - Removes a directory file pointed by the string path + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRmdirAsync(const char *path, SceIoAsyncParam* asyncParam); + +/** + * Get the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoGetstatAsync(const char *file, SceIoStat *stat, SceIoAsyncParam* asyncParam); + +/** + * Change the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param bits - Bitmask defining which bits to change. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoChstatAsync(const char *file, SceIoStat *stat, int bits, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/user/kernel/iofilemgr/async.h b/include/user/kernel/iofilemgr/async.h deleted file mode 100644 index 77fac3d..0000000 --- a/include/user/kernel/iofilemgr/async.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ -#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Async IO operations are scheduled automatically, similar to FIOS2. - * You can make calls to sceIoOpenAsync(), sceIoReadAsync(), - * sceIoCloseAsync() right after each other, they will be put in a schedule - * and performed automatically. - * - * All async IO functions return UID of operation handle, not file descriptor UID. - */ - -/** - * Cancel an asynchronous operation. - * - * @param opHandle - The operation handle to perform cancel on. - * - * @return < 0 on error. If operation has been canceled(finished) already, returns 0x80010002 - */ -int sceIoCancel(SceUID opHandle); - -/** - * Complete an asynchronous operation. - * - * @param opHandle - The operation handle to complete. - * - * @return < 0 on error. - */ -int sceIoComplete(SceUID opHandle); - -/** - * Complete multiple asynchronous operations. - * - * @param asyncParam - Array of ::SceIoAsyncParam representing IO operations to complete. retVal member must have opHandle value assigned to it. - * @param numOfParam - Number of ::SceIoAsyncParam structs in asyncParam array - * @param numOfCompleted - Number of operations that has been completed successfully - * - * @return < 0 on last encountered error. - */ -int sceIoCompleteMultiple(SceIoAsyncParam* asyncParam, int numOfParam, int* numOfCompleted); - -/** - * Wait until asynchronous operation has been finished. - * - * @param opHandle - The operation handle to wait for. - * - * @return < 0 on error. - */ -inline -int sceIoWaitAsync(SceUID opHandle) -{ - int ret = sceKernelWaitEvent(opHandle, 1, NULL, NULL, NULL); - if (ret == 0) - return sceIoComplete(opHandle); - else - return ret; -} - -/** - * Wait until asynchronous operation has been finished with callbacks. - * - * @param opHandle - The operation handle to wait for. - * - * @return < 0 on error. - */ -inline -int sceIoWaitAsyncCB(SceUID opHandle) -{ - int ret = sceKernelWaitEventCB(opHandle, 1, NULL, NULL, NULL); - if (ret == 0) - return sceIoComplete(opHandle); - else - return ret; -} - -/** - * Poll asynchronous operation status. - * - * @param opHandle - The operation handle to poll status for. - * - * @return < 0 on error or if operation is not finished. - */ -inline -int sceIoPollAsync(SceUID opHandle) -{ - int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); - if (ret == 0) - return sceIoComplete(opHandle); - else - return ret; -} - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/user/kernel/iofilemgr/dirent.h b/include/user/kernel/iofilemgr/dirent.h deleted file mode 100644 index c518a08..0000000 --- a/include/user/kernel/iofilemgr/dirent.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ -#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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); - -/** - * Open a directory (asynchronous) - * - * @param dirname - The directory to open for reading. - * @param asyncParam - parameters related to async operation. - * - * @return If >= 0 then a valid op handle, otherwise a Sony error code. - */ -SceUID sceIoDopenAsync(const char *dirname, SceIoAsyncParam* asyncParam); - -/** - * Reads an entry from an opened file descriptor (asynchronous) - * - * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) - * @param dir - Pointer to a ::SceIoDirent structure to hold the file information - * @param asyncParam - parameters related to async operation. - * - * @return If >= 0 then a valid op handle, otherwise a Sony error code. - */ -SceUID sceIoDreadAsync(SceUID fd, SceIoDirent *dir, SceIoAsyncParam* asyncParam); - -/** - * Close an opened directory file descriptor (asynchronous) - * - * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) - * @param asyncParam - parameters related to async operation. - * - * @return If >= 0 then a valid op handle, otherwise a Sony error code. - */ -SceUID sceIoDcloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/user/kernel/iofilemgr/stat.h b/include/user/kernel/iofilemgr/stat.h deleted file mode 100644 index b0b57f6..0000000 --- a/include/user/kernel/iofilemgr/stat.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ -#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Change the status of a file. - * - * @param name - The path to the file. - * @param buf - A pointer to a ::SceIoStat structure. - * @param cbit - Bitmask defining which bits to change. - * - * @return < 0 on error. - */ -int sceIoChstat(const char *name, const SceIoStat *buf, unsigned int cbit); - -/** - * Get the status of a file. - * - * @param name - The path to the file. - * @param buf - A pointer to a ::SceIoStat structure. - * - * @return < 0 on error. - */ -int sceIoGetstat(const char *name, SceIoStat *buf); - -/** - * Get the status of a file descriptor. - * - * @param fd - The file descriptor. - * @param buf - A pointer to a ::SceIoStat structure. - * - * @return < 0 on error. - */ -int sceIoGetstatByFd(SceUID fd, SceIoStat *buf); - -/** - * Change the status of a file descriptor. - * - * @param fd - The file descriptor. - * @param buf - A pointer to an io_stat_t structure. - * @param cbit - Bitmask defining which bits to change. - * - * @return < 0 on error. - */ -int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit); - -/** - * Make a directory file (asynchronous) - * - * @param dir - The path to the directory - * @param mode - Access mode (One or more ::SceIoAccessMode). - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoMkdirAsync(const char *dir, SceMode mode, SceIoAsyncParam* asyncParam); - -/** - * Remove a directory file (asynchronous) - * - * @param path - Removes a directory file pointed by the string path - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoRmdirAsync(const char *path, SceIoAsyncParam* asyncParam); - -/** - * Get the status of a file (asynchronous) - * - * @param file - The path to the file. - * @param stat - A pointer to a ::SceIoStat structure. - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoGetstatAsync(const char *file, SceIoStat *stat, SceIoAsyncParam* asyncParam); - -/** - * Change the status of a file (asynchronous) - * - * @param file - The path to the file. - * @param stat - A pointer to a ::SceIoStat structure. - * @param bits - Bitmask defining which bits to change. - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoChstatAsync(const char *file, SceIoStat *stat, int bits, SceIoAsyncParam* asyncParam); - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/user/kernel/iofilemgr/syscall.h b/include/user/kernel/iofilemgr/syscall.h deleted file mode 100644 index a72039c..0000000 --- a/include/user/kernel/iofilemgr/syscall.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ -#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Struct definitions */ - -typedef struct SceIoUnusedSyscallParam0x8 { - char unused[0x8]; -} SceIoUnusedSyscallParam0x8; - -typedef struct SceIoUnusedSyscallParam0x10 { - char unused[0x10]; -} SceIoUnusedSyscallParam0x10; - -typedef struct SceIoDevctlSyscallParam { - SceSize arglen; - void *bufp; - SceSize buflen; - char unused[0xC]; - // size 0x18 -} SceIoDevctlSyscallParam; - -typedef struct SceIoIoctlSyscallParam { - SceSize arglen; - void *bufp; - SceSize buflen; - char unused[0x4]; - // size 0x10 -} SceIoIoctlSyscallParam; - -typedef struct SceIoLseekSyscallParam { - SceOff offset; - int whence; - char unused[0x4]; - // size 0x10 -} SceIoLseekSyscallParam; - -typedef struct SceIoPreadSyscallParam { - SceOff offset; - char unused[0x8]; - // size 0x10 -} SceIoPreadSyscallParam; - -typedef SceIoPreadSyscallParam SceIoPwriteSyscallParam; - -/* Function declarations */ - -SceUID _sceIoRemove(const char *filename, SceIoUnusedSyscallParam0x8* param); - -int _sceIoMkdir(const char *dirname, SceIoMode mode, SceIoUnusedSyscallParam0x8* param); - -int _sceIoRmdir(const char *dirname, SceIoUnusedSyscallParam0x8* param); - -int _sceIoRename(const char *oldname, const char *newname, SceIoUnusedSyscallParam0x10* param); - -int _sceIoDevctl(const char *devname, int cmd, const void *arg, SceIoDevctlSyscallParam* param); - -int _sceIoSync(const char *devname, int flag, SceIoUnusedSyscallParam0x8* param); - -SceUID _sceIoOpen(const char *filename, int flag, SceIoMode mode, SceIoUnusedSyscallParam0x8* param); - -int _sceIoIoctl(SceUID fd, int cmd, const void *argp, SceIoIoctlSyscallParam* param); - -SceOff _sceIoLseek(SceUID fd, SceIoLseekSyscallParam* param); - -SceSSize _sceIoPread(SceUID fd, void *buf, SceSize nbyte, SceIoPreadSyscallParam* param); - -SceSSize _sceIoPwrite(SceUID fd, const void *buf, SceSize nbyte, SceIoPwriteSyscallParam* param); - -#ifdef __cplusplus -} -#endif - -#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ */ diff --git a/include/user/kernel/iofilemgr_async.h b/include/user/kernel/iofilemgr_async.h new file mode 100644 index 0000000..77fac3d --- /dev/null +++ b/include/user/kernel/iofilemgr_async.h @@ -0,0 +1,104 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Async IO operations are scheduled automatically, similar to FIOS2. + * You can make calls to sceIoOpenAsync(), sceIoReadAsync(), + * sceIoCloseAsync() right after each other, they will be put in a schedule + * and performed automatically. + * + * All async IO functions return UID of operation handle, not file descriptor UID. + */ + +/** + * Cancel an asynchronous operation. + * + * @param opHandle - The operation handle to perform cancel on. + * + * @return < 0 on error. If operation has been canceled(finished) already, returns 0x80010002 + */ +int sceIoCancel(SceUID opHandle); + +/** + * Complete an asynchronous operation. + * + * @param opHandle - The operation handle to complete. + * + * @return < 0 on error. + */ +int sceIoComplete(SceUID opHandle); + +/** + * Complete multiple asynchronous operations. + * + * @param asyncParam - Array of ::SceIoAsyncParam representing IO operations to complete. retVal member must have opHandle value assigned to it. + * @param numOfParam - Number of ::SceIoAsyncParam structs in asyncParam array + * @param numOfCompleted - Number of operations that has been completed successfully + * + * @return < 0 on last encountered error. + */ +int sceIoCompleteMultiple(SceIoAsyncParam* asyncParam, int numOfParam, int* numOfCompleted); + +/** + * Wait until asynchronous operation has been finished. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsync(SceUID opHandle) +{ + int ret = sceKernelWaitEvent(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Wait until asynchronous operation has been finished with callbacks. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsyncCB(SceUID opHandle) +{ + int ret = sceKernelWaitEventCB(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Poll asynchronous operation status. + * + * @param opHandle - The operation handle to poll status for. + * + * @return < 0 on error or if operation is not finished. + */ +inline +int sceIoPollAsync(SceUID opHandle) +{ + int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/user/kernel/iofilemgr_dirent.h b/include/user/kernel/iofilemgr_dirent.h new file mode 100644 index 0000000..c518a08 --- /dev/null +++ b/include/user/kernel/iofilemgr_dirent.h @@ -0,0 +1,82 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * 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); + +/** + * Open a directory (asynchronous) + * + * @param dirname - The directory to open for reading. + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDopenAsync(const char *dirname, SceIoAsyncParam* asyncParam); + +/** + * Reads an entry from an opened file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param dir - Pointer to a ::SceIoDirent structure to hold the file information + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDreadAsync(SceUID fd, SceIoDirent *dir, SceIoAsyncParam* asyncParam); + +/** + * Close an opened directory file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDcloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/user/kernel/iofilemgr_stat.h b/include/user/kernel/iofilemgr_stat.h new file mode 100644 index 0000000..b0b57f6 --- /dev/null +++ b/include/user/kernel/iofilemgr_stat.h @@ -0,0 +1,101 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Change the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstat(const char *name, const SceIoStat *buf, unsigned int cbit); + +/** + * Get the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstat(const char *name, SceIoStat *buf); + +/** + * Get the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstatByFd(SceUID fd, SceIoStat *buf); + +/** + * Change the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to an io_stat_t structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit); + +/** + * Make a directory file (asynchronous) + * + * @param dir - The path to the directory + * @param mode - Access mode (One or more ::SceIoAccessMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoMkdirAsync(const char *dir, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Remove a directory file (asynchronous) + * + * @param path - Removes a directory file pointed by the string path + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRmdirAsync(const char *path, SceIoAsyncParam* asyncParam); + +/** + * Get the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoGetstatAsync(const char *file, SceIoStat *stat, SceIoAsyncParam* asyncParam); + +/** + * Change the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param bits - Bitmask defining which bits to change. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoChstatAsync(const char *file, SceIoStat *stat, int bits, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/user/kernel/iofilemgr_syscall.h b/include/user/kernel/iofilemgr_syscall.h new file mode 100644 index 0000000..a72039c --- /dev/null +++ b/include/user/kernel/iofilemgr_syscall.h @@ -0,0 +1,79 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Struct definitions */ + +typedef struct SceIoUnusedSyscallParam0x8 { + char unused[0x8]; +} SceIoUnusedSyscallParam0x8; + +typedef struct SceIoUnusedSyscallParam0x10 { + char unused[0x10]; +} SceIoUnusedSyscallParam0x10; + +typedef struct SceIoDevctlSyscallParam { + SceSize arglen; + void *bufp; + SceSize buflen; + char unused[0xC]; + // size 0x18 +} SceIoDevctlSyscallParam; + +typedef struct SceIoIoctlSyscallParam { + SceSize arglen; + void *bufp; + SceSize buflen; + char unused[0x4]; + // size 0x10 +} SceIoIoctlSyscallParam; + +typedef struct SceIoLseekSyscallParam { + SceOff offset; + int whence; + char unused[0x4]; + // size 0x10 +} SceIoLseekSyscallParam; + +typedef struct SceIoPreadSyscallParam { + SceOff offset; + char unused[0x8]; + // size 0x10 +} SceIoPreadSyscallParam; + +typedef SceIoPreadSyscallParam SceIoPwriteSyscallParam; + +/* Function declarations */ + +SceUID _sceIoRemove(const char *filename, SceIoUnusedSyscallParam0x8* param); + +int _sceIoMkdir(const char *dirname, SceIoMode mode, SceIoUnusedSyscallParam0x8* param); + +int _sceIoRmdir(const char *dirname, SceIoUnusedSyscallParam0x8* param); + +int _sceIoRename(const char *oldname, const char *newname, SceIoUnusedSyscallParam0x10* param); + +int _sceIoDevctl(const char *devname, int cmd, const void *arg, SceIoDevctlSyscallParam* param); + +int _sceIoSync(const char *devname, int flag, SceIoUnusedSyscallParam0x8* param); + +SceUID _sceIoOpen(const char *filename, int flag, SceIoMode mode, SceIoUnusedSyscallParam0x8* param); + +int _sceIoIoctl(SceUID fd, int cmd, const void *argp, SceIoIoctlSyscallParam* param); + +SceOff _sceIoLseek(SceUID fd, SceIoLseekSyscallParam* param); + +SceSSize _sceIoPread(SceUID fd, void *buf, SceSize nbyte, SceIoPreadSyscallParam* param); + +SceSSize _sceIoPwrite(SceUID fd, const void *buf, SceSize nbyte, SceIoPwriteSyscallParam* param); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ */ -- cgit v1.2.3