mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
include/fcntl.h: remove O_RDOK/O_WROK aliases
O_RDOK and O_WROK are non-standard aliases for O_RDONLY and O_WRONLY respectively. Having two names for the same flag creates confusion, especially when aligning the flag values with Linux. Remove the aliases and replace all uses with the standard O_RDONLY/O_WRONLY. No functional change — O_RDOK was defined as O_RDONLY and O_WROK as O_WRONLY, so the replacement is a pure text substitution. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
1924a96064
commit
6161c73639
39 changed files with 73 additions and 75 deletions
|
|
@ -102,7 +102,7 @@ int fclose(FAR FILE *stream)
|
|||
|
||||
/* If the stream was opened for writing, then flush the stream */
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) != 0)
|
||||
if ((stream->fs_oflags & O_WRONLY) != 0)
|
||||
{
|
||||
ret = lib_fflush(stream);
|
||||
errcode = get_errno();
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ FAR FILE *fmemopen(FAR void *buf, size_t size, FAR const char *mode)
|
|||
* by the size argument.
|
||||
*/
|
||||
|
||||
if ((oflags & O_RDWR) == O_RDOK)
|
||||
if ((oflags & O_RDWR) == O_RDONLY)
|
||||
{
|
||||
fmemopen_cookie->end = size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ int lib_mode2oflags(FAR const char *mode)
|
|||
{
|
||||
/* Open for read access */
|
||||
|
||||
oflags = O_RDOK | O_TEXT;
|
||||
oflags = O_RDONLY | O_TEXT;
|
||||
state = MODE_R;
|
||||
}
|
||||
else
|
||||
|
|
@ -245,7 +245,7 @@ int lib_mode2oflags(FAR const char *mode)
|
|||
{
|
||||
/* Open for write access, truncating any existing file */
|
||||
|
||||
oflags = O_WROK | O_CREAT | O_TRUNC | O_TEXT;
|
||||
oflags = O_WRONLY | O_CREAT | O_TRUNC | O_TEXT;
|
||||
state = MODE_W;
|
||||
}
|
||||
else
|
||||
|
|
@ -261,7 +261,7 @@ int lib_mode2oflags(FAR const char *mode)
|
|||
{
|
||||
/* Write to the end of the file */
|
||||
|
||||
oflags = O_WROK | O_CREAT | O_APPEND | O_TEXT;
|
||||
oflags = O_WRONLY | O_CREAT | O_APPEND | O_TEXT;
|
||||
state = MODE_A;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ ssize_t lib_fflush_unlocked(FAR FILE *stream)
|
|||
|
||||
/* Return EBADF if the file is not opened for writing */
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) == 0)
|
||||
if ((stream->fs_oflags & O_WRONLY) == 0)
|
||||
{
|
||||
return -EBADF;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ int lib_flushall_unlocked(FAR struct streamlist *list)
|
|||
* the pending write data in the stream.
|
||||
*/
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) != 0)
|
||||
if ((stream->fs_oflags & O_WRONLY) != 0)
|
||||
{
|
||||
/* Flush the writable FILE */
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ int lib_flushall(FAR struct streamlist *list)
|
|||
* the pending write data in the stream.
|
||||
*/
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) != 0)
|
||||
if ((stream->fs_oflags & O_WRONLY) != 0)
|
||||
{
|
||||
/* Flush the writable FILE */
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ ssize_t lib_fread_unlocked(FAR void *ptr, size_t count, FAR FILE *stream)
|
|||
_NX_SETERRNO(EBADF);
|
||||
return ERROR;
|
||||
}
|
||||
else if ((stream->fs_oflags & O_RDOK) == 0)
|
||||
else if ((stream->fs_oflags & O_RDONLY) == 0)
|
||||
{
|
||||
stream->fs_flags |= __FS_FLAG_ERROR;
|
||||
_NX_SETERRNO(EBADF);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ ssize_t lib_fwrite_unlocked(FAR const void *ptr, size_t count,
|
|||
|
||||
/* Check if write access is permitted */
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) == 0)
|
||||
if ((stream->fs_oflags & O_WRONLY) == 0)
|
||||
{
|
||||
set_errno(EBADF);
|
||||
goto errout;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ int ungetc(int c, FAR FILE *stream)
|
|||
|
||||
/* Stream must be open for read access */
|
||||
|
||||
if ((stream->fs_oflags & O_RDOK) == 0)
|
||||
if ((stream->fs_oflags & O_RDONLY) == 0)
|
||||
{
|
||||
return EOF;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ wint_t ungetwc_unlocked(wint_t wc, FAR FILE *f)
|
|||
|
||||
/* Stream must be open for read access */
|
||||
|
||||
if ((f->fs_oflags & O_RDOK) == 0)
|
||||
if ((f->fs_oflags & O_RDONLY) == 0)
|
||||
{
|
||||
return WEOF;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ int lib_wrflush_unlocked(FAR FILE *stream)
|
|||
* that case.
|
||||
*/
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) == 0)
|
||||
if ((stream->fs_oflags & O_WRONLY) == 0)
|
||||
{
|
||||
/* Report that the success was successful if we attempt to flush a
|
||||
* read-only stream.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue