diff options
author | Reiko Asakura | 2020-07-23 21:34:32 -0400 |
---|---|---|
committer | Reiko Asakura | 2020-07-23 21:34:32 -0400 |
commit | 128b6114a5951f3489f9e626cddfe6de54e7fb99 (patch) | |
tree | 5c2f81dfde71f133bb1db7528f6ef80f0b60eb08 /include/common/kernel/iofilemgr | |
parent | Change `pragma GCC warning` to `pragma message` (diff) | |
download | vds-libraries-128b6114a5951f3489f9e626cddfe6de54e7fb99.tar.gz |
Put common IO definitions into psp2common
Diffstat (limited to 'include/common/kernel/iofilemgr')
-rw-r--r-- | include/common/kernel/iofilemgr/async.h | 21 | ||||
-rw-r--r-- | include/common/kernel/iofilemgr/dirent.h | 23 | ||||
-rw-r--r-- | include/common/kernel/iofilemgr/stat.h | 46 |
3 files changed, 90 insertions, 0 deletions
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 <psp2common/kernel/types.h> +#include <psp2common/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; + +#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..a9f9f73 --- /dev/null +++ b/include/common/kernel/iofilemgr/stat.h @@ -0,0 +1,46 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ + +#include <psp2common/kernel/types.h> + +#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 + +/* 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_ */ |