ceph_shutdown(cmount);
}
+TEST(LibCephFS, LlreadvLlwritev) {
+ struct ceph_mount_info *cmount;
+ ASSERT_EQ(ceph_create(&cmount, NULL), 0);
+ ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
+ ASSERT_EQ(0, ceph_conf_parse_env(cmount, NULL));
+ ASSERT_EQ(ceph_mount(cmount, NULL), 0);
+
+ int mypid = getpid();
+ char filename[256];
+
+ sprintf(filename, "test_llreadvllwritevfile%u", mypid);
+
+ Inode *root, *file;
+ ASSERT_EQ(ceph_ll_lookup_root(cmount, &root), 0);
+
+ Fh *fh;
+ struct ceph_statx stx;
+ UserPerm *perms = ceph_mount_perms(cmount);
+
+ ASSERT_EQ(ceph_ll_create(cmount, root, filename, 0666,
+ O_RDWR|O_CREAT|O_TRUNC, &file, &fh, &stx, 0, 0, perms), 0);
+
+ /* Reopen read-only */
+ char out0[] = "hello ";
+ char out1[] = "world\n";
+ struct iovec iov_out[2] = {
+ {out0, sizeof(out0)},
+ {out1, sizeof(out1)},
+ };
+ char in0[sizeof(out0)];
+ char in1[sizeof(out1)];
+ struct iovec iov_in[2] = {
+ {in0, sizeof(in0)},
+ {in1, sizeof(in1)},
+ };
+ ssize_t nwritten = iov_out[0].iov_len + iov_out[1].iov_len;
+ ssize_t nread = iov_in[0].iov_len + iov_in[1].iov_len;
+
+ ASSERT_EQ(ceph_ll_writev(cmount, fh, iov_out, 2, 0), nwritten);
+ ASSERT_EQ(ceph_ll_readv(cmount, fh, iov_in, 2, 0), nread);
+ ASSERT_EQ(0, strncmp((const char*)iov_in[0].iov_base, (const char*)iov_out[0].iov_base, iov_out[0].iov_len));
+ ASSERT_EQ(0, strncmp((const char*)iov_in[1].iov_base, (const char*)iov_out[1].iov_base, iov_out[1].iov_len));
+
+ ceph_ll_close(cmount, fh);
+ ceph_shutdown(cmount);
+}
+
TEST(LibCephFS, StripeUnitGran) {
struct ceph_mount_info *cmount;
ASSERT_EQ(ceph_create(&cmount, NULL), 0);