qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 09/18] block: Export blk_pwritev_part() in block-backend-io.h


From: Hanna Reitz
Subject: Re: [PATCH 09/18] block: Export blk_pwritev_part() in block-backend-io.h
Date: Tue, 5 Jul 2022 10:24:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

On 17.05.22 13:38, Alberto Faria wrote:
Also convert it into a generated_co_wrapper.

Signed-off-by: Alberto Faria <afaria@redhat.com>
---
  block/block-backend.c             | 14 --------------
  block/coroutines.h                |  5 -----
  include/sysemu/block-backend-io.h |  4 ++++
  tests/unit/test-block-iothread.c  | 19 +++++++++++++++++++
  4 files changed, 23 insertions(+), 19 deletions(-)

[...]

diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
index 2fa1248445..6061762c97 100644
--- a/tests/unit/test-block-iothread.c
+++ b/tests/unit/test-block-iothread.c
@@ -183,6 +183,21 @@ static void test_sync_op_blk_preadv_part(BlockBackend *blk)
      g_assert_cmpint(ret, ==, -EIO);
  }
+static void test_sync_op_blk_pwritev_part(BlockBackend *blk)
+{
+    uint8_t buf[512];

Given you’ve initialized this in test_sync_op_blk_pwritev(), I think it should be initialized here, too.

With that done:

Reviewed-by: Hanna Reitz <hreitz@redhat.com>

+    QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, sizeof(buf));
+    int ret;
+
+    /* Success */
+    ret = blk_pwritev_part(blk, 0, sizeof(buf), &qiov, 0, 0);
+    g_assert_cmpint(ret, ==, 0);
+
+    /* Early error: Negative offset */
+    ret = blk_pwritev_part(blk, -2, sizeof(buf), &qiov, 0, 0);
+    g_assert_cmpint(ret, ==, -EIO);
+}
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]