Files
neovim/src/nvim/os/fileio.h
bfredl 442f297c63 refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guards
These are not needed after #35129 but making uncrustify still play nice
with them was a bit tricky.

Unfortunately `uncrustify --update-config-with-doc` breaks strings
with backslashes. This issue has been reported upstream,
and in the meanwhile auto-update on every single run has been disabled.
2025-08-14 09:34:38 +02:00

42 lines
1.5 KiB
C

#pragma once
#include <stddef.h> // IWYU pragma: keep
#include "nvim/memory_defs.h"
#include "nvim/os/fileio_defs.h" // IWYU pragma: keep
/// file_open() flags
typedef enum {
kFileReadOnly = 1, ///< Open file read-only. Default.
kFileCreate = 2, ///< Create file if it does not exist yet.
///< Implies kFileWriteOnly.
kFileWriteOnly = 4, ///< Open file for writing only.
///< Cannot be used with kFileReadOnly.
kFileNoSymlink = 8, ///< Do not allow symbolic links.
kFileCreateOnly = 16, ///< Only create the file, failing if it already
///< exists. Implies kFileWriteOnly. Cannot be used
///< with kFileCreate.
kFileTruncate = 32, ///< Truncate the file if it exists.
///< Implies kFileWriteOnly. Cannot be used with
///< kFileCreateOnly.
kFileAppend = 64, ///< Append to the file. Implies kFileWriteOnly. Cannot
///< be used with kFileCreateOnly.
kFileNonBlocking = 128, ///< Do not restart read() or write() syscall if
///< EAGAIN was encountered.
kFileMkDir = 256,
} FileOpenFlags;
enum {
/// Read or write buffer size
///
/// Currently equal to (IOSIZE - 1), but they do not need to be connected.
kRWBufferSize = 1024,
};
static inline size_t file_space(FileDescriptor *fp)
{
return (size_t)((fp->buffer + ARENA_BLOCK_SIZE) - fp->write_pos);
}
#include "os/fileio.h.generated.h"