fixed flags handling of ase_fio_open()

This commit is contained in:
hyung-hwan 2008-12-12 23:47:07 +00:00
parent 596b42a211
commit d28108c996
2 changed files with 24 additions and 13 deletions

View File

@ -65,7 +65,9 @@ extern "C" {
* NAME
* ase_fio_open - open a file
*
* PARAMETERS
* DESCRIPTION
* To open a file, you should set the flags with at least one of
* ASE_FIO_READ, ASE_FIO_WRITE, ASE_FIO_APPEND.
*
* SYNOPSIS
*/
@ -78,9 +80,16 @@ ase_fio_t* ase_fio_open (
);
/******/
/****f* ase.fio/ase_fio_close
* NAME
* ase_fio_close - close a file
*
* SYNOPSIS
*/
void ase_fio_close (
ase_fio_t* fio
);
/******/
ase_fio_t* ase_fio_init (
ase_fio_t* fio,

View File

@ -139,20 +139,22 @@ ase_fio_t* ase_fio_init (
#endif
/*
* rwa -> RDWR | APPEND
* ra -> RDONLY | APPEND
* ra -> RDWR | APPEND
* wa -> WRONLY | APPEND
* a -> WRONLY | APPEND
*/
if (flags & ASE_FIO_APPEND)
{
if ((flags & ASE_FIO_READ)) desired_access |= O_RDWR;
else desired_access |= O_WRONLY;
desired_access |= O_APPEND;
}
else
{
if ((flags & ASE_FIO_READ) &&
(flags & ASE_FIO_WRITE)) desired_access |= O_RDWR;
else if (flags & ASE_FIO_READ) desired_access |= O_RDONLY;
else if (flags & ASE_FIO_WRITE) desired_access |= O_WRONLY;
if (flags & ASE_FIO_APPEND)
{
if (!(flags & ASE_FIO_READ) &&
!(flags & ASE_FIO_WRITE)) desired_access |= O_WRONLY;
desired_access |= O_APPEND;
}
if (flags & ASE_FIO_CREATE) desired_access |= O_CREAT;