mirror of
https://github.com/devkitPro/wut.git
synced 2026-08-27 05:16:25 -05:00
wutdevoptab: Implement devoptab using FSA functions
This commit is contained in:
@@ -1,34 +1,38 @@
|
||||
#include <sys/stat.h>
|
||||
#include "devoptab_fsa.h"
|
||||
#include <mutex>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int
|
||||
__wut_fs_chmod(struct _reent *r,
|
||||
const char *path,
|
||||
mode_t mode)
|
||||
{
|
||||
FSStatus status;
|
||||
FSCmdBlock cmd;
|
||||
__wut_fsa_chmod(struct _reent *r,
|
||||
const char *path,
|
||||
mode_t mode) {
|
||||
FSError status;
|
||||
__wut_fsa_device_t *deviceData;
|
||||
|
||||
if (!path) {
|
||||
r->_errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *fixedPath = __wut_fs_fixpath(r, path);
|
||||
char *fixedPath = __wut_fsa_fixpath(r, path);
|
||||
if (!fixedPath) {
|
||||
r->_errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
FSMode translatedMode = __wut_fs_translate_permission_mode(mode);
|
||||
FSMode translatedMode = __wut_fsa_translate_permission_mode(mode);
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSChangeMode(__wut_devoptab_fs_client, &cmd, fixedPath,
|
||||
translatedMode, 0x777, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
deviceData = (__wut_fsa_device_t *) r->deviceData;
|
||||
|
||||
status = FSAChangeMode(deviceData->clientHandle, fixedPath, translatedMode);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
WUT_DEBUG_REPORT("FSAChangeMode(0x%08X, %s, 0x%X) failed: %s\n",
|
||||
deviceData->clientHandle, fixedPath, translatedMode, FSAGetStatusStr(status));
|
||||
free(fixedPath);
|
||||
r->_errno = __wut_fsa_translate_error(status);
|
||||
return -1;
|
||||
}
|
||||
free(fixedPath);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user