arc: Send the file flags
This is to support writing guest regular files from the host.
BUG=b:141958811
TEST=build
Change-Id: I71596618c0a3c7d2b837551a1c434dce538d8291
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2460966
Tested-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
diff --git a/arc/vm/vsock_proxy/message.proto b/arc/vm/vsock_proxy/message.proto
index 08dac9c..882c7a4 100644
--- a/arc/vm/vsock_proxy/message.proto
+++ b/arc/vm/vsock_proxy/message.proto
@@ -66,6 +66,8 @@
reserved 3; // uint64 file_size = 3 [deprecated=true];
reserved 4; // uint32 drm_virtgpu_res_handle = 4; [deprecated=true];
+
+ int32 flags = 5;
}
// Notify the data is available on a stream (pipe or socket) corresponding to
diff --git a/arc/vm/vsock_proxy/vsock_proxy.cc b/arc/vm/vsock_proxy/vsock_proxy.cc
index 6ea8770..f308cce 100644
--- a/arc/vm/vsock_proxy/vsock_proxy.cc
+++ b/arc/vm/vsock_proxy/vsock_proxy.cc
@@ -494,13 +494,14 @@
PLOG(ERROR) << "Failed to fstat";
return false;
}
+ int flags = fcntl(fd.get(), F_GETFL, 0);
+ if (flags < 0) {
+ PLOG(ERROR) << "Failed to find file status flags";
+ return false;
+ }
+ transferred_fd->set_flags(flags);
if (S_ISFIFO(st.st_mode)) {
- int flags = fcntl(fd.get(), F_GETFL, 0);
- if (flags < 0) {
- PLOG(ERROR) << "Failed to find file status flags";
- return false;
- }
switch (flags & O_ACCMODE) {
case O_RDONLY:
transferred_fd->set_type(arc_proxy::FileDescriptor::FIFO_READ);