From 710e9b2b5c16f74f66420c66d12455ad518d42c7 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 2 Oct 2022 19:25:17 +0200 Subject: syscall/open: add the full suite of READ/WRITE flags --- src/shared/include/camellia/flags.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/shared') diff --git a/src/shared/include/camellia/flags.h b/src/shared/include/camellia/flags.h index 0eaa02e..b7cc42d 100644 --- a/src/shared/include/camellia/flags.h +++ b/src/shared/include/camellia/flags.h @@ -10,7 +10,20 @@ #define WRITE_TRUNCATE 1 -#define OPEN_CREATE 1 -#define OPEN_RO 2 - #define FSR_DELEGATE 1 + + +#define OPEN_READ 1 +#define OPEN_WRITE 2 +#define OPEN_RW 3 +/* not setting OPEN_READ nor OPEN_WRITE works as if OPEN_READ was set, but it also checks the execute bit. + * same as in plan9. */ +#define OPEN_EXEC 0 + +#define OPEN_READABLE(flags) ((flags & 3) != OPEN_WRITE) +#define OPEN_WRITEABLE(flags) (flags & OPEN_WRITE) + +/* Requires OPEN_WRITE to be set, enforced by the kernel. + * The idea is that if all flags which allow modifying the filesystem state require + * OPEN_WRITE to be set, filesystem handlers could just check for the OPEN_WRITE flag. */ +#define OPEN_CREATE 4 -- cgit v1.2.3