1.1 --- a/libfsclient/include/fsclient/file.h Mon May 30 00:47:07 2022 +0200
1.2 +++ b/libfsclient/include/fsclient/file.h Thu Jun 02 01:08:50 2022 +0200
1.3 @@ -112,6 +112,7 @@
1.4 long file_mmap(file_t *file, offset_t position, offset_t length,
1.5 offset_t start_visible, offset_t end_visible,
1.6 l4re_rm_flags_t region_flags);
1.7 +flags_t file_opening_flags(l4re_rm_flags_t rm_flags);
1.8 l4re_rm_flags_t file_region_flags(flags_t flags);
1.9 long file_resize(file_t *file, offset_t size);
1.10
2.1 --- a/libfsclient/lib/src/file.cc Mon May 30 00:47:07 2022 +0200
2.2 +++ b/libfsclient/lib/src/file.cc Thu Jun 02 01:08:50 2022 +0200
2.3 @@ -378,6 +378,18 @@
2.4 return L4_EOK;
2.5 }
2.6
2.7 +/* Return opening flags compatible with the given region flags. */
2.8 +
2.9 +flags_t file_opening_flags(l4re_rm_flags_t rm_flags)
2.10 +{
2.11 + if ((rm_flags & L4RE_RM_F_RW) == L4RE_RM_F_RW)
2.12 + return O_RDWR;
2.13 + else if (rm_flags & L4RE_RM_F_W)
2.14 + return O_WRONLY;
2.15 + else
2.16 + return O_RDONLY;
2.17 +}
2.18 +
2.19 /* Return mmap flags corresponding to the file access flags. */
2.20
2.21 l4re_rm_flags_t file_region_flags(flags_t flags)