From fde3c15817db0c312a9705abf4c69c03db7bf93b Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sun, 27 Nov 2022 12:42:18 +0100 Subject: [PATCH] openflags: added missing flags --- src/webfuse/filesystem/openflags.cpp | 26 +++++++++++------ src/webfuse/filesystem/openflags.hpp | 42 +++++++++++++++------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/webfuse/filesystem/openflags.cpp b/src/webfuse/filesystem/openflags.cpp index 7a0502c..3547eaa 100644 --- a/src/webfuse/filesystem/openflags.cpp +++ b/src/webfuse/filesystem/openflags.cpp @@ -22,20 +22,25 @@ openflags openflags::from_int(int value) if (O_RDONLY == (value & O_RDONLY )) { result |= openflags::rdonly; } if (O_WRONLY == (value & O_WRONLY )) { result |= openflags::wronly; } if (O_RDWR == (value & O_RDWR )) { result |= openflags::rdwr; } + + if (O_APPEND == (value & O_APPEND )) { result |= openflags::append; } + if (O_ASYNC == (value & O_ASYNC )) { result |= openflags::async; } if (O_CLOEXEC == (value & O_CLOEXEC )) { result |= openflags::cloexec; } if (O_CREAT == (value & O_CREAT )) { result |= openflags::creat; } if (O_DIRECT == (value & O_DIRECT )) { result |= openflags::direct; } if (O_DIRECTORY == (value & O_DIRECTORY)) { result |= openflags::directory; } + if (O_DSYNC == (value & O_DSYNC )) { result |= openflags::dsync; } if (O_EXCL == (value & O_EXCL )) { result |= openflags::excl; } - if (O_NOCTTY == (value & O_NOCTTY )) { result |= openflags::noctty; } - if (O_NOFOLLOW == (value & O_NOFOLLOW )) { result |= openflags::nofollow; } - if (O_TRUNC == (value & O_TRUNC )) { result |= openflags::trunc; } - if (O_ASYNC == (value & O_ASYNC )) { result |= openflags::async; } if (O_LARGEFILE == (value & O_LARGEFILE)) { result |= openflags::largefile; } if (O_NOATIME == (value & O_NOATIME )) { result |= openflags::noatime; } + if (O_NOCTTY == (value & O_NOCTTY )) { result |= openflags::noctty; } + if (O_NOFOLLOW == (value & O_NOFOLLOW )) { result |= openflags::nofollow; } if (O_NONBLOCK == (value & O_NONBLOCK )) { result |= openflags::nonblock; } if (O_NDELAY == (value & O_NDELAY )) { result |= openflags::ndelay; } + if (O_PATH == (value & O_PATH )) { result |= openflags::path; } if (O_SYNC == (value & O_SYNC )) { result |= openflags::sync; } + if (O_TMPFILE == (value & O_TMPFILE )) { result |= openflags::tmpfile; } + if (O_TRUNC == (value & O_TRUNC )) { result |= openflags::trunc; } return openflags(result); } @@ -47,20 +52,25 @@ int openflags::to_int() const if (openflags::rdonly == (value_ & openflags::rdonly )) { result |= O_RDONLY; } if (openflags::wronly == (value_ & openflags::wronly )) { result |= O_WRONLY; } if (openflags::rdwr == (value_ & openflags::rdwr )) { result |= O_RDWR; } + + if (openflags::append == (value_ & openflags::append )) { result |= O_APPEND; } + if (openflags::async == (value_ & openflags::async )) { result |= O_ASYNC; } if (openflags::cloexec == (value_ & openflags::cloexec )) { result |= O_CLOEXEC; } if (openflags::creat == (value_ & openflags::creat )) { result |= O_CREAT; } if (openflags::direct == (value_ & openflags::direct )) { result |= O_DIRECT; } if (openflags::directory == (value_ & openflags::directory)) { result |= O_DIRECTORY; } + if (openflags::dsync == (value_ & openflags::dsync )) { result |= O_DSYNC; } if (openflags::excl == (value_ & openflags::excl )) { result |= O_EXCL; } - if (openflags::noctty == (value_ & openflags::noctty )) { result |= O_NOCTTY; } - if (openflags::nofollow == (value_ & openflags::nofollow )) { result |= O_NOFOLLOW; } - if (openflags::trunc == (value_ & openflags::trunc )) { result |= O_TRUNC; } - if (openflags::async == (value_ & openflags::async )) { result |= O_ASYNC; } if (openflags::largefile == (value_ & openflags::largefile)) { result |= O_LARGEFILE; } if (openflags::noatime == (value_ & openflags::noatime )) { result |= O_NOATIME; } + if (openflags::noctty == (value_ & openflags::noctty )) { result |= O_NOCTTY; } + if (openflags::nofollow == (value_ & openflags::nofollow )) { result |= O_NOFOLLOW; } if (openflags::nonblock == (value_ & openflags::nonblock )) { result |= O_NONBLOCK; } if (openflags::ndelay == (value_ & openflags::ndelay )) { result |= O_NDELAY; } + if (openflags::path == (value_ & openflags::path )) { result |= O_PATH; } if (openflags::sync == (value_ & openflags::sync )) { result |= O_SYNC; } + if (openflags::tmpfile == (value_ & openflags::tmpfile )) { result |= O_TMPFILE; } + if (openflags::trunc == (value_ & openflags::trunc )) { result |= O_TRUNC; } return result; } diff --git a/src/webfuse/filesystem/openflags.hpp b/src/webfuse/filesystem/openflags.hpp index 44541f1..8405332 100644 --- a/src/webfuse/filesystem/openflags.hpp +++ b/src/webfuse/filesystem/openflags.hpp @@ -9,25 +9,29 @@ namespace webfuse class openflags { public: - static constexpr int32_t const accessmode_mask = 3; // O_ACCMODE - - static constexpr int32_t const rdonly = 00000000; // O_RDONLY - static constexpr int32_t const wronly = 00000001; // O_WRONLY - static constexpr int32_t const rdwr = 00000002; // O_RDWR - static constexpr int32_t const cloexec = 02000000; // O_CLOEXEC - static constexpr int32_t const creat = 00000100; // O_CREAT - static constexpr int32_t const direct = 00040000; // O_DIRECT - static constexpr int32_t const directory = 00200000; // O_DIRECTORY - static constexpr int32_t const excl = 00000200; // O_EXCL - static constexpr int32_t const noctty = 00000400; // O_NOCTTY - static constexpr int32_t const nofollow = 00400000; // O_NOFOLLOW - static constexpr int32_t const trunc = 00001000; // O_TRUNC - static constexpr int32_t const async = 00002000; // O_ASYNC - static constexpr int32_t const largefile = 00000000; // O_LARGEFILE - static constexpr int32_t const noatime = 01000000; // O_NOATIME - static constexpr int32_t const nonblock = 00004000; // O_NONBLOCK - static constexpr int32_t const ndelay = 00004000; // O_NDELAY - static constexpr int32_t const sync = 04010000; // O_SYNC + static constexpr int32_t const accessmode_mask = 03; // O_ACCMODE + static constexpr int32_t const rdonly = 0; // O_RDONLY + static constexpr int32_t const wronly = 01; // O_WRONLY + static constexpr int32_t const rdwr = 02; // O_RDWR + + static constexpr int32_t const append = 02000; // O_APPEND + static constexpr int32_t const async = 020000; // O_ASYNC + static constexpr int32_t const cloexec = 02000000; // O_CLOEXEC + static constexpr int32_t const creat = 0100; // O_CREAT + static constexpr int32_t const direct = 040000; // O_DIRECT + static constexpr int32_t const directory = 0200000; // O_DIRECTORY + static constexpr int32_t const dsync = 010000; // O_DSYNC + static constexpr int32_t const excl = 0200; // O_EXCL + static constexpr int32_t const largefile = 0100000; // O_LARGEFILE + static constexpr int32_t const noatime = 01000000; // O_NOATIME + static constexpr int32_t const noctty = 0400; // O_NOCTTY + static constexpr int32_t const nofollow = 0400000; // O_NOFOLLOW + static constexpr int32_t const nonblock = 04000; // O_NONBLOCK + static constexpr int32_t const ndelay = 04000; // O_NDELAY + static constexpr int32_t const path = 010000000; // O_PATH + static constexpr int32_t const sync = 04010000; // O_SYNC + static constexpr int32_t const tmpfile = 020200000; // O_TMPFILE + static constexpr int32_t const trunc = 01000; // O_TRUNC explicit openflags(int32_t value = 0); operator int32_t() const;