mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-04 19:44:16 +01:00
wutdevoptab: Use FS_ERROR_FLAG_ALL instead of -1
This commit is contained in:
parent
aa31f61966
commit
510409db7a
@ -18,7 +18,7 @@ __wut_fs_chdir(struct _reent *r,
|
||||
}
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSChangeDir(__wut_devoptab_fs_client, &cmd, fixedPath, -1);
|
||||
status = FSChangeDir(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
|
@ -20,7 +20,7 @@ __wut_fs_chmod(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSChangeMode(__wut_devoptab_fs_client, &cmd, fixedPath,
|
||||
(FSMode)mode, -1);
|
||||
(FSMode)mode, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
|
@ -15,7 +15,7 @@ __wut_fs_close(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
file = (__wut_fs_file_t *)fd;
|
||||
status = FSCloseFile(__wut_devoptab_fs_client, &cmd, file->fd, -1);
|
||||
status = FSCloseFile(__wut_devoptab_fs_client, &cmd, file->fd, FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -15,7 +15,7 @@ __wut_fs_dirclose(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
dir = (__wut_fs_dir_t *)(dirState->dirStruct);
|
||||
status = FSCloseDir(__wut_devoptab_fs_client, &cmd, dir->fd, -1);
|
||||
status = FSCloseDir(__wut_devoptab_fs_client, &cmd, dir->fd, FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -19,7 +19,7 @@ __wut_fs_dirnext(struct _reent *r,
|
||||
dir = (__wut_fs_dir_t *)(dirState->dirStruct);
|
||||
memset(&dir->entry_data, 0, sizeof(dir->entry_data));
|
||||
status = FSReadDir(__wut_devoptab_fs_client, &cmd, dir->fd, &dir->entry_data,
|
||||
-1);
|
||||
FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -22,7 +22,7 @@ __wut_fs_diropen(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
dir = (__wut_fs_dir_t *)(dirState->dirStruct);
|
||||
status = FSOpenDir(__wut_devoptab_fs_client, &cmd, fixedPath, &fd, -1);
|
||||
status = FSOpenDir(__wut_devoptab_fs_client, &cmd, fixedPath, &fd, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
|
@ -15,7 +15,7 @@ __wut_fs_dirreset(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
dir = (__wut_fs_dir_t *)(dirState->dirStruct);
|
||||
status = FSRewindDir(__wut_devoptab_fs_client, &cmd, dir->fd, -1);
|
||||
status = FSRewindDir(__wut_devoptab_fs_client, &cmd, dir->fd, FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -18,7 +18,7 @@ __wut_fs_fstat(struct _reent *r,
|
||||
FSInitCmdBlock(&cmd);
|
||||
file = (__wut_fs_file_t *)fd;
|
||||
status = FSGetStatFile(__wut_devoptab_fs_client, &cmd, file->fd, &fsStat,
|
||||
-1);
|
||||
FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -15,7 +15,7 @@ __wut_fs_fsync(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
file = (__wut_fs_file_t *)fd;
|
||||
status = FSFlushFile(__wut_devoptab_fs_client, &cmd, file->fd, -1);
|
||||
status = FSFlushFile(__wut_devoptab_fs_client, &cmd, file->fd, FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -21,7 +21,7 @@ __wut_fs_mkdir(struct _reent *r,
|
||||
|
||||
// TODO: Use mode to set directory attributes.
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSMakeDir(__wut_devoptab_fs_client, &cmd, fixedPath, -1);
|
||||
status = FSMakeDir(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
|
@ -44,7 +44,7 @@ __wut_fs_open(struct _reent *r,
|
||||
// Open the file
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSOpenFile(__wut_devoptab_fs_client, &cmd, fixedPath, fsMode, &fd,
|
||||
-1);
|
||||
FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
@ -54,6 +54,6 @@ __wut_fs_open(struct _reent *r,
|
||||
file = (__wut_fs_file_t *)fileStruct;
|
||||
file->fd = fd;
|
||||
file->flags = (flags & (O_ACCMODE|O_APPEND|O_SYNC));
|
||||
FSGetPosFile(__wut_devoptab_fs_client, &cmd, fd, &file->offset, -1);
|
||||
FSGetPosFile(__wut_devoptab_fs_client, &cmd, fd, &file->offset, FS_ERROR_FLAG_ALL);
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ __wut_fs_read(struct _reent *r,
|
||||
|
||||
if((((uintptr_t) ptr) & 0x3F) == 0){
|
||||
status = FSReadFile(__wut_devoptab_fs_client, &cmd, (uint8_t *) ptr, 1,
|
||||
len, file->fd, 0, -1);
|
||||
len, file->fd, 0, FS_ERROR_FLAG_ALL);
|
||||
if(status > 0){
|
||||
bytesRead = (uint32_t) status;
|
||||
file->offset += bytesRead;
|
||||
@ -48,7 +48,7 @@ __wut_fs_read(struct _reent *r,
|
||||
|
||||
// Write the data
|
||||
status = FSReadFile(__wut_devoptab_fs_client, &cmd, alignedReadBuffer, 1,
|
||||
toRead, file->fd, 0, -1);
|
||||
toRead, file->fd, 0, FS_ERROR_FLAG_ALL);
|
||||
if (status <= 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ __wut_fs_rename(struct _reent *r,
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSRename(__wut_devoptab_fs_client, &cmd, fixedOldPath, fixedNewPath,
|
||||
-1);
|
||||
FS_ERROR_FLAG_ALL);
|
||||
free(fixedOldPath);
|
||||
free(fixedNewPath);
|
||||
|
||||
|
@ -18,7 +18,7 @@ __wut_fs_rmdir(struct _reent *r,
|
||||
}
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSRemove(__wut_devoptab_fs_client, &cmd, fixedPath, -1);
|
||||
status = FSRemove(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
|
@ -20,7 +20,7 @@ __wut_fs_seek(struct _reent *r,
|
||||
FSInitCmdBlock(&cmd);
|
||||
file = (__wut_fs_file_t *)fd;
|
||||
status = FSGetStatFile(__wut_devoptab_fs_client, &cmd, file->fd, &fsStat,
|
||||
-1);
|
||||
FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
@ -59,7 +59,7 @@ __wut_fs_seek(struct _reent *r,
|
||||
// Update the current offset
|
||||
file->offset = offset + pos;
|
||||
status = FSSetPosFile(__wut_devoptab_fs_client, &cmd, file->fd, file->offset,
|
||||
-1);
|
||||
FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -23,18 +23,18 @@ __wut_fs_stat(struct _reent *r,
|
||||
|
||||
// First try open as file
|
||||
status = FSOpenFile(__wut_devoptab_fs_client, &cmd, fixedPath, "r",
|
||||
(FSFileHandle*)&fd, -1);
|
||||
(FSFileHandle*)&fd, FS_ERROR_FLAG_ALL);
|
||||
if (status >= 0) {
|
||||
__wut_fs_file_t tmpfd = { .fd = fd };
|
||||
status = __wut_fs_fstat(r, &tmpfd, st);
|
||||
FSCloseFile(__wut_devoptab_fs_client, &cmd, fd, -1);
|
||||
FSCloseFile(__wut_devoptab_fs_client, &cmd, fd, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
return status;
|
||||
}
|
||||
|
||||
// File failed, so lets try open as directory
|
||||
status = FSOpenDir(__wut_devoptab_fs_client, &cmd, fixedPath,
|
||||
(FSDirectoryHandle*)&fd, -1);
|
||||
(FSDirectoryHandle*)&fd, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
@ -44,6 +44,6 @@ __wut_fs_stat(struct _reent *r,
|
||||
memset(st, 0, sizeof(struct stat));
|
||||
st->st_nlink = 1;
|
||||
st->st_mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
FSCloseDir(__wut_devoptab_fs_client, &cmd, fd, -1);
|
||||
FSCloseDir(__wut_devoptab_fs_client, &cmd, fd, FS_ERROR_FLAG_ALL);
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ __wut_fs_ftruncate(struct _reent *r,
|
||||
// Set the new file size
|
||||
FSInitCmdBlock(&cmd);
|
||||
file = (__wut_fs_file_t *)fd;
|
||||
status = FSSetPosFile(__wut_devoptab_fs_client, &cmd, file->fd, len, -1);
|
||||
status = FSSetPosFile(__wut_devoptab_fs_client, &cmd, file->fd, len, FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
status = FSTruncateFile(__wut_devoptab_fs_client, &cmd, file->fd, -1);
|
||||
status = FSTruncateFile(__wut_devoptab_fs_client, &cmd, file->fd, FS_ERROR_FLAG_ALL);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
return -1;
|
||||
|
@ -19,7 +19,7 @@ __wut_fs_unlink(struct _reent *r,
|
||||
}
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
status = FSRemove(__wut_devoptab_fs_client, &cmd, fixedPath, -1);
|
||||
status = FSRemove(__wut_devoptab_fs_client, &cmd, fixedPath, FS_ERROR_FLAG_ALL);
|
||||
free(fixedPath);
|
||||
if (status < 0) {
|
||||
r->_errno = __wut_fs_translate_error(status);
|
||||
|
@ -29,7 +29,7 @@ __wut_fs_write(struct _reent *r,
|
||||
|
||||
if((((uintptr_t) ptr) & 0x3F) == 0){
|
||||
status = FSWriteFile(__wut_devoptab_fs_client, &cmd, (uint8_t *) ptr,
|
||||
1, len, file->fd, 0, -1);
|
||||
1, len, file->fd, 0, FS_ERROR_FLAG_ALL);
|
||||
if(status > 0){
|
||||
bytesWritten = (uint32_t) status;
|
||||
file->offset += bytesWritten;
|
||||
@ -51,7 +51,7 @@ __wut_fs_write(struct _reent *r,
|
||||
|
||||
// Write the data
|
||||
status = FSWriteFile(__wut_devoptab_fs_client, &cmd, alignedWriteBuffer,
|
||||
1, toWrite, file->fd, 0, -1);
|
||||
1, toWrite, file->fd, 0, FS_ERROR_FLAG_ALL);
|
||||
if (status <= 0) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user