robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
38986188ba
master
1#pragma once 2 3#include <stddef.h> // IWYU pragma: keep 4 5#include "nvim/memory_defs.h" 6#include "nvim/os/fileio_defs.h" // IWYU pragma: keep 7 8/// file_open() flags 9typedef enum { 10kFileReadOnly = 1 ,///< Open file read-only. Default. 11kFileCreate = 2 ,///< Create file if it does not exist yet. 12///< Implies kFileWriteOnly. 13kFileWriteOnly = 4 ,///< Open file for writing only. 14///< Cannot be used with kFileReadOnly. 15kFileNoSymlink = 8 ,///< Do not allow symbolic links. 16kFileCreateOnly = 16 ,///< Only create the file, failing if it already 17///< exists. Implies kFileWriteOnly. Cannot be used 18///< with kFileCreate. 19kFileTruncate = 32 ,///< Truncate the file if it exists. 20///< Implies kFileWriteOnly. Cannot be used with 21///< kFileCreateOnly. 22kFileAppend = 64 ,///< Append to the file. Implies kFileWriteOnly. Cannot 23///< be used with kFileCreateOnly. 24kFileNonBlocking = 128 ,///< Do not restart read() or write() syscall if 25///< EAGAIN was encountered. 26kFileMkDir = 256 , 27}FileOpenFlags ; 28 29enum { 30/// Read or write buffer size 31/// 32/// Currently equal to (IOSIZE - 1), but they do not need to be connected. 33kRWBufferSize = 1024 , 34}; 35 36static inline size_t file_space (FileDescriptor * fp ) 37{ 38return (size_t )((fp -> buffer + ARENA_BLOCK_SIZE )- fp -> write_pos ); 39} 40 41#include "os/fileio.h.generated.h"