wutdevoptab: Implement devoptab using FSA functions

This commit is contained in:
Maschell
2022-08-09 12:53:58 +02:00
committed by Dave Murphy
parent e492c31d06
commit 4083224b51
28 changed files with 928 additions and 541 deletions

View File

@@ -1,32 +1,37 @@
#include "devoptab_fsa.h"
int
__wut_fs_mkdir(struct _reent *r,
const char *path,
int mode)
{
FSStatus status;
FSCmdBlock cmd;
__wut_fsa_mkdir(struct _reent *r,
const char *path,
int mode) {
FSError status;
char *fixedPath;
__wut_fsa_device_t *deviceData;
if (!path) {
r->_errno = EINVAL;
return -1;
}
fixedPath = __wut_fs_fixpath(r, path);
fixedPath = __wut_fsa_fixpath(r, path);
if (!fixedPath) {
r->_errno = ENOMEM;
return -1;
}
// TODO: Use mode to set directory attributes.
FSInitCmdBlock(&cmd);
status = FSMakeDir(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL);
free(fixedPath);
deviceData = (__wut_fsa_device_t *) r->deviceData;
FSMode translatedMode = __wut_fsa_translate_permission_mode(mode);
status = FSAMakeDir(deviceData->clientHandle, fixedPath, translatedMode);
if (status < 0) {
r->_errno = __wut_fs_translate_error(status);
WUT_DEBUG_REPORT("FSAMakeDir(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;
}