ree fs rpc: open with best-effort allowing RO data fs
ree fs rpc: open with best-effort allowing RO data fs

The REE handler for open always uses flags O_RDWR at the moment.

This breaks the possibility to use read-only operations on a
read-only mounted filesystem at /data.

Change it to try to open with O_RDWR, if not possible fall back
to O_RDONLY and only fail if that isn't workable either.

If O_RDONLY isn't enough, then the TA should use another means
to get the fs mounted rw for the duration of his write activity.
He will get failures on the write action if not, but that is
fair enough.

Signed-off-by: Andy Green <e3579b1e47f273529f0f929453e939a68ede9fd1@warmcat.com>
Reviewed-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>
Reviewed-by: Jerome Forissier <ced78d268b4c9a0a20a59a9feeebd2ad90da03d3@linaro.org>
prime-zeng/optee_client