Rename O_CREAT to O_CREATE.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-09-27 14:44:52 +02:00
parent e901ad8105
commit 5933ac5210
6 changed files with 10 additions and 7 deletions

View File

@ -45,6 +45,9 @@ __BEGIN_DECLS
#define O_WRONLY O_WRITE
#define O_RDWR (O_READ | O_WRITE)
/* Backwards compatibility with existing systems that call it O_CREAT. */
#define O_CREAT O_CREATE
/* Compatibility with Linux and other systems that have this. */
#define O_ACCMODE (O_READ | O_WRITE | O_EXEC | O_SEARCH)

View File

@ -46,7 +46,7 @@ namespace Sortix {
const int ACCESS_FLAGS = O_READ | O_WRITE | O_EXEC | O_SEARCH;
// Flags that only make sense at open time.
const int OPEN_FLAGS = O_CREAT | O_DIRECTORY | O_EXCL | O_TRUNC;
const int OPEN_FLAGS = O_CREATE | O_DIRECTORY | O_EXCL | O_TRUNC;
// Flags that only make sense for descriptors.
const int DESCRIPTOR_FLAGS = O_APPEND | O_NONBLOCK;
@ -334,11 +334,11 @@ ssize_t Descriptor::readdirents(ioctx_t* ctx, struct kernel_dirent* dirent,
static bool IsSaneFlagModeCombination(int flags, mode_t /*mode*/)
{
// It doesn't make sense to pass O_CREAT or O_TRUNC when attempting to open
// It doesn't make sense to pass O_CREATE or O_TRUNC when attempting to open
// a directory. We also reject O_TRUNC | O_DIRECTORY early to prevent
// opening a directory, attempting to truncate it, and then aborting with an
// error because a directory was opened.
if ( (flags & (O_CREAT | O_TRUNC)) && (flags & (O_DIRECTORY)) )
if ( (flags & (O_CREATE | O_TRUNC)) && (flags & (O_DIRECTORY)) )
return errno = EINVAL, false;
return true;

View File

@ -228,7 +228,7 @@ Ref<Inode> Dir::open(ioctx_t* ctx, const char* filename, int flags, mode_t mode)
if ( flags & O_EXCL ) { errno = EEXIST; return Ref<Inode>(NULL); }
return children[childindex].inode;
}
if ( !(flags & O_CREAT) )
if ( !(flags & O_CREATE) )
return errno = ENOENT, Ref<Inode>(NULL);
Ref<File> file(new File(dev, 0, ctx->uid, ctx->gid, mode));
if ( !file )

View File

@ -556,7 +556,7 @@ Ref<Inode> ServerNode::open(ioctx_t* /*ctx*/, const char* filename, int flags,
errno != ERANGE )
{
errno = saved_errno;
if ( !(flags & O_CREAT) )
if ( !(flags & O_CREATE) )
return errno = ENOENT, Ref<Inode>(NULL);
ino_t ino = (ino_t) ull_ino;
return server->BootstrapNode(ino, mode & S_IFMT);

View File

@ -36,7 +36,7 @@ __BEGIN_DECLS
#define O_EXEC (1<<2)
#define O_APPEND (1<<3)
#define O_CLOEXEC (1<<4)
#define O_CREAT (1<<5)
#define O_CREATE (1<<5)
#define O_DIRECTORY (1<<6)
#define O_EXCL (1<<7)
#define O_TRUNC (1<<8)

View File

@ -289,7 +289,7 @@ static bool ExtractDir(ioctx_t* ctx, uint32_t ino, Ref<Descriptor> dir)
}
if ( INITRD_S_ISREG(child->mode) )
{
Ref<Descriptor> desc = dir->open(ctx, name, O_WRITE | O_CREAT, mode);
Ref<Descriptor> desc = dir->open(ctx, name, O_WRITE | O_CREATE, mode);
if ( !desc )
return false;
if ( !ExtractNode(ctx, childino, desc) )