diff options
author | Craig Chi <craigchi@google.com> | 2020-08-14 10:17:08 -0700 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2020-09-16 12:19:30 -0700 |
commit | d928d3c00a66a29933eee9671e3558cd8163337f (patch) | |
tree | 4ecb4d807f5928401741147ed0ad81817b5df2db /test/fuse/linux/fuse_base.cc | |
parent | a289c3862653cded271408b31a9e704be615503a (diff) |
Add function generating array of iovec with different FUSE structs
This commit adds a function in the newly created fuse_util library,
which accepts a variable number of arguments and data structures.
Fixes #3609
Diffstat (limited to 'test/fuse/linux/fuse_base.cc')
-rw-r--r-- | test/fuse/linux/fuse_base.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/fuse/linux/fuse_base.cc b/test/fuse/linux/fuse_base.cc index b1897cf88..c354e1dcb 100644 --- a/test/fuse/linux/fuse_base.cc +++ b/test/fuse/linux/fuse_base.cc @@ -26,6 +26,7 @@ #include "absl/strings/str_format.h" #include "gtest/gtest.h" +#include "test/util/fuse_util.h" #include "test/util/posix_error.h" #include "test/util/temp_path.h" #include "test/util/test_util.h" @@ -137,7 +138,6 @@ PosixError FuseTest::ServerConsumeFuseInit() { RETURN_ERROR_IF_SYSCALL_FAIL( RetryEINTR(read)(dev_fd_, buf.data(), buf.size())); - struct iovec iov_out[2]; struct fuse_out_header out_header = { .len = sizeof(struct fuse_out_header) + sizeof(struct fuse_init_out), .error = 0, @@ -148,12 +148,10 @@ PosixError FuseTest::ServerConsumeFuseInit() { struct fuse_init_out out_payload = { .major = 7, }; - iov_out[0].iov_len = sizeof(out_header); - iov_out[0].iov_base = &out_header; - iov_out[1].iov_len = sizeof(out_payload); - iov_out[1].iov_base = &out_payload; + auto iov_out = FuseGenerateIovecs(out_header, out_payload); - RETURN_ERROR_IF_SYSCALL_FAIL(RetryEINTR(writev)(dev_fd_, iov_out, 2)); + RETURN_ERROR_IF_SYSCALL_FAIL( + RetryEINTR(writev)(dev_fd_, iov_out.data(), iov_out.size())); return NoError(); } |