Commit 2516950
io/file.h
@@ -11,12 +11,12 @@ void File_to_stream_source( File *f, SourceGeneric *stream );
void File_to_stream_sink( File *f, SinkGeneric *stream );
enum FileOption {
- FILEOPTION_READ = (1<<0),
- FILEOPTION_WRITE = (1<<1),
- FILEOPTION_READWRITE = FILEOPTION_READ | FILEOPTION_WRITE,
+ FILEOPT_READ = (1<<0),
+ FILEOPT_WRITE = (1<<1),
+ FILEOPT_READWRITE = FILEOPT_READ | FILEOPT_WRITE,
- FILEOPTION_DISALLOW_CREATION = (1<<2),
- FILEOPTION_NO_FOLLOW_LINKS = (1<<3),
+ FILEOPT_DISALLOW_CREATION = (1<<2),
+ FILEOPT_NO_FOLLOW_LINKS = (1<<3),
};
@@ -55,13 +55,13 @@ status File_write( File *f, u64 *amount, const u8 *in);
mode_t mode = 0;
- if( file_options & FILEOPTION_READ ) {
- if( file_options & FILEOPTION_WRITE ) {
+ if( file_options & FILEOPT_READ ) {
+ if( file_options & FILEOPT_WRITE ) {
mode = O_RDWR;
} else {
mode = O_RDONLY;
}
- } else if( file_options & FILEOPTION_WRITE ) {
+ } else if( file_options & FILEOPT_WRITE ) {
mode = O_RDWR;
} else {
return ERROR_INVALID_ARGUMENTS;
@@ -72,11 +72,11 @@ status File_write( File *f, u64 *amount, const u8 *in);
}
/* Reads shouldn't create files, like ever. This option only makes sense on write. */
- if( !(file_options & FILEOPTION_DISALLOW_CREATION && (file_options & FILEOPTION_WRITE) ) ) {
+ if( !(file_options & FILEOPT_DISALLOW_CREATION && (file_options & FILEOPT_WRITE) ) ) {
mode |= O_CREAT;
}
- if( (file_options & FILEOPTION_NO_FOLLOW_LINKS) ) {
+ if( (file_options & FILEOPT_NO_FOLLOW_LINKS) ) {
mode |= O_NOFOLLOW;
}
tests/main.c
@@ -27,7 +27,7 @@ int main(void) {
STATIC_STRING( testfile_name, "./testfile" );
- assert(OK( File_open( &f, (string*)&testfile_name, FILEOPTION_READ, Arena_from( &scratch ) ) ));
+ assert(OK( File_open( &f, (string*)&testfile_name, FILEOPT_READ, Arena_from( &scratch ) ) ));
SourceGeneric s = {0};