1.1 --- a/libfsclient/lib/src/file.cc Fri May 31 18:04:17 2024 +0200
1.2 +++ b/libfsclient/lib/src/file.cc Sat Jun 01 01:27:34 2024 +0200
1.3 @@ -455,6 +455,33 @@
1.4 return L4_EOK;
1.5 }
1.6
1.7 +/* Return notification flags for the given file access flags. */
1.8 +
1.9 +notify_flags_t file_notify_flags(flags_t flags)
1.10 +{
1.11 + notify_flags_t notify_flags = NOTIFY_PEER_CLOSED;
1.12 +
1.13 + switch (flags & 3)
1.14 + {
1.15 + case O_RDONLY:
1.16 + notify_flags |= NOTIFY_CONTENT_AVAILABLE;
1.17 + break;
1.18 +
1.19 + case O_RDWR:
1.20 + notify_flags |= NOTIFY_CONTENT_AVAILABLE | NOTIFY_SPACE_AVAILABLE;
1.21 + break;
1.22 +
1.23 + case O_WRONLY:
1.24 + notify_flags |= NOTIFY_SPACE_AVAILABLE;
1.25 + break;
1.26 +
1.27 + default:
1.28 + return 0;
1.29 + }
1.30 +
1.31 + return notify_flags;
1.32 +}
1.33 +
1.34 /* Return opening flags compatible with the given region flags. */
1.35
1.36 flags_t file_opening_flags(rm_flags_t rm_flags)