From 510409db7aca25ab746fd6bffb3804c5e4143bb8 Mon Sep 17 00:00:00 2001 From: Maschell Date: Tue, 29 Dec 2020 09:37:32 +0100 Subject: [PATCH] wutdevoptab: Use FS_ERROR_FLAG_ALL instead of -1 --- libraries/wutdevoptab/devoptab_fs_chdir.c | 2 +- libraries/wutdevoptab/devoptab_fs_chmod.c | 2 +- libraries/wutdevoptab/devoptab_fs_close.c | 2 +- libraries/wutdevoptab/devoptab_fs_dirclose.c | 2 +- libraries/wutdevoptab/devoptab_fs_dirnext.c | 2 +- libraries/wutdevoptab/devoptab_fs_diropen.c | 2 +- libraries/wutdevoptab/devoptab_fs_dirreset.c | 2 +- libraries/wutdevoptab/devoptab_fs_fstat.c | 2 +- libraries/wutdevoptab/devoptab_fs_fsync.c | 2 +- libraries/wutdevoptab/devoptab_fs_mkdir.c | 2 +- libraries/wutdevoptab/devoptab_fs_open.c | 4 ++-- libraries/wutdevoptab/devoptab_fs_read.c | 4 ++-- libraries/wutdevoptab/devoptab_fs_rename.c | 2 +- libraries/wutdevoptab/devoptab_fs_rmdir.c | 2 +- libraries/wutdevoptab/devoptab_fs_seek.c | 4 ++-- libraries/wutdevoptab/devoptab_fs_stat.c | 8 ++++---- libraries/wutdevoptab/devoptab_fs_truncate.c | 4 ++-- libraries/wutdevoptab/devoptab_fs_unlink.c | 2 +- libraries/wutdevoptab/devoptab_fs_write.c | 4 ++-- 19 files changed, 27 insertions(+), 27 deletions(-) diff --git a/libraries/wutdevoptab/devoptab_fs_chdir.c b/libraries/wutdevoptab/devoptab_fs_chdir.c index 1fa8e42..6a1f13e 100644 --- a/libraries/wutdevoptab/devoptab_fs_chdir.c +++ b/libraries/wutdevoptab/devoptab_fs_chdir.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_chmod.c b/libraries/wutdevoptab/devoptab_fs_chmod.c index 15cb29f..43a2692 100644 --- a/libraries/wutdevoptab/devoptab_fs_chmod.c +++ b/libraries/wutdevoptab/devoptab_fs_chmod.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_close.c b/libraries/wutdevoptab/devoptab_fs_close.c index 8678f48..490f7c7 100644 --- a/libraries/wutdevoptab/devoptab_fs_close.c +++ b/libraries/wutdevoptab/devoptab_fs_close.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_dirclose.c b/libraries/wutdevoptab/devoptab_fs_dirclose.c index 73aa96a..6380d01 100644 --- a/libraries/wutdevoptab/devoptab_fs_dirclose.c +++ b/libraries/wutdevoptab/devoptab_fs_dirclose.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_dirnext.c b/libraries/wutdevoptab/devoptab_fs_dirnext.c index 8c2ec21..83f57b7 100644 --- a/libraries/wutdevoptab/devoptab_fs_dirnext.c +++ b/libraries/wutdevoptab/devoptab_fs_dirnext.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_diropen.c b/libraries/wutdevoptab/devoptab_fs_diropen.c index 6156891..6a830b1 100644 --- a/libraries/wutdevoptab/devoptab_fs_diropen.c +++ b/libraries/wutdevoptab/devoptab_fs_diropen.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_dirreset.c b/libraries/wutdevoptab/devoptab_fs_dirreset.c index 4cf6610..143678b 100644 --- a/libraries/wutdevoptab/devoptab_fs_dirreset.c +++ b/libraries/wutdevoptab/devoptab_fs_dirreset.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_fstat.c b/libraries/wutdevoptab/devoptab_fs_fstat.c index 13bcc6d..c60d81e 100644 --- a/libraries/wutdevoptab/devoptab_fs_fstat.c +++ b/libraries/wutdevoptab/devoptab_fs_fstat.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_fsync.c b/libraries/wutdevoptab/devoptab_fs_fsync.c index d4eefb6..a464d8e 100644 --- a/libraries/wutdevoptab/devoptab_fs_fsync.c +++ b/libraries/wutdevoptab/devoptab_fs_fsync.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_mkdir.c b/libraries/wutdevoptab/devoptab_fs_mkdir.c index d8fada3..174c0e2 100644 --- a/libraries/wutdevoptab/devoptab_fs_mkdir.c +++ b/libraries/wutdevoptab/devoptab_fs_mkdir.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_open.c b/libraries/wutdevoptab/devoptab_fs_open.c index ae92ed6..c662852 100644 --- a/libraries/wutdevoptab/devoptab_fs_open.c +++ b/libraries/wutdevoptab/devoptab_fs_open.c @@ -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; } diff --git a/libraries/wutdevoptab/devoptab_fs_read.c b/libraries/wutdevoptab/devoptab_fs_read.c index c340268..1a21813 100644 --- a/libraries/wutdevoptab/devoptab_fs_read.c +++ b/libraries/wutdevoptab/devoptab_fs_read.c @@ -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; } diff --git a/libraries/wutdevoptab/devoptab_fs_rename.c b/libraries/wutdevoptab/devoptab_fs_rename.c index bec601c..2f2538d 100644 --- a/libraries/wutdevoptab/devoptab_fs_rename.c +++ b/libraries/wutdevoptab/devoptab_fs_rename.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_rmdir.c b/libraries/wutdevoptab/devoptab_fs_rmdir.c index da03e1e..70b89eb 100644 --- a/libraries/wutdevoptab/devoptab_fs_rmdir.c +++ b/libraries/wutdevoptab/devoptab_fs_rmdir.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_seek.c b/libraries/wutdevoptab/devoptab_fs_seek.c index 3939d48..bea680c 100644 --- a/libraries/wutdevoptab/devoptab_fs_seek.c +++ b/libraries/wutdevoptab/devoptab_fs_seek.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_stat.c b/libraries/wutdevoptab/devoptab_fs_stat.c index 961891d..fd33157 100644 --- a/libraries/wutdevoptab/devoptab_fs_stat.c +++ b/libraries/wutdevoptab/devoptab_fs_stat.c @@ -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; } diff --git a/libraries/wutdevoptab/devoptab_fs_truncate.c b/libraries/wutdevoptab/devoptab_fs_truncate.c index dc49e86..fee1a9d 100644 --- a/libraries/wutdevoptab/devoptab_fs_truncate.c +++ b/libraries/wutdevoptab/devoptab_fs_truncate.c @@ -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; diff --git a/libraries/wutdevoptab/devoptab_fs_unlink.c b/libraries/wutdevoptab/devoptab_fs_unlink.c index dc6f376..ae0c0da 100644 --- a/libraries/wutdevoptab/devoptab_fs_unlink.c +++ b/libraries/wutdevoptab/devoptab_fs_unlink.c @@ -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); diff --git a/libraries/wutdevoptab/devoptab_fs_write.c b/libraries/wutdevoptab/devoptab_fs_write.c index 1d356a2..a63f2d8 100644 --- a/libraries/wutdevoptab/devoptab_fs_write.c +++ b/libraries/wutdevoptab/devoptab_fs_write.c @@ -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; }