diff options
author | Reiko Asakura | 2021-01-20 14:35:50 -0500 |
---|---|---|
committer | Reiko Asakura | 2021-01-20 14:35:50 -0500 |
commit | 3146cc34a4b86cc9d6c1843ca27c128e67baf23a (patch) | |
tree | 73afa97644dcbd29c1af5414ddafde782f39949c | |
parent | Remove dupe: iofilemgr (diff) | |
download | vds-libraries-3146cc34a4b86cc9d6c1843ca27c128e67baf23a.tar.gz |
Merge common: iofilemgr
-rw-r--r-- | include/common/kernel/iofilemgr.h | 40 | ||||
-rw-r--r-- | include/common/kernel/iofilemgr_async.h | 308 | ||||
-rw-r--r-- | include/kernel/kernel/iofilemgr.h | 193 | ||||
-rw-r--r-- | include/kernel/kernel/iofilemgr_async.h | 92 | ||||
-rw-r--r-- | include/kernel/kernel/iofilemgr_dirent.h | 46 | ||||
-rw-r--r-- | include/kernel/kernel/iofilemgr_stat.h | 60 | ||||
-rw-r--r-- | include/user/kernel/iofilemgr.h | 193 | ||||
-rw-r--r-- | include/user/kernel/iofilemgr_async.h | 69 | ||||
-rw-r--r-- | include/user/kernel/iofilemgr_dirent.h | 47 | ||||
-rw-r--r-- | include/user/kernel/iofilemgr_stat.h | 60 |
10 files changed, 348 insertions, 760 deletions
diff --git a/include/common/kernel/iofilemgr.h b/include/common/kernel/iofilemgr.h index af06e97..d007959 100644 --- a/include/common/kernel/iofilemgr.h +++ b/include/common/kernel/iofilemgr.h @@ -17,6 +17,46 @@ typedef struct SceIoDevInfo { void *unk; } SceIoDevInfo; +/*--------------------IO Priority--------------------*/ + +/*Valid priority values range: 1 (highest) - 15 (lowest). Default priority value is 14*/ + +/** + * Set IO operations priority for file descriptor for non-game application + * + * @param fd - File UID + * @param priority - IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetPriorityForSystem(SceUID fd, int priority); + +/** + * Get IO operations priority for file descriptor for non-game application + * + * @param fd - File UID + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetPriorityForSystem(SceUID fd); + +/** + * Set IO operations priority for caller thread for non-game + * application (will be default for all new IO operations) + * + * @param priority - New default IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetThreadDefaultPriorityForSystem(int priority); + +/** + * Get IO operations priority for thread for non-game application + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetThreadDefaultPriorityForSystem(void); + #ifdef __cplusplus } #endif diff --git a/include/common/kernel/iofilemgr_async.h b/include/common/kernel/iofilemgr_async.h index 7147f5a..537600e 100644 --- a/include/common/kernel/iofilemgr_async.h +++ b/include/common/kernel/iofilemgr_async.h @@ -7,6 +7,15 @@ 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. + */ + typedef struct SceIoAsyncParam { int result; // [out] result of the IO operation (e.g. UID, read/wrote size, error code) int unk_04; // [out] @@ -16,6 +25,305 @@ typedef struct SceIoAsyncParam { int unk_14; // [out] } SceIoAsyncParam; +/** + * Remove directory entry (asynchronous) + * + * @param file - Path to the file to remove + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +int sceIoRemoveAsync(const char *file, SceIoAsyncParam* asyncParam); + +/** + * Change the name of a file (asynchronous) + * + * @param oldname - The old filename + * @param newname - The new filename + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRenameAsync(const char *oldname, const char *newname, SceIoAsyncParam* asyncParam); + +/** + * Open or create a file for reading or writing (asynchronous) + * + * @param file - Pointer to a string holding the name of the file to open + * @param flags - Libc styled flags that are or'ed together + * @param mode - File access mode (One or more ::SceIoMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Delete a descriptor (asynchronous) + * + * @param fd - File descriptor to close + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoCloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +/** + * Read input (asynchronous) + * + * @param fd - Opened file descriptor to read from + * @param data - Pointer to the buffer where the read data will be placed + * @param size - Size of the read in bytes + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoReadAsync(SceUID fd, void *data, SceSize size, SceIoAsyncParam* asyncParam); + +/** + * Read input at offset (asynchronous) + * + * @param fd - Opened file descriptor to read from + * @param data - Pointer to the buffer where the read data will be placed + * @param size - Size of the read in bytes + * @param offset - Offset to read + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoPreadAsync(SceUID fd, void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); + +/** + * Write output (asynchronous) + * + * @param fd - Opened file descriptor to write to + * @param data - Pointer to the data to write + * @param size - Size of data to write + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoWriteAsync(SceUID fd, const void *data, SceSize size, SceIoAsyncParam* asyncParam); + +/** + * Write output at offset (asynchronous) + * + * @param fd - Opened file descriptor to write to + * @param data - Pointer to the data to write + * @param size - Size of data to write + * @param offset - Offset to write + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoPwriteAsync(SceUID fd, const void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); + +/** + * Reposition read/write file descriptor offset (asynchronous) + * + * @param fd - Opened file descriptor with which to seek + * @param offset - Relative offset from the start position given by whence + * @param whence - One of ::SceIoSeekMode. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoLseekAsync(SceUID fd, SceOff offset, int whence, SceIoAsyncParam* asyncParam); + +/** + * Synchronize device state with state of file or directory being opened + * + * @param fd - Opened file descriptor to sync + * @param fd - Device-dependent flag + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoSyncByFdAsync(SceUID fd, int flag, SceIoAsyncParam* asyncParam); + +/** + * Synchronize device state with memory state + * + * @param fd - Device name + * @param fd - Device-dependent flag + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoSyncAsync(const char* device, int flag, SceIoAsyncParam* asyncParam); + +/** + * This function is unimplemented. + * + * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) + */ +int sceIoIoctlAsync( + SceUID fd, + int cmd, + const void *argp, + SceSize arglen, + void *bufp, + SceSize buflen, + SceIoAsyncParam* asyncParam); + +/** + * This function is unimplemented. + * + * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) + */ +int sceIoDevctlAsync( + const char *devname, + int cmd, + const void *arg, + SceSize arglen, + void *bufp, + SceSize buflen, + SceIoAsyncParam* asyncParam); + +/** + * 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); + +/** + * 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); + +/** + * 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. + */ +static __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. + */ +static __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. + */ +static __inline__ +int sceIoPollAsync(SceUID opHandle) +{ + int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + #ifdef __cplusplus } #endif diff --git a/include/kernel/kernel/iofilemgr.h b/include/kernel/kernel/iofilemgr.h index 9a38b97..771dd3d 100644 --- a/include/kernel/kernel/iofilemgr.h +++ b/include/kernel/kernel/iofilemgr.h @@ -9,187 +9,11 @@ extern "C" { #endif -/*--------------------Async IO--------------------*/ - -/** - * Remove directory entry (asynchronous) - * - * @param file - Path to the file to remove - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -int sceIoRemoveAsync(const char *file, SceIoAsyncParam* asyncParam); - -/** - * Change the name of a file (asynchronous) - * - * @param oldname - The old filename - * @param newname - The new filename - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoRenameAsync(const char *oldname, const char *newname, SceIoAsyncParam* asyncParam); - -/** - * Open or create a file for reading or writing (asynchronous) - * - * @param file - Pointer to a string holding the name of the file to open - * @param flags - Libc styled flags that are or'ed together - * @param mode - File access mode (One or more ::SceIoMode). - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode, SceIoAsyncParam* asyncParam); - -/** - * Delete a descriptor (asynchronous) - * - * @param fd - File descriptor to close - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoCloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); - -/** - * Read input (asynchronous) - * - * @param fd - Opened file descriptor to read from - * @param data - Pointer to the buffer where the read data will be placed - * @param size - Size of the read in bytes - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoReadAsync(SceUID fd, void *data, SceSize size, SceIoAsyncParam* asyncParam); - -/** - * Read input at offset (asynchronous) - * - * @param fd - Opened file descriptor to read from - * @param data - Pointer to the buffer where the read data will be placed - * @param size - Size of the read in bytes - * @param offset - Offset to read - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoPreadAsync(SceUID fd, void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); - -/** - * Write output (asynchronous) - * - * @param fd - Opened file descriptor to write to - * @param data - Pointer to the data to write - * @param size - Size of data to write - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoWriteAsync(SceUID fd, const void *data, SceSize size, SceIoAsyncParam* asyncParam); - -/** - * Write output at offset (asynchronous) - * - * @param fd - Opened file descriptor to write to - * @param data - Pointer to the data to write - * @param size - Size of data to write - * @param offset - Offset to write - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoPwriteAsync(SceUID fd, const void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); - -/** - * Reposition read/write file descriptor offset (asynchronous) - * - * @param fd - Opened file descriptor with which to seek - * @param offset - Relative offset from the start position given by whence - * @param whence - One of ::SceIoSeekMode. - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoLseekAsync(SceUID fd, SceOff offset, int whence, SceIoAsyncParam* asyncParam); - -/** - * Synchronize device state with state of file or directory being opened - * - * @param fd - Opened file descriptor to sync - * @param fd - Device-dependent flag - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoSyncByFdAsync(SceUID fd, int flag, SceIoAsyncParam* asyncParam); - -/** - * Synchronize device state with memory state - * - * @param fd - Device name - * @param fd - Device-dependent flag - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoSyncAsync(const char* device, int flag, SceIoAsyncParam* asyncParam); - -/** - * This function is unimplemented. - * - * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) - */ -int sceIoIoctlAsync( - SceUID fd, - int cmd, - const void *argp, - SceSize arglen, - void *bufp, - SceSize buflen, - SceIoAsyncParam* asyncParam); - -/** - * This function is unimplemented. - * - * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) - */ -int sceIoDevctlAsync( - const char *devname, - int cmd, - const void *arg, - SceSize arglen, - void *bufp, - SceSize buflen, - SceIoAsyncParam* asyncParam); - /*--------------------IO Priority--------------------*/ /*Valid priority values range: 1 (highest) - 15 (lowest). Default priority value is 14*/ /** - * Set IO operations priority for file descriptor for non-game application - * - * @param fd - File UID - * @param priority - IO operations priority - * - * @return < 0 on error. - */ -int sceIoSetPriorityForSystem(SceUID fd, int priority); - -/** - * Get IO operations priority for file descriptor for non-game application - * - * @param fd - File UID - * - * @return A non-negative integer is a valid priority, anything else an error - */ -int sceIoGetPriorityForSystem(SceUID fd); - -/** * Set IO operations priority for caller process (will be default for all new IO operations) * * @param priority - New default IO operations priority @@ -205,23 +29,6 @@ int sceIoSetProcessDefaultPriorityForSystem(int priority); */ int sceIoGetProcessDefaultPriorityForSystem(void); -/** - * Set IO operations priority for caller thread for non-game - * application (will be default for all new IO operations) - * - * @param priority - New default IO operations priority - * - * @return < 0 on error. - */ -int sceIoSetThreadDefaultPriorityForSystem(int priority); - -/** - * Get IO operations priority for thread for non-game application - * - * @return A non-negative integer is a valid priority, anything else an error - */ -int sceIoGetThreadDefaultPriorityForSystem(void); - /*--------------------Device mount functions--------------------*/ /** diff --git a/include/kernel/kernel/iofilemgr_async.h b/include/kernel/kernel/iofilemgr_async.h deleted file mode 100644 index 4d8b3b8..0000000 --- a/include/kernel/kernel/iofilemgr_async.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ -#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ - -#include_next <kernel/iofilemgr_async.h> - -#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 index faa32ef..82635da 100644 --- a/include/kernel/kernel/iofilemgr_dirent.h +++ b/include/kernel/kernel/iofilemgr_dirent.h @@ -1,47 +1 @@ -#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ -#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ - #include_next <kernel/iofilemgr_dirent.h> - -#include <kernel/iofilemgr_async.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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 cfd2b9f..0000000 --- a/include/kernel/kernel/iofilemgr_stat.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ -#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ - -#include_next <kernel/iofilemgr_stat.h> - -#include <kernel/iofilemgr_async.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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.h b/include/user/kernel/iofilemgr.h index 63e7eca..ce8561f 100644 --- a/include/user/kernel/iofilemgr.h +++ b/include/user/kernel/iofilemgr.h @@ -9,163 +9,6 @@ extern "C" { #endif -/*--------------------Async IO--------------------*/ - -/** - * Remove directory entry (asynchronous) - * - * @param file - Path to the file to remove - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -int sceIoRemoveAsync(const char *file, SceIoAsyncParam* asyncParam); - -/** - * Change the name of a file (asynchronous) - * - * @param oldname - The old filename - * @param newname - The new filename - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoRenameAsync(const char *oldname, const char *newname, SceIoAsyncParam* asyncParam); - -/** - * Open or create a file for reading or writing (asynchronous) - * - * @param file - Pointer to a string holding the name of the file to open - * @param flags - Libc styled flags that are or'ed together - * @param mode - File access mode (One or more ::SceIoMode). - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode, SceIoAsyncParam* asyncParam); - -/** - * Delete a descriptor (asynchronous) - * - * @param fd - File descriptor to close - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoCloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); - -/** - * Read input (asynchronous) - * - * @param fd - Opened file descriptor to read from - * @param data - Pointer to the buffer where the read data will be placed - * @param size - Size of the read in bytes - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoReadAsync(SceUID fd, void *data, SceSize size, SceIoAsyncParam* asyncParam); - -/** - * Read input at offset (asynchronous) - * - * @param fd - Opened file descriptor to read from - * @param data - Pointer to the buffer where the read data will be placed - * @param size - Size of the read in bytes - * @param offset - Offset to read - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoPreadAsync(SceUID fd, void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); - -/** - * Write output (asynchronous) - * - * @param fd - Opened file descriptor to write to - * @param data - Pointer to the data to write - * @param size - Size of data to write - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoWriteAsync(SceUID fd, const void *data, SceSize size, SceIoAsyncParam* asyncParam); - -/** - * Write output at offset (asynchronous) - * - * @param fd - Opened file descriptor to write to - * @param data - Pointer to the data to write - * @param size - Size of data to write - * @param offset - Offset to write - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoPwriteAsync(SceUID fd, const void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); - -/** - * Reposition read/write file descriptor offset (asynchronous) - * - * @param fd - Opened file descriptor with which to seek - * @param offset - Relative offset from the start position given by whence - * @param whence - One of ::SceIoSeekMode. - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoLseekAsync(SceUID fd, SceOff offset, int whence, SceIoAsyncParam* asyncParam); - -/** - * Synchronize device state with state of file or directory being opened - * - * @param fd - Opened file descriptor to sync - * @param fd - Device-dependent flag - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoSyncByFdAsync(SceUID fd, int flag, SceIoAsyncParam* asyncParam); - -/** - * Synchronize device state with memory state - * - * @param fd - Device name - * @param fd - Device-dependent flag - * @param asyncParam - parameters related to async operation. - * - * @return A non-negative integer is a valid op handle, anything else an error - */ -SceUID sceIoSyncAsync(const char* device, int flag, SceIoAsyncParam* asyncParam); - -/** - * This function is unimplemented. - * - * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) - */ -int sceIoIoctlAsync( - SceUID fd, - int cmd, - const void *argp, - SceSize arglen, - void *bufp, - SceSize buflen, - SceIoAsyncParam* asyncParam); - -/** - * This function is unimplemented. - * - * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) - */ -int sceIoDevctlAsync( - const char *devname, - int cmd, - const void *arg, - SceSize arglen, - void *bufp, - SceSize buflen, - SceIoAsyncParam* asyncParam); - /*--------------------IO Priority--------------------*/ /*Valid priority values range: 1 (highest) - 15 (lowest). Default priority value is 14*/ @@ -181,16 +24,6 @@ int sceIoDevctlAsync( int sceIoSetPriority(SceUID fd, int priority); /** - * Set IO operations priority for file descriptor for non-game application - * - * @param fd - File UID - * @param priority - IO operations priority - * - * @return < 0 on error. - */ -int sceIoSetPriorityForSystem(SceUID fd, int priority); - -/** * Get IO operations priority for file descriptor * * @param fd - File UID @@ -200,15 +33,6 @@ int sceIoSetPriorityForSystem(SceUID fd, int priority); int sceIoGetPriority(SceUID fd); /** - * Get IO operations priority for file descriptor for non-game application - * - * @param fd - File UID - * - * @return A non-negative integer is a valid priority, anything else an error - */ -int sceIoGetPriorityForSystem(SceUID fd); - -/** * Set IO operations priority for caller process (will be default for all new IO operations) * * @param priority - New default IO operations priority @@ -234,29 +58,12 @@ int sceIoGetProcessDefaultPriority(void); int sceIoSetThreadDefaultPriority(int priority); /** - * Set IO operations priority for caller thread for non-game - * application (will be default for all new IO operations) - * - * @param priority - New default IO operations priority - * - * @return < 0 on error. - */ -int sceIoSetThreadDefaultPriorityForSystem(int priority); - -/** * Get IO operations priority for thread * * @return A non-negative integer is a valid priority, anything else an error */ int sceIoGetThreadDefaultPriority(void); -/** - * Get IO operations priority for thread for non-game application - * - * @return A non-negative integer is a valid priority, anything else an error - */ -int sceIoGetThreadDefaultPriorityForSystem(void); - #ifdef __cplusplus } #endif diff --git a/include/user/kernel/iofilemgr_async.h b/include/user/kernel/iofilemgr_async.h index 21190ee..0c77e66 100644 --- a/include/user/kernel/iofilemgr_async.h +++ b/include/user/kernel/iofilemgr_async.h @@ -17,24 +17,6 @@ extern "C" { */ /** - * 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. @@ -45,57 +27,6 @@ int sceIoComplete(SceUID opHandle); */ 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 diff --git a/include/user/kernel/iofilemgr_dirent.h b/include/user/kernel/iofilemgr_dirent.h deleted file mode 100644 index 741450b..0000000 --- a/include/user/kernel/iofilemgr_dirent.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ -#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ - -#include_next <kernel/iofilemgr_dirent.h> - -#include <kernel/iofilemgr_async.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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 7ec7f79..0000000 --- a/include/user/kernel/iofilemgr_stat.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ -#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ - -#include_next <kernel/iofilemgr_stat.h> - -#include <kernel/iofilemgr_async.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * 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_ */ |