Home | Libraries | People | FAQ | More |
Bitwise file and directory open flags.
enum file_flags {none = 0, read = 1, write = 2, read_write = 3, append = 4, truncate = 8, create = 16, create_only_if_not_exist = 32, create_compressed = 64, will_be_sequentially_accessed = 128, will_be_randomly_accessed = 256, no_sparse = 512, hold_parent_open = (1<<10), unique_directory_handle = (1<<11), no_race_protection = (1<<12), temporary_file = (1<<13), delete_on_close = (1<<14), os_direct = (1<<16), os_lockable = (1<<17), always_sync = (1<<24), sync_on_close = (1<<25), int_hold_parent_open_nested = (1<<27), int_file_share_delete = (1<<28), int_opening_link = (1<<29), int_opening_dir = (1<<30)};
Value |
Description |
---|---|
none |
No flags set. |
read |
Read access. |
write |
Write access. |
read_write |
Read and write access. |
append |
Append only. |
truncate |
Truncate existing file to zero. |
create |
Open and create if doesn't exist. Always creates sparse files if possible. |
create_only_if_not_exist |
Create and open only if doesn't exist. |
create_compressed |
Create a compressed file, needs to be combined with one of the other create flags. Only succeeds if supported by the underlying filing system. |
will_be_sequentially_accessed |
Will be exclusively either read or written
sequentially. If you're exclusively writing sequentially, strongly
consider turning on |
will_be_randomly_accessed |
Will be randomly accessed, so don't bother with read-ahead. If
you're using this, strongly consider turning
on |
no_sparse |
Don't create sparse files. May be ignored by some filing systems (e.g. ext4). |
hold_parent_open |
Hold a file handle open to the containing directory of each open file for fast directory enumeration and fast relative path ops. |
unique_directory_handle |
Return a unique directory handle rather than a shared directory handle. |
no_race_protection |
Skip taking steps to avoid destruction of data due to filing system races. Most of the performance benefit of enabling this goes away if you enable HoldParentOpen instead, so be especially careful when considering turning this on. |
temporary_file |
On some systems causes dirty cache data to not be written to
physical storage until file close. Useful for temporary files
and lock files, especially on Windows when combined with |
delete_on_close |
Only when combined with |
os_direct |
Bypass the OS file buffers (only really useful for writing large files, or a lot of random reads and writes. Note you must 4Kb align everything if this is on). Be VERY careful mixing this with memory mapped files. |
os_lockable |
|
always_sync |
Ask the OS to not complete until the data is on the physical
storage. Some filing systems do much better with this than |
sync_on_close |
Automatically initiate an asynchronous flush just before file close, and fuse both operations so both must complete for close to complete. |
int_hold_parent_open_nested |
Internal use only. Don't use. |
int_file_share_delete |
Internal use only. Don't use. |
int_opening_link |
Internal use only. Don't use. |
int_opening_dir |
Internal use only. Don't use. |
#include <boost/afio/v2/afio.hpp>