1.1 --- a/libfsclient/include/fsclient/file.h Fri May 31 18:04:17 2024 +0200
1.2 +++ b/libfsclient/include/fsclient/file.h Sat Jun 01 01:27:34 2024 +0200
1.3 @@ -122,6 +122,9 @@
1.4 long file_mmap_only(file_t *file, offset_t position, offset_t length,
1.5 offset_t start_visible, offset_t end_visible);
1.6
1.7 +/* Flags conversion. */
1.8 +
1.9 +notify_flags_t file_notify_flags(flags_t flags);
1.10 flags_t file_opening_flags(rm_flags_t rm_flags);
1.11 rm_flags_t file_region_flags(flags_t flags);
1.12
2.1 --- a/libfsclient/lib/src/file.cc Fri May 31 18:04:17 2024 +0200
2.2 +++ b/libfsclient/lib/src/file.cc Sat Jun 01 01:27:34 2024 +0200
2.3 @@ -455,6 +455,33 @@
2.4 return L4_EOK;
2.5 }
2.6
2.7 +/* Return notification flags for the given file access flags. */
2.8 +
2.9 +notify_flags_t file_notify_flags(flags_t flags)
2.10 +{
2.11 + notify_flags_t notify_flags = NOTIFY_PEER_CLOSED;
2.12 +
2.13 + switch (flags & 3)
2.14 + {
2.15 + case O_RDONLY:
2.16 + notify_flags |= NOTIFY_CONTENT_AVAILABLE;
2.17 + break;
2.18 +
2.19 + case O_RDWR:
2.20 + notify_flags |= NOTIFY_CONTENT_AVAILABLE | NOTIFY_SPACE_AVAILABLE;
2.21 + break;
2.22 +
2.23 + case O_WRONLY:
2.24 + notify_flags |= NOTIFY_SPACE_AVAILABLE;
2.25 + break;
2.26 +
2.27 + default:
2.28 + return 0;
2.29 + }
2.30 +
2.31 + return notify_flags;
2.32 +}
2.33 +
2.34 /* Return opening flags compatible with the given region flags. */
2.35
2.36 flags_t file_opening_flags(rm_flags_t rm_flags)