From e16dc8725d0e38259cf7a31462276ffd4e970e77 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 19 Feb 2022 17:45:15 +0100 Subject: [PATCH] nn_temp: Add missing functions --- include/nn/temp.h | 7 + include/nn/temp/temp.h | 219 ++++++++++++++++++ .../test_compile_headers_list.h | 2 + 3 files changed, 228 insertions(+) create mode 100644 include/nn/temp.h create mode 100644 include/nn/temp/temp.h diff --git a/include/nn/temp.h b/include/nn/temp.h new file mode 100644 index 00000000..c5849bef --- /dev/null +++ b/include/nn/temp.h @@ -0,0 +1,7 @@ +#pragma once + +/** + * \defgroup nn_temp nn_temp + */ + +#include diff --git a/include/nn/temp/temp.h b/include/nn/temp/temp.h new file mode 100644 index 00000000..da361533 --- /dev/null +++ b/include/nn/temp/temp.h @@ -0,0 +1,219 @@ +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum TEMPTargetPreference +{ + TEMP_PREF_DEFAULT = 0, + TEMP_PREF_INTERNAL_STORAGE = 1, +} TEMPTargetPreference; + +typedef uint64_t TEMPDirId; + +FSStatus +TEMPInit(); + +void +TEMPShutdown(); + +FSStatus +TEMPCreateAndInitTempDir(uint32_t size, + TEMPTargetPreference pref, + TEMPDirId *outDir); + +FSStatus +TEMPShutdownTempDir(TEMPDirId tempId); + +FSStatus +TEMPGetDirGlobalPath(TEMPDirId dirId, + char *path, + uint32_t pathLen); + +FSStatus +TEMPGetDirPath(TEMPDirId dirId, + char *path, + uint32_t pathLen); + +FSStatus +TEMPChangeDir(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSErrorFlag errorMask); + +FSStatus +TEMPChangeDirAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +/* + * Only FS_MODE_READ_OTHER can be set + */ +FSStatus +TEMPChangeOthersMode(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSMode mode, + FSErrorFlag errorMask); + +/* + * Only FS_MODE_READ_OTHER can be set + */ +FSStatus +TEMPChangeOthersModeAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSMode mode, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +FSStatus +TEMPGetFreeSpaceSize(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + uint64_t *outSize, + FSErrorFlag errorMask); + +FSStatus +TEMPGetFreeSpaceSizeAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + uint64_t *outSize, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + + +FSStatus +TEMPGetStat(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSStat *stat, + FSErrorFlag errorMask); + +FSStatus +TEMPGetStatAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSStat *stat, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +FSStatus +TEMPMakeDir(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSErrorFlag errorMask); + +FSStatus +TEMPMakeDirAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + + +FSStatus +TEMPOpenDir(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSDirectoryHandle *handle, + FSErrorFlag errorMask); + +FSStatus +TEMPOpenDirAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSDirectoryHandle *handle, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +FSStatus +TEMPOpenFile(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + const char *mode, + FSFileHandle *handle, + FSErrorFlag errorMask); + +FSStatus +TEMPOpenFileAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + const char *mode, + FSFileHandle *outHandle, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +FSStatus +TEMPRemove(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSErrorFlag errorMask); + +FSStatus +TEMPRemoveAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *path, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +FSStatus +TEMPRename(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *oldPath, + const char *newPath, + FSErrorFlag errorMask); + +FSStatus +TEMPRenameAsync(FSClient *client, + FSCmdBlock *block, + TEMPDirId dirId, + const char *oldPath, + const char *newPath, + FSErrorFlag errorMask, + FSAsyncData *asyncData); + +FSStatus +TEMPMountTempDir(TEMPDirId dirId); + +FSStatus +TEMPUnmountTempDir(TEMPDirId dirId); + +/** + * Always returns FS_STATUS_UNSUPPORTED_CMD + */ +FSStatus +TEMPOpenNewFile(); + +/** + * Always returns FS_STATUS_UNSUPPORTED_CMD + */ +FSStatus +TEMPOpenNewFileAsync(); + +#ifdef __cplusplus +} +#endif + +/** @} */ \ No newline at end of file diff --git a/tests/test_compile_headers_common/test_compile_headers_list.h b/tests/test_compile_headers_common/test_compile_headers_list.h index 8e1fa493..443d0af7 100644 --- a/tests/test_compile_headers_common/test_compile_headers_list.h +++ b/tests/test_compile_headers_common/test_compile_headers_list.h @@ -94,6 +94,7 @@ #include #include #include +#include #include #include #include @@ -104,6 +105,7 @@ #include #include #include +#include #include #include #include