From 6affe2ff291e34edf5ff8169416a4d92f31cceda Mon Sep 17 00:00:00 2001 From: shinyquagsire23 Date: Wed, 24 Aug 2016 15:17:08 -0700 Subject: [PATCH 1/3] Add FSChangeMode and FSGetFreeSpaceSize --- include/coreinit/filesystem.h | 29 +++++++++++++++++++++++++++++ rpl/libcoreinit/exports.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/include/coreinit/filesystem.h b/include/coreinit/filesystem.h index 277ad44..1902357 100644 --- a/include/coreinit/filesystem.h +++ b/include/coreinit/filesystem.h @@ -370,6 +370,35 @@ FSCloseDirAsync(FSClient *client, FSDirectoryHandle handle, uint32_t flags, FSAsyncData *asyncData); +FSStatus +FSChangeMode(FSClient *client, + FSCmdBlock *block, + char *path, + FSMode mode, + uint32_t flags); + +FSStatus +FSChangeModeAsync(FSClient *client, + FSCmdBlock *block, + char *path, + FSMode mode, + uint32_t flags, + FSAsyncData *asyncData); + +FSStatus +FSGetFreeSpaceSize(FSClient *client, + FSCmdBlock *block, + char *path, + u64 *outSize, + uint32_t flags); + +FSStatus +FSGetFreeSpaceSizeAsync(FSClient *client, + FSCmdBlock *block, + char *path, + u64 *outSize, + uint32_t flags, + FSAsyncData *asyncData); FSStatus FSGetStatFile(FSClient *client, diff --git a/rpl/libcoreinit/exports.h b/rpl/libcoreinit/exports.h index 3f546ac..a8f23a8 100644 --- a/rpl/libcoreinit/exports.h +++ b/rpl/libcoreinit/exports.h @@ -138,6 +138,10 @@ EXPORT(FSSetStateChangeNotification); EXPORT(FSGetCwd); EXPORT(FSChangeDir); EXPORT(FSChangeDirAsync); +EXPORT(FSChangeMode); +EXPORT(FSChangeModeAsync); +EXPORT(FSGetFreeSpaceSize); +EXPORT(FSGetFreeSpaceSizeAsync); EXPORT(FSGetStat); EXPORT(FSGetStatAsync); EXPORT(FSRemove); From 98966f020f72de0e817b4dae190e89870f3462c3 Mon Sep 17 00:00:00 2001 From: shinyquagsire23 Date: Fri, 26 Aug 2016 16:23:33 -0700 Subject: [PATCH 2/3] Add FSBindMount and FSBindUnmount --- include/coreinit/filesystem.h | 13 +++++++++++++ rpl/libcoreinit/exports.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/include/coreinit/filesystem.h b/include/coreinit/filesystem.h index 1902357..363bf11 100644 --- a/include/coreinit/filesystem.h +++ b/include/coreinit/filesystem.h @@ -601,6 +601,19 @@ FSUnmount(FSClient *client, const char *target, uint32_t flags); +FSStatus +FSBindMount(FSClient *client, + FSCmdBlock *cmd, + const char *source, + const char *target, + uint32_t flags); + +FSStatus +FSbindUnmount(FSClient *client, + FSCmdBlock *cmd, + const char *target, + uint32_t flags); + #ifdef __cplusplus } #endif diff --git a/rpl/libcoreinit/exports.h b/rpl/libcoreinit/exports.h index a8f23a8..61417f1 100644 --- a/rpl/libcoreinit/exports.h +++ b/rpl/libcoreinit/exports.h @@ -184,6 +184,8 @@ EXPORT(FSGetLastErrorCodeForViewer); EXPORT(FSGetMountSource); EXPORT(FSMount); EXPORT(FSUnmount); +EXPORT(FSBindMount); +EXPORT(FSBindUnmount); // coreinit/foreground.h EXPORT(OSEnableForegroundExit); From 6d371d35bffb0cd819663fd2838ecf5c99e35543 Mon Sep 17 00:00:00 2001 From: shinyquagsire23 Date: Fri, 26 Aug 2016 16:35:30 -0700 Subject: [PATCH 3/3] Implement fs_chmod in devoptab --- crt/fs_dev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crt/fs_dev.c b/crt/fs_dev.c index 45f7aa3..9f5bdee 100644 --- a/crt/fs_dev.c +++ b/crt/fs_dev.c @@ -938,10 +938,14 @@ fs_chmod(struct _reent *r, return -1; } + rc = FSChangeMode(fsClient, fsCmd, path_fix, (FSMode)mode, -1) free(path_fix); - //TODO: FSChangeMode - r->_errno = ENOSYS; + if (rc >= 0) { + return 0; + } + + r->_errno = fs_translate_error(rc); return -1; } @@ -950,7 +954,8 @@ fs_fchmod(struct _reent *r, int fd, mode_t mode) { - //TODO: FSChangeMode + //TODO: FSChangeMode and FSStatFile? + r->_errno = ENOSYS; return -1; }